@shun-js/aibaiban-server 1.4.2 → 1.4.4
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/package.json +2 -2
- package/server/service/CCService.js +21 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shun-js/aibaiban-server",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "aibaiban.com server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai aibaiban"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public",
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "9d4e0bbc0f78fe5d2fcd8eb17549f5beda097c7e"
|
|
50
50
|
}
|
|
@@ -52,29 +52,28 @@ exports.drawCC = async (req, res) => {
|
|
|
52
52
|
clearInterval(keepalive);
|
|
53
53
|
const duration = Date.now() - startTime;
|
|
54
54
|
|
|
55
|
-
// 解析 Claude Code
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
// 非 JSON,当文字回复
|
|
55
|
+
// 解析 Claude Code 返回结果:[MERMAID]、[REPLY]、[IRRELEVANT] 前缀
|
|
56
|
+
const trimmed = result.trim();
|
|
57
|
+
|
|
58
|
+
if (trimmed.startsWith("[MERMAID]")) {
|
|
59
|
+
const code = trimmed.slice("[MERMAID]".length).trim();
|
|
60
|
+
req.logger.info(methodName, "mermaid", code.length, `${duration}ms`);
|
|
61
|
+
chatFeishuMsg(req, `cc-mermaid-${code.length}chars`);
|
|
62
|
+
res.streaming(
|
|
63
|
+
`data: ${JSON.stringify({ type: "mermaid", code, duration })}\n\n`,
|
|
64
|
+
);
|
|
65
|
+
} else if (trimmed.startsWith("[REPLY] ")) {
|
|
66
|
+
const content = trimmed.slice("[REPLY] ".length);
|
|
67
|
+
res.streaming(
|
|
68
|
+
`data: ${JSON.stringify({ type: "message", content, duration })}\n\n`,
|
|
69
|
+
);
|
|
70
|
+
} else if (trimmed === "[IRRELEVANT]") {
|
|
71
|
+
res.streaming(
|
|
72
|
+
`data: ${JSON.stringify({ type: "welcome", duration })}\n\n`,
|
|
73
|
+
);
|
|
74
|
+
} else {
|
|
76
75
|
res.streaming(
|
|
77
|
-
`data: ${JSON.stringify({ type: "message", content:
|
|
76
|
+
`data: ${JSON.stringify({ type: "message", content: trimmed, duration })}\n\n`,
|
|
78
77
|
);
|
|
79
78
|
}
|
|
80
79
|
|