From 752f73fa5c1c8bea0c7334924a4184876f55a825 Mon Sep 17 00:00:00 2001 From: Aric Lasry Date: Thu, 1 Aug 2024 12:26:44 +0200 Subject: [PATCH 1/2] Allow admins to disable the GPT4 global agent. --- front/lib/api/assistant/global_agents.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/front/lib/api/assistant/global_agents.ts b/front/lib/api/assistant/global_agents.ts index 1ddc787c9a80..61b55f530e2b 100644 --- a/front/lib/api/assistant/global_agents.ts +++ b/front/lib/api/assistant/global_agents.ts @@ -6,6 +6,7 @@ const readFileAsync = promisify(fs.readFile); import type { AgentActionConfigurationType, + AgentConfigurationStatus, AgentConfigurationType, AgentModelConfigurationType, ConnectorProvider, @@ -214,10 +215,20 @@ function _getGPT35TurboGlobalAgent({ function _getGPT4GlobalAgent({ auth, + settings, }: { auth: Authenticator; + settings: GlobalAgentSettings | null; }): AgentConfigurationType { - const status = !auth.isUpgraded() ? "disabled_free_workspace" : "active"; + let status: AgentConfigurationStatus = "active"; + + if (settings) { + status = settings.status; + } + if (!auth.isUpgraded()) { + status = "disabled_free_workspace"; + } + return { id: -1, sId: GLOBAL_AGENTS_SID.GPT4, @@ -228,7 +239,7 @@ function _getGPT4GlobalAgent({ description: GPT_4O_MODEL_CONFIG.description, instructions: null, pictureUrl: "https://dust.tt/static/systemavatar/gpt4_avatar_full.png", - status, + status: status, scope: "global", userListStatus: status === "active" ? "in-list" : "not-in-list", model: { @@ -1026,7 +1037,7 @@ function getGlobalAgent( agentConfiguration = _getGPT35TurboGlobalAgent({ settings }); break; case GLOBAL_AGENTS_SID.GPT4: - agentConfiguration = _getGPT4GlobalAgent({ auth }); + agentConfiguration = _getGPT4GlobalAgent({ auth, settings }); break; case GLOBAL_AGENTS_SID.CLAUDE_INSTANT: agentConfiguration = _getClaudeInstantGlobalAgent({ settings }); From f02b8057f67510a71ebe6304cb31b50c10692fcb Mon Sep 17 00:00:00 2001 From: Aric Lasry Date: Thu, 1 Aug 2024 14:19:56 +0200 Subject: [PATCH 2/2] neat. --- front/lib/api/assistant/global_agents.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/lib/api/assistant/global_agents.ts b/front/lib/api/assistant/global_agents.ts index 61b55f530e2b..cd99c5ebbd8b 100644 --- a/front/lib/api/assistant/global_agents.ts +++ b/front/lib/api/assistant/global_agents.ts @@ -239,7 +239,7 @@ function _getGPT4GlobalAgent({ description: GPT_4O_MODEL_CONFIG.description, instructions: null, pictureUrl: "https://dust.tt/static/systemavatar/gpt4_avatar_full.png", - status: status, + status, scope: "global", userListStatus: status === "active" ? "in-list" : "not-in-list", model: {