@agent-smith/agent 0.3.1 → 0.3.2
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 +26 -2
- package/dist/utils.js +1 -1
- package/package.json +3 -3
package/dist/agent.js
CHANGED
|
@@ -148,8 +148,32 @@ class Agent {
|
|
|
148
148
|
throw new Error(`error processing model answer:\n, ${error}`);
|
|
149
149
|
}
|
|
150
150
|
if (assistant) {
|
|
151
|
-
if (
|
|
152
|
-
|
|
151
|
+
if (tpl.tags?.think?.start) {
|
|
152
|
+
let t = res.text;
|
|
153
|
+
if (toolsCall.length > 0) {
|
|
154
|
+
if (tpl?.tags?.toolCall?.start) {
|
|
155
|
+
t = res.text.split(tpl.tags.toolCall.start)[0].trim();
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
console.warn("Model called tools but not tool call tags found in template");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const { think, finalAnswer } = splitThinking(t, tpl.tags.think.start, tpl.tags.think.end);
|
|
162
|
+
if (think.length > 0) {
|
|
163
|
+
if (options?.onThink) {
|
|
164
|
+
options.onThink(think);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (finalAnswer.length > 0) {
|
|
168
|
+
if (options?.onAssistant) {
|
|
169
|
+
options.onAssistant(finalAnswer);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
if (options?.onAssistant) {
|
|
175
|
+
options.onAssistant(assistant);
|
|
176
|
+
}
|
|
153
177
|
}
|
|
154
178
|
}
|
|
155
179
|
const toolResults = new Array();
|
package/dist/utils.js
CHANGED
|
@@ -26,7 +26,7 @@ function splitThinking(text, startTag, endTag) {
|
|
|
26
26
|
let answer = "";
|
|
27
27
|
const st = text.split(endTag);
|
|
28
28
|
if (st.length > 1) {
|
|
29
|
-
think = extractBetweenTags(text, startTag, endTag);
|
|
29
|
+
think = extractBetweenTags(text, startTag, endTag).trim();
|
|
30
30
|
answer = st[1].trim();
|
|
31
31
|
}
|
|
32
32
|
else {
|
package/package.json
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
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.2",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"buildrl": "rm -rf dist/* && rollup -c",
|
|
11
11
|
"build": "rm -rf dist/* && tsc"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@locallm/api": "^0.7.3",
|
|
15
|
-
"modprompt": "^0.14.
|
|
15
|
+
"modprompt": "^0.14.1",
|
|
16
16
|
"restmix": "^0.6.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@locallm/types": "^0.7.
|
|
19
|
+
"@locallm/types": "^0.7.1",
|
|
20
20
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
21
21
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
22
22
|
"@types/node": "^25.3.0",
|