|
|
@ -596,6 +596,7 @@ async function sendChatHandle(event) { |
|
|
function sendChatMessage(data){ |
|
|
function sendChatMessage(data){ |
|
|
controller.value = new AbortController() |
|
|
controller.value = new AbortController() |
|
|
postChatMessage(data,{signal:controller.value.signal}).then(res=>{ |
|
|
postChatMessage(data,{signal:controller.value.signal}).then(res=>{ |
|
|
|
|
|
console.log(res) |
|
|
if (res.status !== 200){ |
|
|
if (res.status !== 200){ |
|
|
// chatList.value.push({"chatId":uuidv4(),"type":"answer","content":[{"type":"text","content":"服务异常,错误码:"+res.status}],"isEnd":true,"isStop":false,"sessionId":chatList.value[0].sessionId,"sessionName":chatList.value[0].sessionName,"operate":'',"thumbDownReason":''}) |
|
|
// chatList.value.push({"chatId":uuidv4(),"type":"answer","content":[{"type":"text","content":"服务异常,错误码:"+res.status}],"isEnd":true,"isStop":false,"sessionId":chatList.value[0].sessionId,"sessionName":chatList.value[0].sessionName,"operate":'',"thumbDownReason":''}) |
|
|
currentError.value = "服务异常,错误码:"+res.status +",请联系管理员!" |
|
|
currentError.value = "服务异常,错误码:"+res.status +",请联系管理员!" |
|
|
@ -713,6 +714,12 @@ const getWrite = (reader) => { |
|
|
const processChunk = (chunk) => { |
|
|
const processChunk = (chunk) => { |
|
|
currentJobId.value = chunk.job_id; |
|
|
currentJobId.value = chunk.job_id; |
|
|
const lastMsg = chatList.value[chatList.value.length - 1]; |
|
|
const lastMsg = chatList.value[chatList.value.length - 1]; |
|
|
|
|
|
if (chunk.type && chunk.type=== 'error'){ |
|
|
|
|
|
lastMsg.content.push({content: "服务异常,请联系管理员!", type: "text"}) |
|
|
|
|
|
currentJobId.value = '' |
|
|
|
|
|
lastMsg.isEnd = true; |
|
|
|
|
|
lastMsg.time = formatDate(new Date()); |
|
|
|
|
|
}else { |
|
|
// 修复点5:统一处理所有类型的数据块 |
|
|
// 修复点5:统一处理所有类型的数据块 |
|
|
if (chunk.docs?.length) { |
|
|
if (chunk.docs?.length) { |
|
|
lastMsg.content.push({ content: chunk.docs, type: "docs" }); |
|
|
lastMsg.content.push({ content: chunk.docs, type: "docs" }); |
|
|
@ -752,6 +759,7 @@ const getWrite = (reader) => { |
|
|
lastMsg.isEnd = true; |
|
|
lastMsg.isEnd = true; |
|
|
lastMsg.time = formatDate(new Date()); |
|
|
lastMsg.time = formatDate(new Date()); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
nextTick(() => scrollDiv.value.setScrollTop(getMaxHeight())); |
|
|
nextTick(() => scrollDiv.value.setScrollTop(getMaxHeight())); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|