优化聊天记录
This commit is contained in:
parent
eea635e7bd
commit
98e9cf72e7
@ -149,9 +149,7 @@
|
|||||||
if (!text || text.trim() === '') return;
|
if (!text || text.trim() === '') return;
|
||||||
|
|
||||||
// 判断是否是思考内容
|
// 判断是否是思考内容
|
||||||
const isThinking = text.includes('<think>') ||
|
const isThinking = text.includes('<think>') ||(this.messages[this.messages.length - 1]?.type === 'thinking');
|
||||||
(this.messages[this.messages.length - 1]?.type === 'thinking');
|
|
||||||
|
|
||||||
if (isThinking) {
|
if (isThinking) {
|
||||||
this.handleThinkingContent(text);
|
this.handleThinkingContent(text);
|
||||||
} else {
|
} else {
|
||||||
@ -209,7 +207,7 @@
|
|||||||
if (this.messages.length > 0) {
|
if (this.messages.length > 0) {
|
||||||
const lastMsg = this.messages[this.messages.length - 1];
|
const lastMsg = this.messages[this.messages.length - 1];
|
||||||
lastMsg.isComplete = true;
|
lastMsg.isComplete = true;
|
||||||
|
lastMsg.isTyping=false
|
||||||
// 如果最后一条是思考消息,我们不需要额外处理
|
// 如果最后一条是思考消息,我们不需要额外处理
|
||||||
if (lastMsg.type === 'thinking') {
|
if (lastMsg.type === 'thinking') {
|
||||||
return;
|
return;
|
||||||
@ -267,7 +265,7 @@
|
|||||||
success: () => {
|
success: () => {
|
||||||
console.log('消息发送成功');
|
console.log('消息发送成功');
|
||||||
// 添加机器人正在输入的提示
|
// 添加机器人正在输入的提示
|
||||||
this.addMessage('bot', '思考中...', true);
|
this.addMessage('bot', '思考中...','thinking',true);
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('消息发送失败', err);
|
console.error('消息发送失败', err);
|
||||||
@ -374,6 +372,7 @@
|
|||||||
.message-text {
|
.message-text {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input {
|
.chat-input {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user