1优化
This commit is contained in:
@@ -62,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- AI操作区域 -->
|
<!-- AI操作区域 -->
|
||||||
<div v-if="message.content && message.content !== '正在思考...'" class="ai-actions">
|
<div v-if="message.content && message.content !== '正在思考...' && message.streamCompleted" class="ai-actions">
|
||||||
<div class="ai-text">AI回答也可能会犯错。请核查重要信息。</div>
|
<div class="ai-text">AI回答也可能会犯错。请核查重要信息。</div>
|
||||||
<div class="action-icons">
|
<div class="action-icons">
|
||||||
<div class="action-icon" :class="{ active: (message.feedback && message.feedback.rating === 'like') || message.feedback === 'like' }"
|
<div class="action-icon" :class="{ active: (message.feedback && message.feedback.rating === 'like') || message.feedback === 'like' }"
|
||||||
@@ -253,7 +253,8 @@ export default {
|
|||||||
conversationId: msg.conversation_id,
|
conversationId: msg.conversation_id,
|
||||||
created_at: msg.created_at,
|
created_at: msg.created_at,
|
||||||
feedback: msg.feedback || null,
|
feedback: msg.feedback || null,
|
||||||
retrieverResources: msg.retriever_resources || []
|
retrieverResources: msg.retriever_resources || [],
|
||||||
|
streamCompleted: true // 历史消息的流输出已完成
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -449,7 +450,8 @@ export default {
|
|||||||
content: '正在思考...',
|
content: '正在思考...',
|
||||||
messageId: 'ai-' + Date.now(),
|
messageId: 'ai-' + Date.now(),
|
||||||
feedback: null,
|
feedback: null,
|
||||||
retrieverResources: []
|
retrieverResources: [],
|
||||||
|
streamCompleted: false // 流输出完成标志
|
||||||
}
|
}
|
||||||
this.messages.push(aiMsg)
|
this.messages.push(aiMsg)
|
||||||
|
|
||||||
@@ -508,6 +510,8 @@ export default {
|
|||||||
if (data.retriever_resources) {
|
if (data.retriever_resources) {
|
||||||
aiMsg.retrieverResources = data.retriever_resources
|
aiMsg.retrieverResources = data.retriever_resources
|
||||||
}
|
}
|
||||||
|
// 标记流输出完成
|
||||||
|
aiMsg.streamCompleted = true
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('JSON解析失败:', line, e)
|
console.warn('JSON解析失败:', line, e)
|
||||||
@@ -517,6 +521,7 @@ export default {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('发送消息失败:', error)
|
console.error('发送消息失败:', error)
|
||||||
aiMsg.content = '抱歉,发送消息时出现错误,请稍后重试。'
|
aiMsg.content = '抱歉,发送消息时出现错误,请稍后重试。'
|
||||||
|
aiMsg.streamCompleted = true // 即使出错也标记为完成,显示操作区域
|
||||||
this.showToast('发送消息失败')
|
this.showToast('发送消息失败')
|
||||||
} finally {
|
} finally {
|
||||||
this.sending = false
|
this.sending = false
|
||||||
|
Reference in New Issue
Block a user