fix: 修复工具调用用量关联错误并优化细节配置

- 修复前端工具调用中用量统计先后顺序导致未正确绑定的问题
- 优化聊天代理指令文案,补充平台知识库优先策略说明
- 调整聊天列表滚动条样式,提升界面体验
- 移除未使用的 VITE_BUILD_COMPRESS 类型声明
This commit is contained in:
ccnetcore
2026-01-24 01:16:38 +08:00
parent caa90cc227
commit 6b86957556
3 changed files with 145 additions and 7 deletions

View File

@@ -235,12 +235,16 @@ function handleAgentChunk(data: AgentResultOutput) {
case 'toolCalling':
// 工具调用中
if (!latest.toolCalls) latest.toolCalls = [];
latest.toolCalls.push({
const newToolCall: { name: string; status: 'calling' | 'called'; result?: any; usage?: { prompt: number; completion: number; total: number } } = {
name: data.content as string,
status: 'calling',
});
// 清空待处理的用量
pendingToolUsage = null;
};
// 如果有待处理的用量toolCallUsage 先于 toolCalling 到达),设置到这个工具调用
if (pendingToolUsage) {
newToolCall.usage = pendingToolUsage;
pendingToolUsage = null;
}
latest.toolCalls.push(newToolCall);
break;
case 'toolCallUsage':
// 工具调用用量统计 - 先保存,等 toolCalled 时再设置
@@ -626,6 +630,23 @@ function cancelSSE() {
flex: 1;
overflow-y: auto;
padding: 8px;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: var(--el-border-color-lighter);
border-radius: 2px;
&:hover {
background: var(--el-border-color);
}
}
}
.session-item {