Skip to content

Commit

Permalink
Allow admins to disable the GPT4 global agent. (#6618)
Browse files Browse the repository at this point in the history
* Allow admins to disable the GPT4 global agent.

* neat.
  • Loading branch information
lasryaric authored and albandum committed Aug 28, 2024
1 parent 0c0ebcf commit 7cb2ca2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions front/lib/api/assistant/global_agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const readFileAsync = promisify(fs.readFile);

import type {
AgentActionConfigurationType,
AgentConfigurationStatus,
AgentConfigurationType,
AgentModelConfigurationType,
ConnectorProvider,
Expand Down Expand Up @@ -216,10 +217,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,
Expand Down Expand Up @@ -1044,7 +1055,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 });
Expand Down

0 comments on commit 7cb2ca2

Please sign in to comment.