File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 5555 :enabled-fn (fn [{:keys [db]}] (-> db :client-capabilities :code-assistant :chat-capabilities :ask-question ))
5656 :summary-fn (fn [{:keys [args]}]
5757 (if-let [q (get args " question" )]
58- (let [prefix " Q: "
58+ (let [q (string/replace q #"[\r\n ]+" " " )
59+ prefix " Q: "
5960 max-len 50
6061 available (- max-len (count prefix))]
6162 (if (> (count q) available)
Original file line number Diff line number Diff line change 139139 (is (= " Q: Short question?" (summary-fn {:args {" question" " Short question?" }})))
140140 (is (= " Q: This is a very long question that exceeds th..."
141141 (summary-fn {:args {" question" " This is a very long question that exceeds the fifty character limit" }})))))
142+ (testing " Summary strips newlines from question"
143+ (let [summary-fn (get-in f.tools.ask-user/definitions [" ask_user" :summary-fn ])]
144+ (is (= " Q: First line second line" (summary-fn {:args {" question" " First line\n second line" }})))))
142145 (testing " Summary shows preparing when question not yet available"
143146 (let [summary-fn (get-in f.tools.ask-user/definitions [" ask_user" :summary-fn ])]
144147 (is (= " Preparing question" (summary-fn {:args {}}))))))
You can’t perform that action at this time.
0 commit comments