update at 2025-10-15 15:07:45
This commit is contained in:
@@ -58,6 +58,9 @@
|
||||
<n-tag v-if="msg.status === 'sending'" type="info" size="small">
|
||||
发送中...
|
||||
</n-tag>
|
||||
<n-tag v-else-if="msg.status === 'paused'" type="warning" size="small">
|
||||
已停止
|
||||
</n-tag>
|
||||
<n-tag v-else-if="msg.status === 'error'" type="error" size="small">
|
||||
发送失败
|
||||
</n-tag>
|
||||
@@ -75,7 +78,7 @@
|
||||
{{ msg.error }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="msg.role === 'assistant' && msg.status === 'success'" class="message-actions">
|
||||
<div v-if="msg.role === 'assistant' && (msg.status === 'success' || msg.status === 'paused')" class="message-actions">
|
||||
<n-button text size="tiny" @click="handleCopyMessage(msg.content)">
|
||||
<n-icon :component="CopyIcon" size="14" />
|
||||
复制
|
||||
@@ -147,15 +150,14 @@
|
||||
</n-button>
|
||||
</n-button-group>
|
||||
|
||||
<!-- 确认按钮 -->
|
||||
<!-- 发送/停止按钮 -->
|
||||
<n-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:disabled="!inputText.trim() || store.state.isSending"
|
||||
:loading="store.state.isSending"
|
||||
@click="handleSendMessage"
|
||||
:type="store.state.isSending ? 'error' : 'primary'"
|
||||
:disabled="!store.state.isSending && !inputText.trim()"
|
||||
@click="handleButtonClick"
|
||||
>
|
||||
确认
|
||||
{{ store.state.isSending ? '停止' : '发送' }}
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -585,6 +587,22 @@ const handleSelectMCP = (key: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 统一的按钮点击处理(参考 cherry-studio 的 PAUSED 状态逻辑)
|
||||
const handleButtonClick = () => {
|
||||
if (store.state.isSending) {
|
||||
handleStopGeneration()
|
||||
} else {
|
||||
handleSendMessage()
|
||||
}
|
||||
}
|
||||
|
||||
// 停止生成
|
||||
const handleStopGeneration = () => {
|
||||
console.log('🛑 [handleStopGeneration] 用户请求停止生成')
|
||||
store.stopGeneration()
|
||||
message.info('已停止生成')
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
const handleSendMessage = async () => {
|
||||
if (!inputText.value.trim() || store.state.isSending) return
|
||||
|
||||
Reference in New Issue
Block a user