cc-viewer 0.1.1 → 0.1.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/cli.js +1 -1
- package/interceptor.js +10 -6
- package/lib/assets/index-BMPce72-.js +401 -0
- package/lib/assets/index-C7-c9XfU.css +1 -0
- package/lib/index.html +5 -48
- package/lib/server.js +90 -69
- package/package.json +14 -3
- package/lib/app.js +0 -753
- package/lib/style.css +0 -824
- package/lib/vendor/json-viewer.bundle.js +0 -1289
- package/lib/vendor/marked.umd.js +0 -74
package/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ try {
|
|
|
26
26
|
writeFileSync(cliPath, lines.join('\n'));
|
|
27
27
|
console.log('✅ CC Viewer 运行成功');
|
|
28
28
|
}
|
|
29
|
-
console.log(`直接运行 claude
|
|
29
|
+
console.log(`直接运行 claude 即可,启动时会显示 cc-viewer 的实际运行地址`);
|
|
30
30
|
console.log(`如果后续功能失效,请重新执行一次 ccviewer 命令即可`);
|
|
31
31
|
} catch (err) {
|
|
32
32
|
if (err.code === 'ENOENT') {
|
package/interceptor.js
CHANGED
|
@@ -72,10 +72,10 @@ function assembleStreamMessage(events) {
|
|
|
72
72
|
if (event.delta.type === 'text_delta' && event.delta.text) {
|
|
73
73
|
contentBlocks[event.index].text += event.delta.text;
|
|
74
74
|
} else if (event.delta.type === 'input_json_delta' && event.delta.partial_json) {
|
|
75
|
-
if (
|
|
76
|
-
contentBlocks[event.index].
|
|
75
|
+
if (typeof contentBlocks[event.index]._inputJson !== 'string') {
|
|
76
|
+
contentBlocks[event.index]._inputJson = '';
|
|
77
77
|
}
|
|
78
|
-
contentBlocks[event.index].
|
|
78
|
+
contentBlocks[event.index]._inputJson += event.delta.partial_json;
|
|
79
79
|
} else if (event.delta.type === 'thinking_delta' && event.delta.thinking) {
|
|
80
80
|
contentBlocks[event.index].thinking += event.delta.thinking;
|
|
81
81
|
} else if (event.delta.type === 'signature_delta' && event.delta.signature) {
|
|
@@ -88,12 +88,13 @@ function assembleStreamMessage(events) {
|
|
|
88
88
|
// 内容块结束
|
|
89
89
|
if (event.index >= 0 && contentBlocks[event.index]) {
|
|
90
90
|
// 如果是 tool_use 且有累积的 input JSON,尝试解析
|
|
91
|
-
if (contentBlocks[event.index].type === 'tool_use' && contentBlocks[event.index].
|
|
91
|
+
if (contentBlocks[event.index].type === 'tool_use' && typeof contentBlocks[event.index]._inputJson === 'string') {
|
|
92
92
|
try {
|
|
93
|
-
contentBlocks[event.index].input = JSON.parse(contentBlocks[event.index].
|
|
93
|
+
contentBlocks[event.index].input = JSON.parse(contentBlocks[event.index]._inputJson);
|
|
94
94
|
} catch {
|
|
95
|
-
|
|
95
|
+
contentBlocks[event.index].input = contentBlocks[event.index]._inputJson;
|
|
96
96
|
}
|
|
97
|
+
delete contentBlocks[event.index]._inputJson;
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
break;
|
|
@@ -339,3 +340,6 @@ export function setupInterceptor() {
|
|
|
339
340
|
|
|
340
341
|
// 自动执行拦截器设置
|
|
341
342
|
setupInterceptor();
|
|
343
|
+
|
|
344
|
+
// 同步启动 Web Viewer 服务
|
|
345
|
+
import('cc-viewer/server.js').catch(() => {});
|