|
@@ -260,6 +260,8 @@ const simulateStreamResponse = async (question) => {
|
|
|
|
|
|
// /admin/user/chat/converse
|
|
|
// /admin/ragflow/chat/converse
|
|
|
+ // ${import.meta.env.VITE_API_BASE_URL}
|
|
|
+ // http://172.16.90.49:8080
|
|
|
|
|
|
//请求ai聊天接口
|
|
|
const eventSource = new EventSource(`${import.meta.env.VITE_API_BASE_URL}/admin/user/chat/converse?chat_id=${chatId.value}&question=${encodeURIComponent(question)}&stream=true&session_id=${sessionId.value}&user_id=${userStore.userInfo.id}&token=${token}`);
|
|
@@ -278,13 +280,13 @@ const simulateStreamResponse = async (question) => {
|
|
|
for (const match of matches) {
|
|
|
const beforeThinkEnd = processedText.substring(0, match.index + match[1].length);
|
|
|
const afterThinkEnd = processedText.substring(match.index + match[1].length);
|
|
|
- console.log('beforeThinkEnd',beforeThinkEnd);
|
|
|
- console.log('afterThinkEnd',afterThinkEnd);
|
|
|
+ // console.log('beforeThinkEnd',beforeThinkEnd);
|
|
|
+ // console.log('afterThinkEnd',afterThinkEnd);
|
|
|
// 在对应的</think>标签前添加<think>标签
|
|
|
processedText = '<think>' + beforeThinkEnd + afterThinkEnd;
|
|
|
}
|
|
|
|
|
|
- console.log('processedText',processedText);
|
|
|
+ // console.log('processedText',processedText);
|
|
|
|
|
|
// 如果内容包含think标签,分别处理think标签内外的内容
|
|
|
if (processedText.includes('<think>') && processedText.includes('</think>')) {
|
|
@@ -330,7 +332,7 @@ const simulateStreamResponse = async (question) => {
|
|
|
}
|
|
|
|
|
|
if (data.data && data.data.answer) {
|
|
|
- console.log('data.data.answer',data.data.answer);
|
|
|
+ // console.log('data.data.answer',data.data.answer);
|
|
|
// 累积接收到的文本
|
|
|
accumulatedText += data.data.answer;
|
|
|
// 临时显示文本
|