@agent-smith/agent 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +15 -2
- package/package.json +2 -2
package/dist/agent.js
CHANGED
|
@@ -210,13 +210,23 @@ class Agent {
|
|
|
210
210
|
if (options?.onToolsTurnEnd) {
|
|
211
211
|
options.onToolsTurnEnd(toolResults);
|
|
212
212
|
}
|
|
213
|
+
let thinking = "";
|
|
214
|
+
let final = "";
|
|
215
|
+
if (tpl?.tags?.think) {
|
|
216
|
+
const { think, finalAnswer } = splitThinking(res.text, tpl.tags.think.start, tpl.tags.think.end);
|
|
217
|
+
thinking = think;
|
|
218
|
+
final = finalAnswer;
|
|
219
|
+
}
|
|
213
220
|
if (it == 1) {
|
|
214
221
|
const t = {
|
|
215
222
|
user: prompt,
|
|
216
223
|
tools: toolResults,
|
|
217
224
|
};
|
|
218
225
|
if (assistant) {
|
|
219
|
-
t.assistant =
|
|
226
|
+
t.assistant = final;
|
|
227
|
+
}
|
|
228
|
+
if (thinking.length > 0) {
|
|
229
|
+
t.think = thinking;
|
|
220
230
|
}
|
|
221
231
|
this.history.push(t);
|
|
222
232
|
}
|
|
@@ -225,7 +235,10 @@ class Agent {
|
|
|
225
235
|
tools: toolResults,
|
|
226
236
|
};
|
|
227
237
|
if (assistant) {
|
|
228
|
-
t.assistant =
|
|
238
|
+
t.assistant = final;
|
|
239
|
+
}
|
|
240
|
+
if (thinking.length > 0) {
|
|
241
|
+
t.think = thinking;
|
|
229
242
|
}
|
|
230
243
|
this.history.push(t);
|
|
231
244
|
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/synw/agent-smith.git"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.3.
|
|
8
|
+
"version": "0.3.1",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
11
11
|
"build": "rm -rf dist/* && tsc"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
21
21
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
22
22
|
"@types/node": "^25.3.0",
|
|
23
|
-
"openai": "^6.
|
|
23
|
+
"openai": "^6.24.0",
|
|
24
24
|
"rollup": "^4.59.0",
|
|
25
25
|
"ts-node": "^10.9.2",
|
|
26
26
|
"tslib": "2.8.1",
|