fix: 智能体使用记录改为发送第一条消息时才记录
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user