Skip to content

Commit 5d262a9

Browse files
committed
Support fileChange for eca_write_file as well
1 parent f96631e commit 5d262a9

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Support custom system prompts via config `systemPromptTemplate`.
66
- Add support for file change diffs on `eca_edit_file` tool call.
7+
- Fix response output to LLM when tool call is rejected.
78

89
## 0.15.3
910

resources/eca_prompt.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ Pay attention to the langauge name after the code block backticks start, use the
1111
</communication>
1212

1313
<edit_file_instructions>
14-
Before editing a file, ensure you have its content via the provided context or eca_read_file tool.
15-
Use the eca_edit_file tool to modify files.
16-
NEVER show the code edits to the user - only call the tool. The system will apply and display the edits.
17-
For each file, give a short description of what needs to be edited, then use the eca_edit_file tool. You can use the tool multiple times in a response, and you can keep writing text after using a tool.
18-
The eca_edit_file tool is very smart and can understand how to apply your edits to the user's files.
14+
NEVER show the code edits or new files to the user - only call the proper tool. The system will apply and display the edits.
15+
For each file, give a short description of what needs to be edited, then use the available tool. You can use the tool multiple times in a response, and you can keep writing text after using a tool.
1916
</edit_file_instructions>
2017

2118
<tool_calling>

src/eca/features/chat.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@
247247
:details details)))
248248
(do
249249
(add-to-history! {:role "tool_call" :content tool-call})
250-
(add-to-history! {:role "tool_call_output" :content (assoc tool-call :output {:contents [{:content "Tool call rejected by user"
251-
:error true
250+
(add-to-history! {:role "tool_call_output" :content (assoc tool-call :output {:error true
251+
:contents [{:text "Tool call rejected by user"
252252
:type :text}]})})
253253
(send-content! chat-ctx :assistant
254254
(assoc-some

src/eca/features/tools.clj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@
9898
(update :tools #(mapv with-tool-status %)))))})))
9999
(defn get-tool-call-details [name arguments]
100100
(case name
101+
"eca_write_file" (let [path (get arguments "path")
102+
content (get arguments "content")]
103+
(when (and path content)
104+
(let [{:keys [added removed diff]} (diff/diff "" content path)]
105+
{:type :fileChange
106+
:path path
107+
:linesAdded added
108+
:linesRemoved removed
109+
:diff diff})))
101110
"eca_edit_file" (let [path (get arguments "path")
102111
original-content (get arguments "original_content")
103112
new-content (get arguments "new_content")

0 commit comments

Comments
 (0)