Skip to content

Commit 0a1cc77

Browse files
committed
Fix ollama
1 parent 113671d commit 0a1cc77

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/eca/features/chat.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,11 @@
113113
[provider model] (string/split full-model #"/" 2)
114114
past-messages (get-in db [:chats chat-id :messages] [])
115115
all-tools (f.tools/all-tools behavior @db* config)
116-
provider-auth (get-in db [:auth provider])
117116
received-msgs* (atom "")
118117
received-thinking* (atom "")
119118
add-to-history! (fn [msg]
120119
(swap! db* update-in [:chats chat-id :messages] (fnil conj []) msg))]
121-
(when-let [expires-at (:expires-at provider-auth)]
120+
(when-let [expires-at (get-in db [:auth provider :expires-at])]
122121
(when (<= (long expires-at) (quot (System/currentTimeMillis) 1000))
123122
(send-content! chat-ctx :system {:type :progress
124123
:state :running
@@ -137,7 +136,7 @@
137136
:past-messages past-messages
138137
:config config
139138
:tools all-tools
140-
:provider-auth provider-auth
139+
:provider-auth (get-in @db* [:auth provider])
141140
:on-first-response-received (fn [& _]
142141
(assert-chat-not-stopped! chat-ctx)
143142
(doseq [message user-messages]

src/eca/llm_providers/ollama.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
:function content}]}
9292
"tool_call_output" {:role "tool" :content (llm-util/stringfy-tool-result content)}
9393
"reason" {:role "assistant" :content (:text content)}
94-
msg))
94+
{:role (:role msg)
95+
:content (-> msg :content first :text)}))
9596
past-messages))
9697

9798
(defn completion! [{:keys [model user-messages reason? instructions api-url past-messages tools]}

0 commit comments

Comments
 (0)