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
[BOT-1272] Fix missing `metabot-id` in streaming request (#72114)
Tyler Plude742b2190cda9
diff --git a/src/metabase/metabot/api.clj b/src/metabase/metabot/api.cljindex 6866a2956bc..8359b0bbfdc 100644--- a/src/metabase/metabot/api.clj+++ b/src/metabase/metabot/api.clj@@ -204,7 +204,8 @@(log/info "Using native Clojure agent" {:profile-id profile-id :debug? debug?})(native-agent-streaming-request- {:profile-id profile-id+ {:metabot-id metabot-id+ :profile-id profile-id:message message:context context:history historydiff --git a/test/metabase/metabot/api_test.clj b/test/metabase/metabot/api_test.cljindex e183567bb23..1062e014e02 100644--- a/test/metabase/metabot/api_test.clj+++ b/test/metabase/metabot/api_test.clj@@ -569,3 +569,27 @@{:type "dashboard"}{:type "model" :query native :chart_configs [{:query native}]}]result)))))++(deftest streaming-request-passes-metabot-id-test+ (testing "streaming-request passes metabot-id to native-agent-streaming-request"+ (let [captured-args (atom nil)+ test-metabot-id metabot.config/embedded-metabot-id]+ (with-redefs [metabot.config/check-metabot-enabled! (constantly nil)+ api/store-aiservice-messages! (constantly nil)+ api/native-agent-streaming-request (fn [args]+ (reset! captured-args args)+ ;; Return a minimal streaming response+ nil)]+ (api/streaming-request {:metabot_id test-metabot-id+ :profile_id nil+ :message "test message"+ :context {}+ :history []+ :conversation_id (str (random-uuid))+ :state {}+ :debug false})+ (testing "metabot-id is included in the arguments"+ (is (some? (:metabot-id @captured-args))+ "metabot-id should not be nil")+ (is (= test-metabot-id (:metabot-id @captured-args))+ "metabot-id should match the input metabot_id"))))))