diff --git a/www/app.js b/www/app.js index 5ad83c9..ac6e73f 100644 --- a/www/app.js +++ b/www/app.js @@ -634,9 +634,6 @@ function openAgent(agentId) { currentAgent = agents.find(a => a.id === agentId); if (!currentAgent) return; - // 记录智能体使用历史 - recordAgentUsage(agentId); - // 创建新对话并设置智能体 createNewConversation(); currentConversation.agentId = agentId; @@ -1565,6 +1562,11 @@ async function sendMessage() { // 隐藏欢迎界面 welcome.style.display = 'none'; + + // 如果是智能体对话的第一条消息,记录智能体使用 + if (currentConversation.agentId && currentConversation.messages.length === 0) { + recordAgentUsage(currentConversation.agentId); + } // 添加用户消息 currentConversation.messages.push({ role: 'user', content: text }); diff --git a/www/index.html b/www/index.html index abbb52b..0a61d23 100644 --- a/www/index.html +++ b/www/index.html @@ -8,12 +8,12 @@ AI助手 - +
- - + + \ No newline at end of file