From 5716ac5ed51f8feba7fe4375cc66edfd4ea194f0 Mon Sep 17 00:00:00 2001 From: Marcello Fitton <106866560+angelplusultra@users.noreply.github.com> Date: Mon, 24 Nov 2025 13:24:10 -0800 Subject: [PATCH] Custom Default System Prompt (#4487) * Add Default System Prompt Management - Introduced a new route for fetching and updating the default system prompt in the backend. - Added a new Admin page for managing the default system prompt, including a form for editing and saving changes. - Updated the SettingsSidebar to include a link to the new Default System Prompt page. - Implemented fetching of available system prompt variables for use in the prompt editor. - Enhanced the ChatSettings and ChatPromptSettings components to support the new default system prompt functionality. This commit lays the groundwork for improved management of system prompts across workspaces. * Remove validation for system prompt in ChatSettings component * Add comment for system prompt in workspaces model * linting, simplify logic for default assumption * dev build --------- Co-authored-by: timothycarambat --- .github/workflows/dev-build.yaml | 2 +- frontend/src/App.jsx | 7 + .../src/components/SettingsSidebar/index.jsx | 6 + frontend/src/models/system.js | 33 +++ .../pages/Admin/DefaultSystemPrompt/index.jsx | 270 ++++++++++++++++++ .../ChatSettings/ChatPromptSettings/index.jsx | 127 ++++---- .../WorkspaceSettings/ChatSettings/index.jsx | 9 +- frontend/src/utils/chat/index.js | 2 +- frontend/src/utils/paths.js | 3 + server/endpoints/system.js | 51 ++++ server/models/systemSettings.js | 10 + server/models/workspace.js | 12 +- server/prisma/schema.prisma | 1 + server/utils/chats/index.js | 4 +- server/utils/helpers/chat/convertTo.js | 9 +- 15 files changed, 477 insertions(+), 69 deletions(-) create mode 100644 frontend/src/pages/Admin/DefaultSystemPrompt/index.jsx diff --git a/.github/workflows/dev-build.yaml b/.github/workflows/dev-build.yaml index 8d1f8d58..341c38da 100644 --- a/.github/workflows/dev-build.yaml +++ b/.github/workflows/dev-build.yaml @@ -6,7 +6,7 @@ concurrency: on: push: - branches: ['4595-refactor-pwa'] # put your current branch to create a build. Core team only. + branches: ['3906-global-default-system-prompt'] # put your current branch to create a build. Core team only. paths-ignore: - '**.md' - 'cloud-deployments/*' diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 83d2b301..24e4becb 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -93,6 +93,9 @@ const SystemPromptVariables = lazy( const MobileConnections = lazy( () => import("@/pages/GeneralSettings/MobileConnections") ); +const DefaultSystemPrompt = lazy( + () => import("@/pages/Admin/DefaultSystemPrompt") +); export default function App() { return ( @@ -215,6 +218,10 @@ export default function App() { path="/settings/branding" element={} /> + } + /> } diff --git a/frontend/src/components/SettingsSidebar/index.jsx b/frontend/src/components/SettingsSidebar/index.jsx index ad702411..f1bd5489 100644 --- a/frontend/src/components/SettingsSidebar/index.jsx +++ b/frontend/src/components/SettingsSidebar/index.jsx @@ -285,6 +285,12 @@ const SidebarOptions = ({ user = null, t }) => ( href: paths.settings.invites(), roles: ["admin", "manager"], }, + { + btnText: "Default System Prompt", + href: paths.settings.defaultSystemPrompt(), + flex: true, + roles: ["admin"], + }, ]} />