|
|
@ -142,7 +142,7 @@ |
|
|
<!-- <el-tooltip content="根据诊断搜索医学解释、常见原因及健康指导" placement="top"></el-tooltip>--> |
|
|
<!-- <el-tooltip content="根据诊断搜索医学解释、常见原因及健康指导" placement="top"></el-tooltip>--> |
|
|
<el-button icon="el-icon-cpu" |
|
|
<el-button icon="el-icon-cpu" |
|
|
style="margin-left: 2px;min-width:21px;height:21px;padding:2px;" |
|
|
style="margin-left: 2px;min-width:21px;height:21px;padding:2px;" |
|
|
@click="btnAIdiagnosis(scope.row.diagnosisNames)" |
|
|
|
|
|
|
|
|
@click="btnAIdiagnosisDetail(scope.row.diagnosisNames)" |
|
|
:disabled="sumBtnDisabled"></el-button> |
|
|
:disabled="sumBtnDisabled"></el-button> |
|
|
|
|
|
|
|
|
<el-button :icon="scope.row.collapse ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" |
|
|
<el-button :icon="scope.row.collapse ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" |
|
|
@ -547,6 +547,9 @@ |
|
|
import { mapState } from 'vuex'; |
|
|
import { mapState } from 'vuex'; |
|
|
import Sortable from "sortablejs"; |
|
|
import Sortable from "sortablejs"; |
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
|
|
|
import MarkdownIt from "markdown-it"; |
|
|
|
|
|
const md = new MarkdownIt(); |
|
|
|
|
|
|
|
|
import { getapi, postapi, putapi, deletapi, fetchStream } from "@/api/api"; |
|
|
import { getapi, postapi, putapi, deletapi, fetchStream } from "@/api/api"; |
|
|
import { arrayExistObj, arrayReduce, tcdate, getPagePriv, checkPagePriv, deepCopy, objCopy } from "../../utlis/proFunc"; |
|
|
import { arrayExistObj, arrayReduce, tcdate, getPagePriv, checkPagePriv, deepCopy, objCopy } from "../../utlis/proFunc"; |
|
|
|
|
|
|
|
|
@ -673,7 +676,7 @@ export default { |
|
|
max: true, |
|
|
max: true, |
|
|
visible: false, |
|
|
visible: false, |
|
|
diagnosis: 'AI诊断信息', |
|
|
diagnosis: 'AI诊断信息', |
|
|
isAssistant: false, // 是否AI助手 |
|
|
|
|
|
|
|
|
isAssistant: true, // 是否AI助手 |
|
|
question: "", // 所提问题 |
|
|
question: "", // 所提问题 |
|
|
rawText: '', |
|
|
rawText: '', |
|
|
html: "" |
|
|
html: "" |
|
|
@ -1320,13 +1323,6 @@ export default { |
|
|
// AI诊断 AI重新诊断(使用 fetchStream 实现流式实时渲染) |
|
|
// AI诊断 AI重新诊断(使用 fetchStream 实现流式实时渲染) |
|
|
btnAIdiagnosis() { |
|
|
btnAIdiagnosis() { |
|
|
this.AI.isAssistant = true |
|
|
this.AI.isAssistant = true |
|
|
this.AI.question = '' |
|
|
|
|
|
this.AI.visible = true |
|
|
|
|
|
this.btnAImax(false); |
|
|
|
|
|
this.toAIdiagnosis() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async toAIdiagnosis() { |
|
|
|
|
|
let message = this.AI.question; |
|
|
let message = this.AI.question; |
|
|
if (!message) { |
|
|
if (!message) { |
|
|
let linkStr = ';'; |
|
|
let linkStr = ';'; |
|
|
@ -1341,55 +1337,15 @@ export default { |
|
|
message += (i + 1) + ')、' + e1.summaryContent; |
|
|
message += (i + 1) + ')、' + e1.summaryContent; |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
message = '性别:' + this.doctorCheck.prBase.sexName + ',年龄:' + this.doctorCheck.prBase.age + '岁,检查结果:' + message; |
|
|
|
|
|
|
|
|
message = '性别:' + this.patient_register.sexName + ',年龄:' + this.patient_register.age + '岁,检查结果:' + message; |
|
|
this.AI.question = message |
|
|
this.AI.question = message |
|
|
} |
|
|
} |
|
|
this.AI.rawText = ''; |
|
|
|
|
|
this.AI.html = ''; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
await fetchStream('/api/app/AiMessageWs/GetAIMessageResult', { message }, (chunk) => { |
|
|
|
|
|
// 清洗 SSE 风格前缀并移除结束标志 |
|
|
|
|
|
let cleaned = String(chunk).replace(/data:\s*\[DONE\]/g, '').replace(/^data:\s*/gm, ''); |
|
|
|
|
|
if (!cleaned) return; |
|
|
|
|
|
// 首个数据到达时显示弹窗并展开 |
|
|
|
|
|
if (!this.AI.visible) { |
|
|
|
|
|
this.AI.visible = true; |
|
|
|
|
|
this.btnAImax(false); |
|
|
|
|
|
} |
|
|
|
|
|
this.AI.rawText += cleaned; |
|
|
|
|
|
// 实时渲染 Markdown |
|
|
|
|
|
this.AI.html = md.render(this.AI.rawText); |
|
|
|
|
|
// 滚动到底部 |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
try { |
|
|
|
|
|
const el = this.$refs.aiContent; |
|
|
|
|
|
if (el) el.scrollTop = el.scrollHeight; |
|
|
|
|
|
} catch (e) { } |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
// 回退:非流式请求(axios/postapi) |
|
|
|
|
|
try { |
|
|
|
|
|
const res = await postapi('/api/app/AiMessageWs/GetAIMessageResult', { message }); |
|
|
|
|
|
if (res) { |
|
|
|
|
|
let cleaned = String(res).replace(/data:\s*\[DONE\]/g, '').replace(/^data:\s*/gm, ''); |
|
|
|
|
|
if (cleaned) { |
|
|
|
|
|
// 回退响应到达后显示弹窗并展开 |
|
|
|
|
|
if (!this.AI.visible) { |
|
|
|
|
|
this.AI.visible = true; |
|
|
|
|
|
|
|
|
this.AI.visible = true |
|
|
this.btnAImax(false); |
|
|
this.btnAImax(false); |
|
|
} |
|
|
|
|
|
this.AI.rawText += cleaned; |
|
|
|
|
|
this.AI.html = md.render(this.AI.rawText); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
this.$message.error({ showClose: true, message: (err && err.message) || 'AI诊断请求失败' }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.toAIdiagnosis() |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// AI 是否最大化 |
|
|
// AI 是否最大化 |
|
|
btnAImax(max) { |
|
|
btnAImax(max) { |
|
|
this.AI.max = !max |
|
|
this.AI.max = !max |
|
|
@ -1703,7 +1659,7 @@ export default { |
|
|
|
|
|
|
|
|
// 根据诊断,搜索医学解释、常见原因、健康指导 |
|
|
// 根据诊断,搜索医学解释、常见原因、健康指导 |
|
|
// AI诊断 AI重新诊断 |
|
|
// AI诊断 AI重新诊断 |
|
|
btnAIdiagnosis(diagnosis) { |
|
|
|
|
|
|
|
|
btnAIdiagnosisDetail(diagnosis) { |
|
|
this.AI.visible = true |
|
|
this.AI.visible = true |
|
|
this.AI.question = '' |
|
|
this.AI.question = '' |
|
|
this.btnAImax(false) |
|
|
this.btnAImax(false) |
|
|
@ -1718,7 +1674,7 @@ export default { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
message = '性别:' + this.doctorCheck.prBase.sexName + ',年龄:' + this.doctorCheck.prBase.age + '岁,检查结果:' + diagnosis |
|
|
|
|
|
|
|
|
message = '性别:' + this.patient_register.sexName + ',年龄:' + this.patient_register.age + '岁,检查结果:' + diagnosis |
|
|
+ ' 请给出医学解释、常见原因及健康指导' |
|
|
+ ' 请给出医学解释、常见原因及健康指导' |
|
|
this.AI.question = message |
|
|
this.AI.question = message |
|
|
} |
|
|
} |
|
|
|