Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ollama context fix #5

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions llm-ollama.el
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ STREAMING if non-nil, turn on response streaming."
(car (last (llm-chat-prompt-interactions prompt)))))))
;; If the first item isn't an interaction, then it's a conversation which
;; we'll set as the chat context.
(when (not (type-of (car (llm-chat-prompt-interactions prompt))))
(push `("context" . ,(car (llm-chat-prompt-interactions prompt))) request-alist))
(when (not (eq (type-of (car (llm-chat-prompt-interactions prompt)))
'llm-chat-prompt-interaction))
(push `("context" . ,(cl-remove-if
(lambda (el)
(eq (type-of el) 'llm-chat-prompt-interaction))
(llm-chat-prompt-interactions prompt)))
request-alist))
(push `("prompt" . ,(string-trim text-prompt)) request-alist)
(push `("model" . ,(llm-ollama-chat-model provider)) request-alist)
(when (llm-chat-prompt-temperature prompt)
Expand Down