Skip to content

Commit ca5514a

Browse files
committed
Fix reason-id on openai models afecting chat thoughts messages.
1 parent 59679b0 commit ca5514a

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Fix reason-id on openai models afecting chat thoughts messages.
6+
57
## 0.14.2
68

79
- Fix MCPs not starting because of graal reflection issue.

docs/features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ Provides access to run shell commands, useful to run build tools, tests, and oth
3838
User can include contexts to the chat, which can help LLM generate output with better quality.
3939
Here are the current supported contexts types:
4040

41-
- `file`: a file in the workspace, server will pass its content to LLM.
41+
- `file`: a file in the workspace, server will pass its content to LLM (Supports optional line range).
4242
- `directory`: a directory in the workspace, server will read all file contexts and pass to LLM.
4343
- `repoMap`: a summary view of workspaces files and folders, server will calculate this and pass to LLM. Currently, the repo-map includes only the file paths in git.
4444

4545
### Commands
4646

47-
Eca supports commands that usually arer triggered via `/` in the chat, completing in the chat will show the known commands which include ECA commands and MCP prompts.
47+
Eca supports commands that usually arer triggered via `/` in the chat, completing in the chat will show the known commands which include ECA commands, MCP prompts and resources.
4848

4949
## Completion
5050

src/eca/llm_providers/openai.clj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
(def base-url "https://api.openai.com")
1616

1717
(defn ^:private base-completion-request! [{:keys [rid body api-url api-key on-error on-response]}]
18-
(let [url (str api-url responses-path)
19-
reason-id (str (random-uuid))]
18+
(let [url (str api-url responses-path)]
2019
(llm-util/log-request logger-tag rid url body)
2120
(http/post
2221
url
@@ -35,7 +34,7 @@
3534
(with-open [rdr (io/reader body)]
3635
(doseq [[event data] (llm-util/event-data-seq rdr)]
3736
(llm-util/log-response logger-tag rid event data)
38-
(on-response event data reason-id))))
37+
(on-response event data))))
3938
(catch Exception e
4039
(on-error {:exception e}))))
4140
(fn [e]
@@ -83,7 +82,7 @@
8382
:max_output_tokens max-output-tokens}
8483
mcp-call-by-item-id* (atom {})
8584
on-response-fn
86-
(fn handle-response [event data reason-id]
85+
(fn handle-response [event data]
8786
(case event
8887
;; text
8988
"response.output_text.delta"
@@ -112,7 +111,7 @@
112111
:on-response handle-response})
113112
(swap! mcp-call-by-item-id* dissoc (-> data :item :id)))
114113
"reasoning" (on-reason {:status :finished
115-
:id reason-id})
114+
:id (-> data :item :id)})
116115
nil)
117116

118117
;; URL mentioned
@@ -128,7 +127,7 @@
128127
"response.output_item.added"
129128
(case (-> data :item :type)
130129
"reasoning" (on-reason {:status :started
131-
:id reason-id})
130+
:id (-> data :item :id)})
132131
"function_call" (let [call-id (-> data :item :call_id)
133132
item-id (-> data :item :id)
134133
name (-> data :item :name)]

0 commit comments

Comments
 (0)