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;
|
||||
@@ -1566,6 +1563,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 });
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Expires" content="0">
|
||||
<title>AI助手</title>
|
||||
<link rel="stylesheet" href="style.css?v=3.1.1">
|
||||
<link rel="stylesheet" href="style.css?v=3.1.2">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="marked.min.js?v=3.1.1"></script>
|
||||
<script src="app.js?v=3.1.1"></script>
|
||||
<script src="marked.min.js?v=3.1.2"></script>
|
||||
<script src="app.js?v=3.1.2"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user