The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Apply the chat system prompt to Metabot in Slack (#82639)
Andrei Simionescu4b6744c1f423
diff --git a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotSystemPromptsPage/MetabotSystemPromptsPage.tsx b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotSystemPromptsPage/MetabotSystemPromptsPage.tsxindex 70c9fe59b31..9598efe7f2b 100644--- a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotSystemPromptsPage/MetabotSystemPromptsPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/MetabotSystemPromptsPage/MetabotSystemPromptsPage.tsx@@ -65,7 +65,7 @@ export function MetabotChatPromptPage() {return (<SystemPromptPagetitle={t`AI chat prompt instructions`}- description={t`Add instructions here for the sidebar AI chat experience in ${applicationName}. You might want to give instructions about tone, types of entities to prefer, and things like that.`}+ description={t`Add instructions here for the sidebar AI chat experience in ${applicationName} and for Metabot in Slack. You might want to give instructions about tone, types of entities to prefer, and things like that.`}settingKey="metabot-chat-system-prompt"/>);diff --git a/resources/metabot/prompts/system/slackbot.selmer b/resources/metabot/prompts/system/slackbot.selmerindex 77a77935162..cffb39d2006 100644--- a/resources/metabot/prompts/system/slackbot.selmer+++ b/resources/metabot/prompts/system/slackbot.selmer@@ -397,3 +397,9 @@ Where:</csv_uploads>{% endif %}+{% if custom_instructions %}++# Custom Instructions++{{ custom_instructions|safe }}+{% endif %}diff --git a/src/metabase/metabot/settings.clj b/src/metabase/metabot/settings.cljindex fd747fba44a..1bc01b61fd7 100644--- a/src/metabase/metabot/settings.clj+++ b/src/metabase/metabot/settings.clj@@ -54,7 +54,7 @@:feature :ai-controls)(defsetting metabot-chat-system-prompt- (deferred-tru "Custom instructions appended to Metabot''s system prompt for the chat experience (the AI sidebar and embedded Metabot).")+ (deferred-tru "Custom instructions appended to Metabot''s system prompt for the chat experience (the AI sidebar, embedded Metabot, and Metabot in Slack)."):type :string:default "":visibility :admindiff --git a/test/metabase/metabot/agent/prompt_gating_test.clj b/test/metabase/metabot/agent/prompt_gating_test.cljindex 56475445a65..c7a2d9f835e 100644--- a/test/metabase/metabot/agent/prompt_gating_test.clj+++ b/test/metabase/metabot/agent/prompt_gating_test.clj@@ -249,9 +249,11 @@(deftest custom-chat-instructions-injected-when-set-test(mt/with-premium-features #{:ai-controls}(mt/with-temporary-setting-values [metabot-chat-system-prompt "Always respond in French."]- (let [rendered (render-template "internal.selmer" all-yes-perms)]- (is (re-find #"Custom Instructions" rendered))- (is (re-find #"Always respond in French" rendered))))))+ (doseq [template ["internal.selmer" "slackbot.selmer"]]+ (testing template+ (let [rendered (render-template template all-yes-perms)]+ (is (re-find #"Custom Instructions" rendered))+ (is (re-find #"Always respond in French" rendered))))))))(deftest custom-sql-instructions-injected-when-set-test(mt/with-premium-features #{:ai-controls}