File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 2929; ;
3030; ;; API
3131
32+ (defun google-gemini-content-make-contents (text )
33+ " Create a contents value."
34+ `((parts . [((text . , text ))])))
35+
3236;;;### autoload
33- (cl-defun google-gemini-generate- content ( contents callback
37+ (cl-defun google-gemini-content-generate ( contents callback
3438 &key
3539 (content-type " application/json" ))
3640 " Send generate content request."
3943 :type " POST"
4044 :headers (google-gemini--headers content-type)
4145 :data (google-gemini--json-encode
42- `((" contents" . , contents )))
46+ `((" contents" . [ , contents] )))
4347 :parser 'json-read
4448 :complete (cl-function
4549 (lambda (&key data &allow-other-keys )
4953; ;; Application
5054
5155;;;### autoload
52- (defun google-gemini-say ()
56+ (defun google-gemini-content-prompt ()
5357 " Start making a conversation to Google Gemini."
5458 (interactive )
55- )
59+ (if-let* ((text (read-string " Content: " ))
60+ (contents (google-gemini-content-make-contents text)))
61+ (google-gemini-content-generate contents
62+ (lambda (data )
63+ (let-alist data
64+ (let-alist (elt .candidates 0 )
65+ (let-alist .content
66+ (let-alist (elt .parts 0 )
67+ (message " %s " .text)))))))
68+ (user-error " Abort, cancel generate content operation" )))
5669
5770(provide 'google-gemini-content )
5871; ;; google-gemini-content.el ends here
You can’t perform that action at this time.
0 commit comments