refactor(AI): 优化消息组件的思考和加载逻辑

- 调整了消息组件中的思考文本和加载动画的显示逻辑
- 移除了不必要的条件判断,简化了模板结构
- 在 AI 页面中添加了一些调试日志
- 调整了底部按钮容器的位置
This commit is contained in:
陈昱达
2025-06-10 13:46:58 +08:00
parent 84ea21ea1d
commit 848cf7679b
2 changed files with 7 additions and 4 deletions

View File

@@ -17,9 +17,9 @@
<!--开启思考-->
<p v-html="md.render(message.think)" v-if="message.think && message.showThink" class="thinkText" />
</span>
<div v-if='!message.isThink '>
<div>
<p v-html="md.render(message.text)" v-if="message.text "></p>
<span class="speakLoadingToast pv10" v-else-if='!message.text && !thinkOk'>
<span class="speakLoadingToast pv10" v-else-if='!message.text && !thinkOk && !message.isThink'>
<van-loading type="spinner" color="#2e5ca9" size="20px" v-if="!message.text" />
</span>
</div>

View File

@@ -224,7 +224,6 @@ export default {
const blob = new Blob(this.audioChunks, { type: 'audio/webm' })
try {
const text = await this.callVoiceRecognitionAPI(blob)
console.log(text)
if (text) {
this.newMessage = text
this.messageStatus = 'stop'
@@ -318,6 +317,7 @@ export default {
const cleanLine = line.replace(/^data:\s*/, '')
if (!cleanLine) return null
const data = JSON.parse(cleanLine)
// console.log(data)
if (data.answer) {
this.answerMap += data.answer
}
@@ -342,6 +342,9 @@ export default {
if (event === 'message_end') {
this.messageStatus = 'stop'
}
// console.log(answer)
// console.log(this.currentMessage)
if (!this.currentMessage || !answer) return
const mode = this.isThink ? 'think' : 'text'
this.currentMessage[mode] += answer
@@ -382,7 +385,7 @@ $primary-trans-color: rgba(135, 162, 208, 0.5);
.button-container {
position: fixed;
bottom: 120px;
bottom: 150px;
right: 10px;
border-radius: 50%;
}