|
|
@ -587,6 +587,10 @@ async function sendChatHandle(event) { |
|
|
"sessionName": chatList.value.length > 0 ? chatList.value[0].content.substring(0, 20) : inputValue.value.trim().substring(0, 20), |
|
|
"sessionName": chatList.value.length > 0 ? chatList.value[0].content.substring(0, 20) : inputValue.value.trim().substring(0, 20), |
|
|
"file": currentFiles.value |
|
|
"file": currentFiles.value |
|
|
} |
|
|
} |
|
|
|
|
|
chatList.value.push(lastQuestion.value) |
|
|
|
|
|
let question = JSON.parse(JSON.stringify(lastQuestion.value)) |
|
|
|
|
|
question.file = JSON.stringify(question.file) |
|
|
|
|
|
await addChat(question) |
|
|
asking.value = true |
|
|
asking.value = true |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
|
// 将滚动条滚动到最下面 |
|
|
// 将滚动条滚动到最下面 |
|
|
@ -620,71 +624,66 @@ function sendChatMessage(data){ |
|
|
// 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 +",请联系管理员!" |
|
|
}else { |
|
|
}else { |
|
|
chatList.value.push(lastQuestion.value) |
|
|
currentError.value = '' |
|
|
let question = JSON.parse(JSON.stringify(lastQuestion.value)) |
|
|
currentChatData.value = {} |
|
|
question.file = JSON.stringify(question.file) |
|
|
currentFiles.value = [] |
|
|
addChat(question).then(()=>{ |
|
|
chatList.value.push({"chatId":uuidv4(),"type":"answer","content":[],"isEnd":false,"isStop":false,"sessionId":chatList.value[0].sessionId,"sessionName":chatList.value[0].sessionName, "operate":'',"thumbDownReason":''}) |
|
|
currentError.value = '' |
|
|
const reader = res.body.getReader() |
|
|
currentChatData.value = {} |
|
|
const write = getWrite(reader) |
|
|
currentFiles.value = [] |
|
|
reader.read().then(write).then(()=> { |
|
|
chatList.value.push({"chatId":uuidv4(),"type":"answer","content":[],"isEnd":false,"isStop":false,"sessionId":chatList.value[0].sessionId,"sessionName":chatList.value[0].sessionName, "operate":'',"thumbDownReason":''}) |
|
|
asking.value = false |
|
|
const reader = res.body.getReader() |
|
|
let answer = JSON.parse(JSON.stringify(chatList.value[chatList.value.length - 1])) |
|
|
const write = getWrite(reader) |
|
|
answer.content = JSON.stringify(answer.content) |
|
|
reader.read().then(write).then(()=> { |
|
|
answer.interrupt = answer.interrupt ? JSON.stringify(answer.interrupt): null |
|
|
asking.value = false |
|
|
answer.checkpointer = JSON.stringify(answer.checkpointer) |
|
|
let answer = JSON.parse(JSON.stringify(chatList.value[chatList.value.length - 1])) |
|
|
addChat(answer) |
|
|
answer.content = JSON.stringify(answer.content) |
|
|
}).then(()=>{ |
|
|
answer.interrupt = answer.interrupt ? JSON.stringify(answer.interrupt): null |
|
|
let answer = JSON.parse(JSON.stringify(chatList.value[chatList.value.length - 1])) |
|
|
answer.checkpointer = JSON.stringify(answer.checkpointer) |
|
|
if(answer.interrupt){ |
|
|
addChat(answer) |
|
|
let robot = answer.interrupt.robot |
|
|
}).then(()=>{ |
|
|
let block = answer.interrupt.block |
|
|
let answer = JSON.parse(JSON.stringify(chatList.value[chatList.value.length - 1])) |
|
|
let action = answer.interrupt.action |
|
|
if(answer.interrupt){ |
|
|
let autoRequest = false |
|
|
let robot = answer.interrupt.robot |
|
|
if (autoProcess.value.autoArray.length > 0 && autoProcess.value.autoArray.indexOf(robot) !== -1){ |
|
|
let block = answer.interrupt.block |
|
|
//自动审批信号有效,需判断 block内容的必填项,有无默认值,有的话,可以自动发送,没有需填写 |
|
|
let action = answer.interrupt.action |
|
|
autoRequest = true |
|
|
let autoRequest = false |
|
|
if (block && block.length>0){ |
|
|
if (autoProcess.value.autoArray.length > 0 && autoProcess.value.autoArray.indexOf(robot) !== -1){ |
|
|
for (let i = 0; i < block.length; i++) { |
|
|
//自动审批信号有效,需判断 block内容的必填项,有无默认值,有的话,可以自动发送,没有需填写 |
|
|
if (block[i].required){ |
|
|
autoRequest = true |
|
|
if (block[i].ct_type === 'dateRangePicker' || block[i].ct_type === 'checkboxGroup' || block[i].ct_type === 'multiselect'){ |
|
|
if (block && block.length>0){ |
|
|
//default_value 是数组 |
|
|
for (let i = 0; i < block.length; i++) { |
|
|
if (!block[i].default_value || block[i].default_value === []){ |
|
|
if (block[i].required){ |
|
|
autoRequest = false |
|
|
if (block[i].ct_type === 'dateRangePicker' || block[i].ct_type === 'checkboxGroup' || block[i].ct_type === 'multiselect'){ |
|
|
|
|
|
//default_value 是数组 |
|
|
|
|
|
if (!block[i].default_value || block[i].default_value === []){ |
|
|
|
|
|
autoRequest = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
if (block[i].ct_type === 'datePicker' || block[i].ct_type === 'input' || block[i].ct_type === 'radioGroup' ||block[i].ct_type === 'select'){ |
|
|
} |
|
|
//default_value 是文字 |
|
|
if (block[i].ct_type === 'datePicker' || block[i].ct_type === 'input' || block[i].ct_type === 'radioGroup' ||block[i].ct_type === 'select'){ |
|
|
if (!block[i].default_value || block[i].default_value.trim() === ''){ |
|
|
//default_value 是文字 |
|
|
autoRequest = false |
|
|
if (!block[i].default_value || block[i].default_value.trim() === ''){ |
|
|
} |
|
|
autoRequest = false |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (autoRequest){ |
|
|
} |
|
|
let reqData = { |
|
|
if (autoRequest){ |
|
|
"user_id": cache.local.get("username"), |
|
|
let reqData = { |
|
|
"session_id": Cookies.get("chatSessionId"), |
|
|
"user_id": cache.local.get("username"), |
|
|
"checkpointer": answer.checkpointer, |
|
|
"session_id": Cookies.get("chatSessionId"), |
|
|
"action":"", |
|
|
"checkpointer": answer.checkpointer, |
|
|
"resume": true, |
|
|
"action":"", |
|
|
"block": block |
|
|
"resume": true, |
|
|
} |
|
|
"block": block |
|
|
for (let i = 0; i < action.length; i++) { |
|
|
} |
|
|
if (action[i].style === 'primary'){ |
|
|
for (let i = 0; i < action.length; i++) { |
|
|
reqData.action = action[i].action |
|
|
if (action[i].style === 'primary'){ |
|
|
} |
|
|
reqData.action = action[i].action |
|
|
} |
|
|
} |
|
|
asking.value = true |
|
|
|
|
|
sendChatMessage(reqData) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
asking.value = true |
|
|
|
|
|
sendChatMessage(reqData) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
}).catch((e) => { |
|
|
}).catch((e) => { |
|
|
|