vue2-client 1.22.2 → 1.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +30 -30
- package/.env.his +19 -19
- package/.eslintrc.js +74 -74
- package/.history/.eslintrc_20260521171150.js +74 -0
- package/.history/.eslintrc_20260521171213.js +74 -0
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154443.vue +726 -0
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154700.vue +478 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175435.vue +706 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260512175450.vue +694 -0
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260611152602.vue +755 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513145941.vue +524 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513153133.vue +731 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260513160316.vue +525 -0
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260601144150.vue +1046 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310142713.vue +512 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310145118.vue +511 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260311094834.vue +696 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260320143028.vue +693 -0
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260409101450.vue +677 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164645.vue +758 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508164714.vue +693 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260508171651.vue +716 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509133717.vue +695 -0
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260509171115.vue +664 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140637.vue +1455 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513140935.vue +1441 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513150818.vue +1441 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153119.vue +1442 -0
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260513153126.vue +1486 -0
- package/.history/src/base-client/components/common/XForm/XFormItem_20260513140854.vue +1607 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140403.vue +643 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140829.vue +628 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519142824.vue +104 -0
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519143155.vue +102 -0
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171231.vue +1241 -0
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171441.vue +1223 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260612174826.vue +472 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260612175839.vue +538 -0
- package/.history/src/base-client/components/his/HAi/HAi_20260615103331.vue +650 -0
- package/.history/src/base-client/components/his/XHDescriptions/XHDescriptions_20260424134504.vue +1469 -0
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171133.vue +788 -0
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171151.vue +780 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511170841.vue +585 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511171138.vue +787 -0
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260512141830.vue +739 -0
- package/.history/src/components/STable/index_20260409155138.js +806 -0
- package/.history/src/components/STable/index_20260409155218.js +814 -0
- package/.history/src/expression/core/Expression_20260305164427.js +1371 -0
- package/.history/src/expression/core/Expression_20260305170258.js +1358 -0
- package/.history/src/expression/core/Program_20260305111830.js +944 -0
- package/.history/src/expression/core/Program_20260305112041.js +931 -0
- package/.history/src/logic/LogicRunner_20260304154306.js +170 -0
- package/.history/src/logic/LogicRunner_20260304155553.js +112 -0
- package/.history/src/logic/LogicRunner_20260305105834.js +112 -0
- package/.history/src/logic/LogicRunner_20260305112718.js +129 -0
- package/.history/src/logic/LogicRunner_20260305182436.js +133 -0
- package/.history/src/logic/LogicRunner_20260306151301.js +213 -0
- package/.history/src/logic/LogicRunner_20260306152419.js +213 -0
- package/.history/src/logic/plugins/common/DateTools_20260305154159.js +61 -0
- package/.history/src/logic/plugins/common/DateTools_20260305154217.js +44 -0
- package/.history/src/logic/plugins/common/DateTools_20260305161014.js +44 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305164352.js +80 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305170258.js +75 -0
- package/.history/src/logic/plugins/common/HttpTools_20260305171634.js +75 -0
- package/.history/src/logic/plugins/common/HttpTools_20260306152419.js +72 -0
- package/.history/src/services/api/restTools_20260427142149.js +245 -0
- package/.history/src/services/api/restTools_20260427142853.js +230 -0
- package/.history/src/services/api/restTools_20260519135558.js +230 -0
- package/.history/src/services/api/restTools_20260519140825.js +230 -0
- package/.history/src/services/api/restTools_20260519151223.js +230 -0
- package/.history/src/utils/indexedDB_20260306150918.js +593 -0
- package/.history/src/utils/indexedDB_20260306151301.js +586 -0
- package/.idea/af-vue2-client.iml +9 -0
- package/.idea/codeStyles/Project.xml +62 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +1 -1
- package/Components.md +60 -60
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.setup.js +7 -7
- package/package.json +1 -1
- package/preview-input-box.html +180 -0
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/HIS/HButtons/HButtons.vue +55 -1
- package/src/base-client/components/common/HIS/HForm/HForm.vue +1186 -1186
- package/src/base-client/components/common/HIS/HTab/HTab.vue +88 -1
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XAddReport/XAddReport.vue +16 -1
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +382 -382
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XInput/XInput.vue +32 -1
- package/src/base-client/components/common/XInspectionDetailDrawer/index.vue +1 -1
- package/src/base-client/components/common/XMarkdownViewer/demo.vue +102 -102
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/his/HAi/HAi.vue +1177 -436
- package/src/base-client/components/his/XList/XList.vue +337 -58
- package/src/base-client/components/his/XSidebar/XSidebar.vue +36 -12
- package/src/base-client/components/his/XTransfer/index.md +327 -327
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/components/Charts/Bar.vue +62 -62
- package/src/components/Charts/ChartCard.vue +134 -134
- package/src/components/Charts/Liquid.vue +67 -67
- package/src/components/Charts/MiniArea.vue +39 -39
- package/src/components/Charts/MiniBar.vue +39 -39
- package/src/components/Charts/MiniProgress.vue +75 -75
- package/src/components/Charts/MiniSmoothArea.vue +40 -40
- package/src/components/Charts/Radar.vue +68 -68
- package/src/components/Charts/RankList.vue +77 -77
- package/src/components/Charts/TagCloud.vue +113 -113
- package/src/components/Charts/TransferBar.vue +64 -64
- package/src/components/Charts/Trend.vue +82 -82
- package/src/components/Charts/chart.less +12 -12
- package/src/components/Charts/smooth.area.less +13 -13
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/NumberInfo/index.js +3 -3
- package/src/components/NumberInfo/index.less +54 -54
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/index.js +953 -953
- package/src/components/card/ChartCard.vue +79 -79
- package/src/components/chart/Bar.vue +60 -60
- package/src/components/chart/MiniArea.vue +67 -67
- package/src/components/chart/MiniBar.vue +59 -59
- package/src/components/chart/MiniProgress.vue +57 -57
- package/src/components/chart/Radar.vue +80 -80
- package/src/components/chart/RankingList.vue +60 -60
- package/src/components/chart/Trend.vue +79 -79
- package/src/components/chart/index.less +9 -9
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/input/IInput.vue +66 -66
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/lib.js +1 -1
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/services/api/cas.js +79 -79
- package/src/store/modules/setting.js +119 -119
- package/src/utils/errorCode.js +6 -6
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
- package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -7
- package/.idea/google-java-format.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -24
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/vue2-client.iml +0 -12
- package/.vscode/settings.json +0 -28
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ai-consultation-outer">
|
|
3
|
+
<div class="ai-consultation-container">
|
|
4
|
+
<div class="chat-area">
|
|
5
|
+
<!-- 对话区域 -->
|
|
6
|
+
<div class="dialog-area">
|
|
7
|
+
<div
|
|
8
|
+
v-for="(message, index) in dialogMessages"
|
|
9
|
+
:key="index"
|
|
10
|
+
:class="['dialog-message', message.type]"
|
|
11
|
+
>
|
|
12
|
+
<div class="message-text" v-html="renderMd(message.content)" />
|
|
13
|
+
<span v-if="message.type === 'ai' && isAiStreaming && index === dialogMessages.length - 1" class="typing-cursor">▍</span>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="bottom-input-wrapper">
|
|
19
|
+
<div class="input-container">
|
|
20
|
+
<div class="input-textarea-area">
|
|
21
|
+
<a-textarea
|
|
22
|
+
ref="consultTextarea"
|
|
23
|
+
v-model="doctorInputText"
|
|
24
|
+
placeholder="医生补充信息或提问..."
|
|
25
|
+
class="bottom-input"
|
|
26
|
+
:rows="1"
|
|
27
|
+
resize="none"
|
|
28
|
+
@input="handleInput"
|
|
29
|
+
@keydown="handleKeydown"
|
|
30
|
+
></a-textarea>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<input
|
|
34
|
+
ref="uploadInput"
|
|
35
|
+
type="file"
|
|
36
|
+
style="display: none"
|
|
37
|
+
@change="handleFileChange"
|
|
38
|
+
multiple
|
|
39
|
+
accept="image/*,.pdf,.doc,.docx"
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<div class="input-controls">
|
|
43
|
+
<div class="input-controls-left">
|
|
44
|
+
<a-button class="upload-btn" @click="triggerUpload">
|
|
45
|
+
<a-icon type="plus" class="upload-icon" />
|
|
46
|
+
<span class="upload-text">上传(报告、图片)</span>
|
|
47
|
+
</a-button>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="input-controls-right">
|
|
51
|
+
<span class="enter-tip">Enter</span>
|
|
52
|
+
<a-button
|
|
53
|
+
type="primary"
|
|
54
|
+
shape="circle"
|
|
55
|
+
class="send-btn"
|
|
56
|
+
@click="handleSendMessage"
|
|
57
|
+
:disabled="!doctorInputText.trim()"
|
|
58
|
+
>
|
|
59
|
+
<span class="send-icon">↑</span>
|
|
60
|
+
</a-button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
import { startEventStreamPOST } from '@vue2-client/services/api/restTools'
|
|
71
|
+
import { marked } from 'marked'
|
|
72
|
+
import moment from 'moment/moment'
|
|
73
|
+
import { mapState } from 'vuex'
|
|
74
|
+
|
|
75
|
+
export default {
|
|
76
|
+
name: 'AIConsultation',
|
|
77
|
+
data() {
|
|
78
|
+
return {
|
|
79
|
+
currentDialogId: null,
|
|
80
|
+
doctorInputText: '',
|
|
81
|
+
isPlaying: false,
|
|
82
|
+
isRecording: false,
|
|
83
|
+
patientComplaint: '',
|
|
84
|
+
doctorQuestions: [],
|
|
85
|
+
examinationOrder: null,
|
|
86
|
+
aiDiagnosis: null,
|
|
87
|
+
dialogMessages: [],
|
|
88
|
+
currentStreamConnection: null,
|
|
89
|
+
isAiStreaming: false,
|
|
90
|
+
resizeTimeout: null
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
...mapState('account', {currUser: 'user'})
|
|
95
|
+
},
|
|
96
|
+
mounted() {
|
|
97
|
+
this.$nextTick(() => {
|
|
98
|
+
this.autoResizeTextarea()
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
beforeDestroy() {
|
|
102
|
+
// 组件销毁时关闭流式连接
|
|
103
|
+
if (this.currentStreamConnection) {
|
|
104
|
+
this.currentStreamConnection()
|
|
105
|
+
this.currentStreamConnection = null
|
|
106
|
+
}
|
|
107
|
+
if (this.resizeTimeout) {
|
|
108
|
+
clearTimeout(this.resizeTimeout)
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
autoResizeTextarea() {
|
|
113
|
+
this.$nextTick(() => {
|
|
114
|
+
const textarea = this.$refs.consultTextarea?.$el || this.$refs.consultTextarea
|
|
115
|
+
if (!textarea) return
|
|
116
|
+
|
|
117
|
+
textarea.style.height = 'auto'
|
|
118
|
+
const scrollHeight = textarea.scrollHeight
|
|
119
|
+
textarea.style.height = `${Math.min(Math.max(scrollHeight, 120), 250)}px`
|
|
120
|
+
})
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
handleInput() {
|
|
124
|
+
if (this.resizeTimeout) clearTimeout(this.resizeTimeout)
|
|
125
|
+
this.resizeTimeout = setTimeout(() => {
|
|
126
|
+
this.autoResizeTextarea()
|
|
127
|
+
}, 16)
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
renderMd(text) {
|
|
131
|
+
if (!text) return ''
|
|
132
|
+
try {
|
|
133
|
+
return marked.parse(text, { breaks: true, gfm: true, headerIds: false, mangle: false })
|
|
134
|
+
} catch {
|
|
135
|
+
return text
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
handleKeydown(event) {
|
|
140
|
+
if (event.key === 'Enter' && !event.shiftKey) {
|
|
141
|
+
event.preventDefault()
|
|
142
|
+
this.handleSendMessage()
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
initDialog() {
|
|
147
|
+
if (!this.currentDialogId) {
|
|
148
|
+
this.currentDialogId = moment().format('YYYYMMDDHHmmss')
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
clearDialog() {
|
|
153
|
+
this.currentDialogId = moment().format('YYYYMMDDHHmmss')
|
|
154
|
+
this.dialogMessages = []
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
handleSendMessage() {
|
|
158
|
+
if (!this.doctorInputText.trim()) return
|
|
159
|
+
|
|
160
|
+
// 确保有dialogId
|
|
161
|
+
if (!this.currentDialogId) {
|
|
162
|
+
this.initDialog()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const messageContent = this.doctorInputText.trim()
|
|
166
|
+
const doctorMessage = {
|
|
167
|
+
type: 'user',
|
|
168
|
+
content: messageContent,
|
|
169
|
+
time: new Date().toLocaleTimeString(),
|
|
170
|
+
timestamp: Date.now()
|
|
171
|
+
}
|
|
172
|
+
this.dialogMessages.push(doctorMessage)
|
|
173
|
+
this.scrollToBottom()
|
|
174
|
+
|
|
175
|
+
this.doctorInputText = ''
|
|
176
|
+
this.autoResizeTextarea()
|
|
177
|
+
|
|
178
|
+
const chatId = this.currentDialogId
|
|
179
|
+
let aiContent = ''
|
|
180
|
+
const aiMsgIndex = this.dialogMessages.length
|
|
181
|
+
this.dialogMessages.push({
|
|
182
|
+
type: 'ai',
|
|
183
|
+
content: '',
|
|
184
|
+
time: new Date().toLocaleTimeString(),
|
|
185
|
+
timestamp: Date.now()
|
|
186
|
+
})
|
|
187
|
+
this.scrollToBottom()
|
|
188
|
+
|
|
189
|
+
this.isAiStreaming = true
|
|
190
|
+
|
|
191
|
+
this.currentStreamConnection = startEventStreamPOST(
|
|
192
|
+
'/his-web/api/af-his/ai/chat/stream',
|
|
193
|
+
{ userMessage: messageContent, chatId, model: '', prompt: '', useContext: true, user: this.currUser.operInfo },
|
|
194
|
+
{'Content-Type': 'application/json'},
|
|
195
|
+
(data, type) => {
|
|
196
|
+
if (type === 'additionalInfo' || type === 'sourceInfo') return
|
|
197
|
+
|
|
198
|
+
let textChunk = ''
|
|
199
|
+
if (typeof data === 'object' && data !== null) {
|
|
200
|
+
const choices = data.choices
|
|
201
|
+
if (Array.isArray(choices) && choices.length > 0) {
|
|
202
|
+
const delta = choices[0].delta
|
|
203
|
+
|
|
204
|
+
// 优先取 delta.content(标准 OpenAI 格式)
|
|
205
|
+
if (delta && typeof delta.content === 'string' && delta.content) {
|
|
206
|
+
textChunk = delta.content
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// 兼容百川模型的 thinking 字段
|
|
210
|
+
if (!textChunk && delta && delta.thinking) {
|
|
211
|
+
const thinking = delta.thinking
|
|
212
|
+
// 取 summary 描述
|
|
213
|
+
if (thinking.summary && typeof thinking.summary === 'string') {
|
|
214
|
+
textChunk = `[思考中] ${thinking.summary}`
|
|
215
|
+
}
|
|
216
|
+
// 取 reasoning steps
|
|
217
|
+
if (Array.isArray(thinking.steps)) {
|
|
218
|
+
const activeStep = thinking.steps.find(s => s.status === 'in_progress')
|
|
219
|
+
if (activeStep && activeStep.label) {
|
|
220
|
+
textChunk = `[思考中] ${activeStep.label}`
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// 检测模型拒答
|
|
226
|
+
const finishReason = choices[0].finish_reason
|
|
227
|
+
if (finishReason === 'refuse_answer') {
|
|
228
|
+
const refuseTip = '\n\n> ⚠️ 很抱歉,当前问题我无法回答,请尝试调整提问方式或联系管理员。'
|
|
229
|
+
if (!this.dialogMessages[aiMsgIndex].content.includes('无法回答')) {
|
|
230
|
+
this.dialogMessages[aiMsgIndex].content += refuseTip
|
|
231
|
+
this.isAiStreaming = false
|
|
232
|
+
this.scrollToBottom()
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
} else if (typeof data === 'string') {
|
|
237
|
+
textChunk = data
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (textChunk) {
|
|
241
|
+
aiContent += textChunk
|
|
242
|
+
this.dialogMessages[aiMsgIndex].content = aiContent
|
|
243
|
+
this.scrollToBottom()
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
(error) => {
|
|
247
|
+
this.isAiStreaming = false
|
|
248
|
+
this.dialogMessages[aiMsgIndex].content += `\n\n[错误: ${error.message || '请求失败'}]`
|
|
249
|
+
this.scrollToBottom()
|
|
250
|
+
},
|
|
251
|
+
() => {
|
|
252
|
+
this.isAiStreaming = false
|
|
253
|
+
this.scrollToBottom()
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
setPatientComplaint(complaint) {
|
|
259
|
+
this.patientComplaint = complaint
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
scrollToBottom(delay = 0) {
|
|
263
|
+
this.$nextTick(() => {
|
|
264
|
+
setTimeout(() => {
|
|
265
|
+
const chatArea = document.querySelector('.chat-area')
|
|
266
|
+
if (chatArea) {
|
|
267
|
+
chatArea.scrollTop = chatArea.scrollHeight
|
|
268
|
+
}
|
|
269
|
+
}, delay)
|
|
270
|
+
})
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
reset() {
|
|
274
|
+
if (this.currentStreamConnection) {
|
|
275
|
+
this.currentStreamConnection()
|
|
276
|
+
this.currentStreamConnection = null
|
|
277
|
+
}
|
|
278
|
+
this.isAiStreaming = false
|
|
279
|
+
this.patientComplaint = ''
|
|
280
|
+
this.doctorQuestions = []
|
|
281
|
+
this.examinationOrder = null
|
|
282
|
+
this.aiDiagnosis = null
|
|
283
|
+
this.doctorInputText = ''
|
|
284
|
+
this.isPlaying = false
|
|
285
|
+
this.isRecording = false
|
|
286
|
+
this.dialogMessages = []
|
|
287
|
+
this.$nextTick(() => {
|
|
288
|
+
this.autoResizeTextarea()
|
|
289
|
+
const chatArea = document.querySelector('.chat-area')
|
|
290
|
+
if (chatArea) {
|
|
291
|
+
chatArea.scrollTop = 0
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
triggerUpload() {
|
|
297
|
+
this.$refs.uploadInput.click()
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
handleFileChange(event) {
|
|
301
|
+
const files = Array.from(event.target.files || [])
|
|
302
|
+
if (!files.length) return
|
|
303
|
+
|
|
304
|
+
this.dialogMessages.push({
|
|
305
|
+
type: 'user',
|
|
306
|
+
content: `已上传文件:${files.map(f => f.name).join('、')}`,
|
|
307
|
+
time: new Date().toLocaleTimeString(),
|
|
308
|
+
timestamp: Date.now()
|
|
309
|
+
})
|
|
310
|
+
this.scrollToBottom()
|
|
311
|
+
event.target.value = ''
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
</script>
|
|
316
|
+
|
|
317
|
+
<style scoped>
|
|
318
|
+
.ai-consultation-outer {
|
|
319
|
+
box-sizing: border-box;
|
|
320
|
+
margin: 0;
|
|
321
|
+
padding: 0;
|
|
322
|
+
width: 100%;
|
|
323
|
+
height: 860px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.ai-consultation-container {
|
|
327
|
+
width: 100%;
|
|
328
|
+
height: 100%;
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: column;
|
|
331
|
+
background: #FFFFFF;
|
|
332
|
+
border: 1px solid #E5E9F0;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.chat-area {
|
|
336
|
+
flex: 1;
|
|
337
|
+
overflow-y: auto;
|
|
338
|
+
padding: 16px;
|
|
339
|
+
background: #fff;
|
|
340
|
+
min-height: 690px;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.dialog-area {
|
|
344
|
+
display: flex;
|
|
345
|
+
flex-direction: column;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/* 底部输入框区域 */
|
|
349
|
+
.bottom-input-wrapper {
|
|
350
|
+
flex-shrink: 0;
|
|
351
|
+
padding: 12px 16px;
|
|
352
|
+
background: #fff;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.input-container {
|
|
356
|
+
position: relative;
|
|
357
|
+
width: 782px;
|
|
358
|
+
height: 249px;
|
|
359
|
+
margin: 0 auto;
|
|
360
|
+
padding: 15px 0 0 11px;
|
|
361
|
+
display: flex;
|
|
362
|
+
flex-direction: column;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.input-textarea-area {
|
|
366
|
+
flex: 1 1 auto;
|
|
367
|
+
min-height: 0;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.bottom-input {
|
|
371
|
+
width: 100%;
|
|
372
|
+
height: 100%;
|
|
373
|
+
border-radius: 6px;
|
|
374
|
+
opacity: 1;
|
|
375
|
+
background: #FFFFFF;
|
|
376
|
+
box-sizing: border-box;
|
|
377
|
+
border: 1px solid #E5E9F0;
|
|
378
|
+
padding: 12px 60px 12px 16px;
|
|
379
|
+
font-family: 'Source Han Sans', 'Microsoft YaHei', sans-serif;
|
|
380
|
+
font-size: 16px;
|
|
381
|
+
color: #313131;
|
|
382
|
+
resize: none;
|
|
383
|
+
outline: none;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.bottom-input:focus {
|
|
387
|
+
border-color: #1890ff;
|
|
388
|
+
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.bottom-input::placeholder {
|
|
392
|
+
color: #999;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.input-controls-left {
|
|
396
|
+
position: absolute;
|
|
397
|
+
left: 5px;
|
|
398
|
+
bottom: 5px;
|
|
399
|
+
z-index: 2;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.upload-btn {
|
|
403
|
+
width: 173px;
|
|
404
|
+
height: 32px;
|
|
405
|
+
border-radius: 6px;
|
|
406
|
+
background: #FFFFFF;
|
|
407
|
+
box-sizing: border-box;
|
|
408
|
+
border: 1px solid #9499A0;
|
|
409
|
+
color: #313131;
|
|
410
|
+
font-family: Source Han Sans;
|
|
411
|
+
font-size: 16px;
|
|
412
|
+
font-weight: normal;
|
|
413
|
+
line-height: normal;
|
|
414
|
+
letter-spacing: 0em;
|
|
415
|
+
display: flex;
|
|
416
|
+
align-items: center;
|
|
417
|
+
justify-content: center;
|
|
418
|
+
gap: 6px;
|
|
419
|
+
cursor: pointer;
|
|
420
|
+
padding: 0;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.upload-btn > .anticon + span,
|
|
424
|
+
.upload-btn > span + .anticon {
|
|
425
|
+
margin-left: 0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.upload-icon {
|
|
429
|
+
font-size: 21px;
|
|
430
|
+
margin-left: 8px;
|
|
431
|
+
color: #94979E;
|
|
432
|
+
display: inline-flex;
|
|
433
|
+
align-items: center;
|
|
434
|
+
justify-content: center;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.upload-text {
|
|
438
|
+
height: 23px;
|
|
439
|
+
opacity: 1;
|
|
440
|
+
font-family: Source Han Sans;
|
|
441
|
+
font-size: 16px;
|
|
442
|
+
font-weight: normal;
|
|
443
|
+
line-height: normal;
|
|
444
|
+
letter-spacing: 0em;
|
|
445
|
+
color: #313131;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.input-controls-right {
|
|
449
|
+
position: absolute;
|
|
450
|
+
right: 7px;
|
|
451
|
+
bottom: 7px;
|
|
452
|
+
display: flex;
|
|
453
|
+
align-items: center;
|
|
454
|
+
gap: 8px;
|
|
455
|
+
z-index: 2;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.enter-tip {
|
|
459
|
+
font-family: 'Inter', sans-serif;
|
|
460
|
+
font-size: 14px;
|
|
461
|
+
font-weight: 500;
|
|
462
|
+
color: #9E9E9E;
|
|
463
|
+
padding: 4px 8px;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.send-btn {
|
|
467
|
+
width: 30px;
|
|
468
|
+
height: 30px;
|
|
469
|
+
background: #0057FE;
|
|
470
|
+
border: none;
|
|
471
|
+
border-radius: 50%;
|
|
472
|
+
color: #fff;
|
|
473
|
+
font-size: 14px;
|
|
474
|
+
cursor: pointer;
|
|
475
|
+
display: flex;
|
|
476
|
+
align-items: center;
|
|
477
|
+
justify-content: center;
|
|
478
|
+
padding: 0;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.send-btn:hover {
|
|
482
|
+
background: #0040cc;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.send-icon {
|
|
486
|
+
font-size: 14px;
|
|
487
|
+
font-weight: bold;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* 对话区域样式 */
|
|
491
|
+
.dialog-message {
|
|
492
|
+
display: flex;
|
|
493
|
+
margin-bottom: 16px;
|
|
494
|
+
align-items: flex-start;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.dialog-message:last-child {
|
|
498
|
+
margin-bottom: 0;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.dialog-message.ai {
|
|
502
|
+
flex-direction: row;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.dialog-message.user {
|
|
506
|
+
flex-direction: row-reverse;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.dialog-message.user .message-text {
|
|
510
|
+
text-align: right;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.message-text {
|
|
514
|
+
opacity: 1;
|
|
515
|
+
font-family: Source Han Sans;
|
|
516
|
+
font-size: 16px;
|
|
517
|
+
font-weight: normal;
|
|
518
|
+
line-height: normal;
|
|
519
|
+
text-align: justify;
|
|
520
|
+
letter-spacing: 0em;
|
|
521
|
+
font-feature-settings: "kern" on;
|
|
522
|
+
max-width: 100%;
|
|
523
|
+
color: #313131;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.typing-cursor {
|
|
527
|
+
display: inline-block;
|
|
528
|
+
margin-left: 2px;
|
|
529
|
+
color: #0057FE;
|
|
530
|
+
font-size: 18px;
|
|
531
|
+
animation: blink 1s step-end infinite;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
@keyframes blink {
|
|
535
|
+
0%, 100% { opacity: 1; }
|
|
536
|
+
50% { opacity: 0; }
|
|
537
|
+
}
|
|
538
|
+
</style>
|