Skip to content

Commit a49dfb4

Browse files
committed
enable googleSearch feature in gemini calls
1 parent 7762a78 commit a49dfb4

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

calcit.cirru

Lines changed: 43 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compact.cirru

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,16 @@
222222
d! $ :: :states cursor
223223
-> state (assoc :answer nil) (assoc :loading? true)
224224
let
225-
selected $ js-await (get-selected)
225+
selected $ if (.includes? prompt-text "\"{{selected}}")
226+
js-await $ get-selected
226227
gen-ai $ let
227228
ai @*gen-ai-new
228229
; js/console.log ai
229230
, ai
230231
content $ .!replace prompt-text "\"{{selected}}" (or selected "\"<未找到选中内容>")
231232
json? $ or (.!includes prompt-text "\"{{json}}") (.!includes prompt-text "\"{{JSON}}")
232233
think? $ or (.!includes prompt-text "\"{{think}}") (.!includes prompt-text "\"{{THINK}}")
234+
search? $ or (.!includes prompt-text "\"{{search}}") (.!includes prompt-text "\"{{SEARCH}}")
233235
sdk-result $ js-await
234236
.!generateContentStream (.-models gen-ai)
235237
js-object
@@ -252,6 +254,8 @@
252254
abort $ new js/AbortController
253255
reset! *abort-control abort
254256
.-signal abort
257+
:tools $ js-array
258+
js-object $ :googleSearch (js-object)
255259
if json?
256260
js-object $ "\"responseMimeType" "\"application/json"
257261
, js/undefined

0 commit comments

Comments
 (0)