|
@@ -93,8 +93,12 @@
|
|
|
<div v-else class="system-message">
|
|
|
<div class="answerIcon"></div>
|
|
|
<div class="answer-message">
|
|
|
- <div v-if="message.Origintype == 'thinking'" class="thinking-text" v-html="formatMessage(message.content)"></div>
|
|
|
- <div v-else-if="message.Origintype == 'text'" class="answer-text" v-html="formatMessage(message.content)"></div>
|
|
|
+ <div v-if="message.Origintype === 'thinking'">
|
|
|
+ <span :id="'thinking-' + message.id" class="thinking-text" v-html="formatMessage(message.content)"></span>
|
|
|
+ </div>
|
|
|
+ <div v-if="message.Origintype1 === 'text'">
|
|
|
+ <span :id="'text-' + message.id" class="answer-text" v-html="formatMessage(message.content1)"></span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -154,10 +158,12 @@ interface ListItem {
|
|
|
let userId = unref(userStore.getUserInfo).id;
|
|
|
// const userId = ref(0);
|
|
|
type MessageItem = {
|
|
|
- id: string; // 唯一标识(可用时间戳生成)
|
|
|
+ id: string; // 唯一标识时间戳
|
|
|
type: 'user' | 'system';
|
|
|
content: string;
|
|
|
- Origintype: string;
|
|
|
+ content1?: string;
|
|
|
+ Origintype?: string;
|
|
|
+ Origintype1?: string;
|
|
|
timestamp: number; // 排序依据
|
|
|
};
|
|
|
const messageList = ref<MessageItem[]>([]);
|
|
@@ -307,7 +313,6 @@ const sendMessage1 = async () => {
|
|
|
id: `user_${Date.now()}`,
|
|
|
type: 'user',
|
|
|
content: inputText.value,
|
|
|
- Origintype: '',
|
|
|
timestamp: Date.now(),
|
|
|
});
|
|
|
// 构造请求参数
|
|
@@ -341,6 +346,7 @@ const sendMessage1 = async () => {
|
|
|
id: `response_${Date.now()}`,
|
|
|
type: 'response', // 消息类型
|
|
|
content: '',
|
|
|
+ content1: '',
|
|
|
Origintype: '',
|
|
|
timestamp: Date.now(), // 时间戳用来排序
|
|
|
};
|
|
@@ -379,10 +385,10 @@ const sendMessage1 = async () => {
|
|
|
}
|
|
|
if (data.type === 'text') {
|
|
|
// 找到当前消息对象并更新 content
|
|
|
- const targetMessage1 = messageList.value.find((msg) => msg.id === newMessage.id);
|
|
|
- if (targetMessage1) {
|
|
|
- targetMessage1.content += data.content; // 追加内容
|
|
|
- targetMessage1.Origintype = data.type;
|
|
|
+ const targetMessage = messageList.value.find((msg) => msg.id === newMessage.id);
|
|
|
+ if (targetMessage) {
|
|
|
+ targetMessage.content1 += data.content; // 追加内容
|
|
|
+ targetMessage.Origintype1 = data.type;
|
|
|
scrollToBottom();
|
|
|
}
|
|
|
}
|
|
@@ -465,6 +471,7 @@ async function sessionsHistory(id: string) {
|
|
|
id: `system_${Date.now()}`,
|
|
|
type: 'system',
|
|
|
content: item.content,
|
|
|
+ content1: item.thinking_content,
|
|
|
timestamp: Date.now(),
|
|
|
});
|
|
|
}
|