@agent-smith/agent 0.3.1 → 0.3.3
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 +17 -2
- package/dist/utils.js +1 -1
- package/package.json +3 -3
package/dist/agent.js
CHANGED
|
@@ -148,8 +148,23 @@ 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
|
+
const { think, finalAnswer } = splitThinking(assistant, tpl.tags.think.start, tpl.tags.think.end);
|
|
153
|
+
if (think.length > 0) {
|
|
154
|
+
if (options?.onThink) {
|
|
155
|
+
options.onThink(think);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (finalAnswer.length > 0) {
|
|
159
|
+
if (options?.onAssistant) {
|
|
160
|
+
options.onAssistant(finalAnswer);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
if (options?.onAssistant) {
|
|
166
|
+
options.onAssistant(assistant);
|
|
167
|
+
}
|
|
153
168
|
}
|
|
154
169
|
}
|
|
155
170
|
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.3",
|
|
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.2",
|
|
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",
|