cnhis-design-vue 3.3.1-release.4 → 3.3.2-beta.1
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/README.md +87 -87
- package/es/components/audio-sdk/index.d.ts +57 -6
- package/es/components/audio-sdk/index.js +1 -0
- package/es/components/audio-sdk/src/Index.vue.d.ts +55 -6
- package/es/components/audio-sdk/src/Index.vue2.js +12 -4
- package/es/components/audio-sdk/src/audioSDK.d.ts +4 -4
- package/es/components/audio-sdk/src/audioSDK.js +23 -9
- package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +27 -3
- package/es/components/audio-sdk/src/components/recording.vue.d.ts +27 -3
- package/es/components/audio-sdk/src/components/recording.vue2.js +14 -6
- package/es/components/audio-sdk/src/constants/index.d.ts +1 -0
- package/es/components/audio-sdk/src/constants/index.js +3 -0
- package/es/components/audio-sdk/src/utils/recorder/fft.d.ts +4 -0
- package/es/components/audio-sdk/src/utils/recorder/fft.js +75 -0
- package/es/components/audio-sdk/src/utils/recorder/index.d.ts +3 -0
- package/es/components/audio-sdk/src/utils/recorder/index.js +12 -0
- package/es/components/audio-sdk/src/utils/recorder/mp3-engine.d.ts +4 -0
- package/es/components/audio-sdk/src/utils/recorder/mp3-engine.js +12435 -0
- package/es/components/audio-sdk/src/utils/recorder/mp3.d.ts +4 -0
- package/es/components/audio-sdk/src/utils/recorder/mp3.js +343 -0
- package/es/components/audio-sdk/src/utils/recorder/recorder.d.ts +4 -0
- package/es/components/audio-sdk/src/utils/recorder/recorder.js +1324 -0
- package/es/components/audio-sdk/src/utils/recorder/wave.d.ts +4 -0
- package/es/components/audio-sdk/src/utils/recorder/wave.js +258 -0
- package/es/components/audio-sdk/src/utils/recordingModal.js +13 -2
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/callback/src/components/render/popupMaps.d.ts +17 -1
- package/es/components/card-render/index.d.ts +4 -4
- package/es/components/card-render/src/CardRender.vue.d.ts +4 -4
- package/es/components/card-render/src/components/index.d.ts +23 -23
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +12 -6
- package/es/components/field-editor/index.d.ts +4 -0
- package/es/components/field-editor/src/FieldEditor.vue.d.ts +4 -0
- package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
- package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
- package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
- package/es/components/form-config/index.d.ts +80 -5
- package/es/components/form-config/src/FormConfig.vue.d.ts +80 -5
- package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +4 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +57 -4
- package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +16 -1
- package/es/components/form-config/src/constants/index.d.ts +2 -1
- package/es/components/form-config/src/constants/index.js +1 -0
- package/es/components/form-config/src/hooks/useConfigurationField.js +19 -1
- package/es/components/form-config/src/hooks/useLocale.d.ts +1 -0
- package/es/components/form-config/src/hooks/useLocale.js +1 -0
- package/es/components/form-config/src/types/index.d.ts +1 -0
- package/es/components/form-render/index.d.ts +4 -0
- package/es/components/form-render/src/FormRender.vue.d.ts +4 -0
- package/es/components/form-render/src/FormRender.vue2.js +3 -2
- package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +4 -0
- package/es/components/form-render/src/components/renderer/combination/combination.js +1 -1
- package/es/components/form-render/src/components/renderer/date.d.ts +2 -2
- package/es/components/form-render/src/components/renderer/input.d.ts +16 -4
- package/es/components/form-render/src/components/renderer/input.js +39 -7
- package/es/components/form-render/src/components/renderer/levelSearchCascader/index.js +3 -0
- package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +1 -0
- package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +1 -0
- package/es/components/form-render/src/components/renderer/radio_checkbox.js +9 -8
- package/es/components/form-render/src/components/renderer/text.js +1 -1
- package/es/components/form-render/src/components/renderer/textarea.d.ts +16 -1
- package/es/components/form-render/src/components/renderer/textarea.js +36 -8
- package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -0
- package/es/components/form-render/src/hooks/useComplexOptions.js +3 -2
- package/es/components/form-render/src/hooks/useFieldListAdaptor.d.ts +2 -2
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +4 -3
- package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +2 -0
- package/es/components/form-render/src/hooks/useFormField.d.ts +2 -0
- package/es/components/form-render/src/hooks/useFormField.js +5 -1
- package/es/components/form-render/src/hooks/useFormValidator.js +1 -0
- package/es/components/form-render/src/hooks/usePresetScope.js +1 -0
- package/es/components/form-render/src/types/fieldItem.d.ts +11 -0
- package/es/components/form-render/src/types/index.d.ts +2 -1
- package/es/components/form-render/src/utils/index.js +1 -0
- package/es/components/form-render/src/utils/schema.js +60 -15
- package/es/components/guide/src/renderer.d.ts +2 -2
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/iho-table/index.d.ts +13 -1
- package/es/components/iho-table/src/IhoTable.vue.d.ts +13 -2
- package/es/components/iho-table/src/IhoTable.vue2.js +27 -20
- package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +6 -0
- package/es/components/index.css +1 -1
- package/es/components/index.d.ts +1 -2
- package/es/components/index.js +1 -3
- package/es/components/info-header/index.d.ts +13 -0
- package/es/components/info-header/src/InfoHeader.vue.d.ts +13 -0
- package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +1 -0
- package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +1 -0
- package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +5 -0
- package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +4 -0
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/components/select-person/src/SelectPerson.vue2.js +21 -9
- package/es/components/shortcut-setter/index.d.ts +16 -1
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +16 -1
- package/es/components/table-filter/src/components/render-widget/enums.d.ts +2 -0
- package/es/components/table-filter/src/components/render-widget/enums.js +2 -1
- package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +8 -0
- package/es/components/table-filter/src/components/render-widget/helpers/enums.d.ts +1 -0
- package/es/components/table-filter/src/components/render-widget/helpers/enums.js +2 -1
- package/es/components/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +15 -13
- package/es/components/table-filter/src/tool/baseOptions.js +3 -0
- package/es/env.d.ts +25 -25
- package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
- package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
- package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
- package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
- package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
- package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
- package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
- package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
- package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
- package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
- package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
- package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
- package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
- package/es/shared/assets/img/failure.png.js +1 -1
- package/es/shared/assets/img/no-permission.png.js +1 -1
- package/es/shared/assets/img/nodata.png.js +1 -1
- package/es/shared/assets/img/notfound.png.js +1 -1
- package/es/shared/assets/img/qr.png.js +1 -1
- package/es/shared/assets/img/success.png.js +1 -1
- package/es/shared/assets/img/table_style_2.png.js +1 -1
- package/es/shared/assets/img/video.png.js +1 -1
- package/es/shared/assets/img/video_default_cover.png.js +1 -1
- package/es/shared/assets/img/xb_big.png.js +1 -1
- package/es/shared/assets/img/xb_small.png.js +1 -1
- package/es/shared/components/CancelRadio/CancelRadio.d.ts +7 -0
- package/es/shared/components/CancelRadio/CancelRadio.js +6 -6
- package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/fabricjs/index.d.ts +6823 -0
- package/es/shared/utils/index.js +3 -2
- package/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +76 -78
- package/es/components/ai-chat/index.d.ts +0 -680
- package/es/components/ai-chat/index.js +0 -10
- package/es/components/ai-chat/src/Index.vue.d.ts +0 -682
- package/es/components/ai-chat/src/Index.vue.js +0 -6
- package/es/components/ai-chat/src/Index.vue2.js +0 -175
- package/es/components/ai-chat/src/api/index.d.ts +0 -8
- package/es/components/ai-chat/src/api/index.js +0 -87
- package/es/components/ai-chat/src/components/ChatAudio.vue.d.ts +0 -38
- package/es/components/ai-chat/src/components/ChatAudio.vue.js +0 -6
- package/es/components/ai-chat/src/components/ChatAudio.vue2.js +0 -103
- package/es/components/ai-chat/src/components/ChatBI.vue.d.ts +0 -101
- package/es/components/ai-chat/src/components/ChatBI.vue.js +0 -6
- package/es/components/ai-chat/src/components/ChatBI.vue2.js +0 -73
- package/es/components/ai-chat/src/components/ChatCard.d.ts +0 -43
- package/es/components/ai-chat/src/components/ChatCard.js +0 -403
- package/es/components/ai-chat/src/components/ChatFooter.vue.d.ts +0 -203
- package/es/components/ai-chat/src/components/ChatFooter.vue.js +0 -6
- package/es/components/ai-chat/src/components/ChatFooter.vue2.js +0 -373
- package/es/components/ai-chat/src/components/ChatMain.d.ts +0 -2
- package/es/components/ai-chat/src/components/ChatMain.js +0 -350
- package/es/components/ai-chat/src/components/ChatMainDefault.d.ts +0 -2
- package/es/components/ai-chat/src/components/ChatMainDefault.js +0 -278
- package/es/components/ai-chat/src/components/ChatPatient.vue.d.ts +0 -59
- package/es/components/ai-chat/src/components/ChatPatient.vue.js +0 -6
- package/es/components/ai-chat/src/components/ChatPatient.vue2.js +0 -218
- package/es/components/ai-chat/src/components/ChatPrompt.vue.d.ts +0 -45
- package/es/components/ai-chat/src/components/ChatPrompt.vue.js +0 -6
- package/es/components/ai-chat/src/components/ChatPrompt.vue2.js +0 -143
- package/es/components/ai-chat/src/components/ChatRight.vue.d.ts +0 -57
- package/es/components/ai-chat/src/components/ChatRight.vue.js +0 -6
- package/es/components/ai-chat/src/components/ChatRight.vue2.js +0 -190
- package/es/components/ai-chat/src/components/card/JsonCard.d.ts +0 -25
- package/es/components/ai-chat/src/components/card/JsonCard.js +0 -574
- package/es/components/ai-chat/src/components/message-render/CardRender.d.ts +0 -16
- package/es/components/ai-chat/src/components/message-render/CardRender.js +0 -80
- package/es/components/ai-chat/src/components/message-render/FormRender.d.ts +0 -16
- package/es/components/ai-chat/src/components/message-render/FormRender.js +0 -173
- package/es/components/ai-chat/src/components/mobile/MobileChatAudio.vue.d.ts +0 -36
- package/es/components/ai-chat/src/components/mobile/MobileChatAudio.vue.js +0 -6
- package/es/components/ai-chat/src/components/mobile/MobileChatAudio.vue2.js +0 -96
- package/es/components/ai-chat/src/components/mobile/MobileChatFooter.vue.d.ts +0 -105
- package/es/components/ai-chat/src/components/mobile/MobileChatFooter.vue.js +0 -6
- package/es/components/ai-chat/src/components/mobile/MobileChatFooter.vue2.js +0 -260
- package/es/components/ai-chat/src/components/svgs/AddIcon.vue.js +0 -18
- package/es/components/ai-chat/src/components/svgs/AudioIcon.vue.js +0 -37
- package/es/components/ai-chat/src/components/svgs/KeyboardIcon.vue.js +0 -20
- package/es/components/ai-chat/src/components/svgs/MicroPhone.vue.js +0 -48
- package/es/components/ai-chat/src/hooks/index.d.ts +0 -2
- package/es/components/ai-chat/src/hooks/index.js +0 -2
- package/es/components/ai-chat/src/hooks/useChartAudioContext.d.ts +0 -18
- package/es/components/ai-chat/src/hooks/useChartAudioContext.js +0 -202
- package/es/components/ai-chat/src/hooks/useData.d.ts +0 -77
- package/es/components/ai-chat/src/hooks/useData.js +0 -289
- package/es/components/ai-chat/src/hooks/useFooterContext.d.ts +0 -38
- package/es/components/ai-chat/src/hooks/useFooterContext.js +0 -218
- package/es/components/ai-chat/src/hooks/useProgram.d.ts +0 -14
- package/es/components/ai-chat/src/hooks/useProgram.js +0 -306
- package/es/components/ai-chat/src/hooks/useSSE.d.ts +0 -9
- package/es/components/ai-chat/src/hooks/useSSE.js +0 -138
- package/es/components/ai-chat/src/hooks/useWebsocket.d.ts +0 -4
- package/es/components/ai-chat/src/hooks/useWebsocket.js +0 -66
- package/es/components/ai-chat/src/types/index.d.ts +0 -45
- package/es/components/ai-chat/src/types/index.js +0 -1
- package/es/components/ai-chat/src/utils/index.d.ts +0 -7
- package/es/components/ai-chat/src/utils/index.js +0 -41
- package/es/components/ai-chat/style/index.css +0 -1
- package/es/shared/assets/img/ai__avatar.png.js +0 -3
- package/es/shared/assets/img/file-emr.png.js +0 -3
- package/es/shared/assets/img/file.png.js +0 -3
- package/es/shared/assets/img/logo.png.js +0 -3
- package/es/shared/assets/img/use.png.js +0 -3
@@ -1,306 +0,0 @@
|
|
1
|
-
import { computed, nextTick } from 'vue';
|
2
|
-
import { $message, formatType, isValidJSON } from '../utils/index.js';
|
3
|
-
import { uuidGenerator } from '../../../../shared/utils/index.js';
|
4
|
-
import { callbackApi } from '../api/index.js';
|
5
|
-
import { useIntervalFn, useThrottleFn } from '@vueuse/core';
|
6
|
-
import { format } from 'date-fns';
|
7
|
-
|
8
|
-
const messageTypeMap = {
|
9
|
-
inquiry: "\u95EE\u8BCA\u8BB0\u5F55",
|
10
|
-
medical: "\u7535\u5B50\u75C5\u5386",
|
11
|
-
diagnosis: "\u63A8\u8350\u8BCA\u65AD",
|
12
|
-
diagnosis_added: "\u68C0\u9A8C\u68C0\u67E5",
|
13
|
-
treatment_plan: "\u6CBB\u7597\u65B9\u6848",
|
14
|
-
report_message: "\u62A5\u544A",
|
15
|
-
medical_added: "\u5F00\u7ACB\u5355"
|
16
|
-
};
|
17
|
-
function useProgram({
|
18
|
-
props,
|
19
|
-
state,
|
20
|
-
appendMessage,
|
21
|
-
emit,
|
22
|
-
chatMainRef
|
23
|
-
}) {
|
24
|
-
let time = 0;
|
25
|
-
const {
|
26
|
-
pause,
|
27
|
-
resume
|
28
|
-
} = useIntervalFn(() => {
|
29
|
-
time++;
|
30
|
-
}, 1e3);
|
31
|
-
const handleScroll = useThrottleFn(() => {
|
32
|
-
if (chatMainRef.value) {
|
33
|
-
chatMainRef.value.scrollTop = 0;
|
34
|
-
}
|
35
|
-
}, 2e3);
|
36
|
-
const baseParams = computed(() => {
|
37
|
-
var _a;
|
38
|
-
return {
|
39
|
-
appCode: props.appCode,
|
40
|
-
sessionId: props.sessionId || ((_a = props.configs) == null ? void 0 : _a.vaa07)
|
41
|
-
};
|
42
|
-
});
|
43
|
-
function toNext(bpmnProcessId, variables) {
|
44
|
-
var _a;
|
45
|
-
state.bpmnProcessDoing = true;
|
46
|
-
const _bpmnProcessId = bpmnProcessId || state.bpmnProcessId;
|
47
|
-
console.log("toNext ==>", _bpmnProcessId);
|
48
|
-
if (typeof ((_a = window._programArrange) == null ? void 0 : _a.next) !== "function")
|
49
|
-
return;
|
50
|
-
window._programArrange.next({
|
51
|
-
bpmnProcessId,
|
52
|
-
startToken: bpmnProcessId ? "" : state.startToken,
|
53
|
-
variables,
|
54
|
-
programTaskSetting: {
|
55
|
-
showLoading: false
|
56
|
-
}
|
57
|
-
}, (obj) => {
|
58
|
-
var _a2, _b;
|
59
|
-
state.bpmnProcessDoing = false;
|
60
|
-
console.log("\u83B7\u53D6\u56DE\u8C03\u6570\u636E\uFF1A", obj);
|
61
|
-
clearTimer();
|
62
|
-
state.loading = false;
|
63
|
-
if ((_a2 = obj == null ? void 0 : obj.data) == null ? void 0 : _a2.msg) {
|
64
|
-
$message.error((_b = obj == null ? void 0 : obj.data) == null ? void 0 : _b.msg);
|
65
|
-
}
|
66
|
-
console.log("_bpmnProcessId ==>", _bpmnProcessId);
|
67
|
-
window._programArrange.removeAiConditions((obj == null ? void 0 : obj.programArrangeId) || _bpmnProcessId);
|
68
|
-
});
|
69
|
-
}
|
70
|
-
function toBindAiConditions() {
|
71
|
-
console.log("toBindAiConditions ==>");
|
72
|
-
let flag = true;
|
73
|
-
window._programArrange.bindAiConditions(state.bpmnProcessId, async (res) => {
|
74
|
-
var _a, _b, _c, _d;
|
75
|
-
console.log("---\u83B7\u53D6AI\u6570\u636E", res);
|
76
|
-
const {
|
77
|
-
programData,
|
78
|
-
config = {}
|
79
|
-
} = res || {};
|
80
|
-
const {
|
81
|
-
webType,
|
82
|
-
renderType,
|
83
|
-
renderContent,
|
84
|
-
content: _content = {}
|
85
|
-
} = config;
|
86
|
-
if (webType !== "ai") {
|
87
|
-
state.loading = false;
|
88
|
-
}
|
89
|
-
if (webType === "error") {
|
90
|
-
state.bpmnProcessDoing = false;
|
91
|
-
clearTimer();
|
92
|
-
flag = true;
|
93
|
-
return;
|
94
|
-
}
|
95
|
-
const msgId = uuidGenerator();
|
96
|
-
if (webType === "render") {
|
97
|
-
const messageItem = {
|
98
|
-
msgId,
|
99
|
-
...baseParams.value
|
100
|
-
};
|
101
|
-
if (renderType == 0) {
|
102
|
-
const {
|
103
|
-
messageType,
|
104
|
-
json,
|
105
|
-
title
|
106
|
-
} = formatType(renderContent);
|
107
|
-
if (messageType && Object.keys(messageTypeMap).includes(messageType)) {
|
108
|
-
Object.assign(messageItem, {
|
109
|
-
contents: [{
|
110
|
-
role: "system",
|
111
|
-
content: json,
|
112
|
-
contentType: "json",
|
113
|
-
messageType
|
114
|
-
}]
|
115
|
-
});
|
116
|
-
appendMessage({
|
117
|
-
...messageItem,
|
118
|
-
__title: title
|
119
|
-
});
|
120
|
-
if (messageType === "inquiry") {
|
121
|
-
if ((_a = json.details) == null ? void 0 : _a.autoBackFillData) {
|
122
|
-
state.showRight = false;
|
123
|
-
await nextTick();
|
124
|
-
state.consultationContent = messageItem;
|
125
|
-
state.showRight = true;
|
126
|
-
}
|
127
|
-
} else if (messageType === "medical") {
|
128
|
-
emit("program", {
|
129
|
-
key: "medical",
|
130
|
-
params: {},
|
131
|
-
type: 1
|
132
|
-
});
|
133
|
-
}
|
134
|
-
toReplyAiConditions({
|
135
|
-
programData,
|
136
|
-
params: {
|
137
|
-
data: json
|
138
|
-
}
|
139
|
-
});
|
140
|
-
const data = await callbackApi(messageItem);
|
141
|
-
if ((data == null ? void 0 : data.id) && messageType === "inquiry" && state.showRight) {
|
142
|
-
state.consultationContent.id = data.id;
|
143
|
-
}
|
144
|
-
return;
|
145
|
-
}
|
146
|
-
Object.assign(messageItem, {
|
147
|
-
contents: [{
|
148
|
-
role: "system",
|
149
|
-
content: renderContent,
|
150
|
-
contentType: "text"
|
151
|
-
}]
|
152
|
-
});
|
153
|
-
} else if (renderType == 4) {
|
154
|
-
Object.assign(messageItem, {
|
155
|
-
contents: [{
|
156
|
-
role: "system",
|
157
|
-
content: renderContent,
|
158
|
-
contentType: "text"
|
159
|
-
}]
|
160
|
-
});
|
161
|
-
state.needSubmitMsg = {
|
162
|
-
programData
|
163
|
-
};
|
164
|
-
appendMessage(messageItem);
|
165
|
-
callbackApi(messageItem);
|
166
|
-
return;
|
167
|
-
} else if (renderType == 1) {
|
168
|
-
Object.assign(messageItem, {
|
169
|
-
contents: [{
|
170
|
-
role: "system",
|
171
|
-
content: config,
|
172
|
-
contentType: "json",
|
173
|
-
messageType: "card"
|
174
|
-
}]
|
175
|
-
});
|
176
|
-
} else if (renderType == 2) {
|
177
|
-
Object.assign(messageItem, {
|
178
|
-
contents: [{
|
179
|
-
role: "system",
|
180
|
-
content: renderContent,
|
181
|
-
contentType: "text"
|
182
|
-
}]
|
183
|
-
});
|
184
|
-
} else if (renderType == 3) {
|
185
|
-
Object.assign(messageItem, {
|
186
|
-
contents: [{
|
187
|
-
role: "system",
|
188
|
-
content: {
|
189
|
-
info: config.linkTitle || "",
|
190
|
-
creationTime: format(new Date(), "yyyy-MM-dd HH:mm:ss"),
|
191
|
-
linkType: (_b = config.linkType) != null ? _b : 0,
|
192
|
-
linkURL: config.linkURL || "",
|
193
|
-
linkProcess: config.linkProcess || "",
|
194
|
-
linkParams: config.linkParams || {}
|
195
|
-
},
|
196
|
-
contentType: "json",
|
197
|
-
messageType: "link"
|
198
|
-
}]
|
199
|
-
});
|
200
|
-
}
|
201
|
-
appendMessage(messageItem);
|
202
|
-
callbackApi(messageItem);
|
203
|
-
toReplyAiConditions({
|
204
|
-
programData
|
205
|
-
});
|
206
|
-
return;
|
207
|
-
}
|
208
|
-
if (webType === "form") {
|
209
|
-
const messageItem = {
|
210
|
-
msgId,
|
211
|
-
contents: [{
|
212
|
-
role: "system",
|
213
|
-
content: config,
|
214
|
-
contentType: "json",
|
215
|
-
messageType: webType,
|
216
|
-
__programData: programData
|
217
|
-
}],
|
218
|
-
...baseParams.value
|
219
|
-
};
|
220
|
-
appendMessage(messageItem);
|
221
|
-
callbackApi(messageItem);
|
222
|
-
return;
|
223
|
-
}
|
224
|
-
if (webType === "ai") {
|
225
|
-
if (isValidJSON(_content.data)) {
|
226
|
-
const json = JSON.parse(_content.data);
|
227
|
-
const {
|
228
|
-
finish_reason = "",
|
229
|
-
delta = {}
|
230
|
-
} = ((_c = json.choices) == null ? void 0 : _c[0]) || {};
|
231
|
-
const {
|
232
|
-
content = "",
|
233
|
-
role
|
234
|
-
} = delta;
|
235
|
-
let messageItem = state.record[0];
|
236
|
-
if (flag) {
|
237
|
-
time = 0;
|
238
|
-
resume();
|
239
|
-
state.loading = true;
|
240
|
-
messageItem = {
|
241
|
-
msgId,
|
242
|
-
contents: [{
|
243
|
-
role: "system",
|
244
|
-
content,
|
245
|
-
contentType: "text"
|
246
|
-
}],
|
247
|
-
...baseParams.value
|
248
|
-
};
|
249
|
-
appendMessage(messageItem);
|
250
|
-
flag = false;
|
251
|
-
} else {
|
252
|
-
messageItem.contents[0].content += content;
|
253
|
-
state.record.splice(0, 1, messageItem);
|
254
|
-
handleScroll();
|
255
|
-
console.log("AI\u6E32\u67D3ing ==>", state.record[0]);
|
256
|
-
if (finish_reason === "stop") {
|
257
|
-
const currentMessage = state.record.find((item) => item.msgId === messageItem.msgId);
|
258
|
-
if ((_d = currentMessage == null ? void 0 : currentMessage.contents) == null ? void 0 : _d.length) {
|
259
|
-
currentMessage.contents[0].__showMore = true;
|
260
|
-
currentMessage.contents[0].msgSource = role;
|
261
|
-
currentMessage.contents[0].countTime = time;
|
262
|
-
}
|
263
|
-
clearTimer();
|
264
|
-
state.loading = false;
|
265
|
-
callbackApi(currentMessage);
|
266
|
-
toReplyAiConditions({
|
267
|
-
programData,
|
268
|
-
params: {
|
269
|
-
data: messageItem.contents[0].content
|
270
|
-
}
|
271
|
-
});
|
272
|
-
flag = true;
|
273
|
-
console.log("AI\u6E32\u67D3\u5B8C\u6210 ==>", state.record[0]);
|
274
|
-
}
|
275
|
-
}
|
276
|
-
}
|
277
|
-
return;
|
278
|
-
}
|
279
|
-
});
|
280
|
-
}
|
281
|
-
function toReplyAiConditions(params) {
|
282
|
-
console.log("\u7F16\u6392\u63D0\u4EA4 ==> bpmnProcessId", state.bpmnProcessId, params);
|
283
|
-
state.loading = true;
|
284
|
-
window._programArrange.replyAiConditions(state.bpmnProcessId, params);
|
285
|
-
}
|
286
|
-
function toFinishProgram(bpmnProcessId) {
|
287
|
-
var _a;
|
288
|
-
console.log("\u7ED3\u675F\u672C\u6B21\u6D41\u7A0B ==> bpmnProcessId", bpmnProcessId);
|
289
|
-
state.bpmnProcessDoing = false;
|
290
|
-
if (!bpmnProcessId)
|
291
|
-
return;
|
292
|
-
(_a = window._programArrange) == null ? void 0 : _a.finishProgram(bpmnProcessId);
|
293
|
-
}
|
294
|
-
function clearTimer() {
|
295
|
-
pause();
|
296
|
-
time = 0;
|
297
|
-
}
|
298
|
-
return {
|
299
|
-
toNext,
|
300
|
-
toBindAiConditions,
|
301
|
-
toReplyAiConditions,
|
302
|
-
toFinishProgram
|
303
|
-
};
|
304
|
-
}
|
305
|
-
|
306
|
-
export { useProgram };
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { AnyObject } from '../../../../shared/types';
|
2
|
-
export declare function useSSE({ state, props, appendMessage, params, emit, formatProcessInfo }: {
|
3
|
-
state: AnyObject;
|
4
|
-
props: AnyObject;
|
5
|
-
appendMessage: Function;
|
6
|
-
params: AnyObject;
|
7
|
-
emit: (event: 'button-click' | 'program', ...args: any[]) => void;
|
8
|
-
formatProcessInfo: (str: string) => void;
|
9
|
-
}): void;
|
@@ -1,138 +0,0 @@
|
|
1
|
-
import { fetchEventSource } from '@microsoft/fetch-event-source';
|
2
|
-
import { isArray, isString } from 'lodash-es';
|
3
|
-
import { isValidJSON, $message } from '../utils/index.js';
|
4
|
-
import { uuidGenerator } from '../../../../shared/utils/index.js';
|
5
|
-
|
6
|
-
const url = "/flow/ai/api/conversation";
|
7
|
-
function useSSE({
|
8
|
-
state,
|
9
|
-
props,
|
10
|
-
appendMessage,
|
11
|
-
params,
|
12
|
-
emit,
|
13
|
-
formatProcessInfo
|
14
|
-
}) {
|
15
|
-
var _a, _b;
|
16
|
-
const {
|
17
|
-
opType,
|
18
|
-
firstSubmit
|
19
|
-
} = params;
|
20
|
-
let sseFlag = false;
|
21
|
-
const contentStr = state.inquiryStr && !firstSubmit ? `${state.inquiryStr}
|
22
|
-
\u5B8C\u5584\u4FE1\u606F
|
23
|
-
${state.sendContent}` : state.sendContent;
|
24
|
-
const multContents = state.inquiryStr && !firstSubmit ? {
|
25
|
-
multContents: [{
|
26
|
-
role: "user",
|
27
|
-
content: state.sendContent,
|
28
|
-
contentType: "text"
|
29
|
-
}]
|
30
|
-
} : {};
|
31
|
-
if (firstSubmit) {
|
32
|
-
state.inquiryStr = "";
|
33
|
-
}
|
34
|
-
const parentMsgId = (_a = state.record.find((item) => item.msgId && !item.fromMe)) == null ? void 0 : _a.msgId;
|
35
|
-
state.loading = true;
|
36
|
-
fetchEventSource(url, {
|
37
|
-
method: "POST",
|
38
|
-
headers: {
|
39
|
-
Authorization: "bearer " + props.token,
|
40
|
-
"Content-Type": "application/json"
|
41
|
-
},
|
42
|
-
body: JSON.stringify({
|
43
|
-
appCode: props.appCode,
|
44
|
-
appId: 0,
|
45
|
-
conversationMode: "",
|
46
|
-
extra: {},
|
47
|
-
model: "",
|
48
|
-
msgId: "",
|
49
|
-
parentMsgId,
|
50
|
-
platform: "",
|
51
|
-
requestId: uuidGenerator(),
|
52
|
-
sessionId: props.sessionId || ((_b = props.configs) == null ? void 0 : _b.vaa07),
|
53
|
-
sessionType: "",
|
54
|
-
shortcutFlag: true,
|
55
|
-
traceId: "",
|
56
|
-
contents: [{
|
57
|
-
role: "user",
|
58
|
-
content: contentStr,
|
59
|
-
contentType: "text"
|
60
|
-
}],
|
61
|
-
...multContents,
|
62
|
-
configs: props.configs,
|
63
|
-
...params
|
64
|
-
}),
|
65
|
-
async onopen(res) {
|
66
|
-
console.log("onopen ==>", "\u8FDE\u63A5\u5DF2\u6253\u5F00", res);
|
67
|
-
sseFlag = true;
|
68
|
-
},
|
69
|
-
onmessage(event) {
|
70
|
-
var _a2, _b2, _c, _d;
|
71
|
-
console.log("event ==>", event);
|
72
|
-
state.loading = false;
|
73
|
-
if (!isValidJSON(event.data))
|
74
|
-
return;
|
75
|
-
const res = JSON.parse(event.data);
|
76
|
-
const {
|
77
|
-
result,
|
78
|
-
contents
|
79
|
-
} = res;
|
80
|
-
console.log("result ==>", result, "contents ==>", contents);
|
81
|
-
if (isArray(contents) && contents.length > 0) {
|
82
|
-
if (((_a2 = contents[0]) == null ? void 0 : _a2.contentType) === "json") {
|
83
|
-
appendMessage(res);
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
if (((_b2 = contents[0]) == null ? void 0 : _b2.contentType) === "text") {
|
87
|
-
if (sseFlag) {
|
88
|
-
appendMessage(res);
|
89
|
-
sseFlag = false;
|
90
|
-
}
|
91
|
-
const {
|
92
|
-
content
|
93
|
-
} = ((_d = (_c = state.record[0]) == null ? void 0 : _c.contents) == null ? void 0 : _d[0]) || {};
|
94
|
-
if (isString(content)) {
|
95
|
-
state.record[0].contents[0].content += contents[0].content;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
}
|
99
|
-
formatProcessInfo(result);
|
100
|
-
if (isString(contents) && contents === "STOP") {
|
101
|
-
state.loading = false;
|
102
|
-
state.sendContent = "";
|
103
|
-
if (["diagnosis", "medical_order"].includes(opType)) {
|
104
|
-
if (state.showRightSlot) {
|
105
|
-
let key = "cliRefreshDiagnosis";
|
106
|
-
if (opType === "medical_order") {
|
107
|
-
key = "cliRefreshMedical";
|
108
|
-
}
|
109
|
-
emit("program", {
|
110
|
-
key,
|
111
|
-
type: "refresh",
|
112
|
-
params: {}
|
113
|
-
});
|
114
|
-
}
|
115
|
-
}
|
116
|
-
if (opType === "create_medical") {
|
117
|
-
state.showRight = false;
|
118
|
-
state.showRightSlot = false;
|
119
|
-
}
|
120
|
-
}
|
121
|
-
console.log("state.startToken ==>", state.startToken);
|
122
|
-
},
|
123
|
-
onclose() {
|
124
|
-
console.log("onclose ==>", "\u8FDE\u63A5\u5173\u95ED");
|
125
|
-
state.loading = false;
|
126
|
-
state.sendContent = "";
|
127
|
-
},
|
128
|
-
onerror(err) {
|
129
|
-
console.log("onerror ==>", err);
|
130
|
-
state.loading = false;
|
131
|
-
$message.error("\u5BF9\u8BDD\u8FDE\u63A5\u5931\u8D25\uFF01");
|
132
|
-
throw Error(err);
|
133
|
-
},
|
134
|
-
openWhenHidden: true
|
135
|
-
});
|
136
|
-
}
|
137
|
-
|
138
|
-
export { useSSE };
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { watch, onBeforeUnmount } from 'vue';
|
2
|
-
import { isValidJSON } from '../utils/index.js';
|
3
|
-
|
4
|
-
const ORIGIN = "/flow/ai/app";
|
5
|
-
function useWebsocket(props, data, sessionId) {
|
6
|
-
let isReady = false;
|
7
|
-
let webSocket = null;
|
8
|
-
function connect() {
|
9
|
-
if (!props.appCode || !sessionId.value)
|
10
|
-
return;
|
11
|
-
try {
|
12
|
-
isReady = false;
|
13
|
-
const {
|
14
|
-
appendMessage
|
15
|
-
} = data;
|
16
|
-
const protocol = window.location.protocol;
|
17
|
-
const host = window.location.host;
|
18
|
-
const wsProtocol = protocol === "https:" ? "wss:" : "ws:";
|
19
|
-
const wsUrl = `${wsProtocol}//${host}${ORIGIN}/${props.appCode}_${sessionId.value}`;
|
20
|
-
webSocket = new WebSocket(wsUrl);
|
21
|
-
webSocket.onopen = () => {
|
22
|
-
isReady = true;
|
23
|
-
console.log("0 websocket\u8FDE\u63A5\u6210\u529F ==>");
|
24
|
-
};
|
25
|
-
webSocket.onerror = () => console.log("WebSocket\u8FDE\u63A5\u5931\u8D25");
|
26
|
-
webSocket.onmessage = (event) => {
|
27
|
-
const {
|
28
|
-
data: data2
|
29
|
-
} = event || {};
|
30
|
-
if (!isValidJSON(data2))
|
31
|
-
return;
|
32
|
-
const json = JSON.parse(data2);
|
33
|
-
appendMessage(json || {});
|
34
|
-
};
|
35
|
-
(async function toTry(times = 0) {
|
36
|
-
if (times > 5) {
|
37
|
-
return console.log("websocket\u8FDE\u63A5\u5931\u8D25 ==>");
|
38
|
-
}
|
39
|
-
if (isReady) {
|
40
|
-
return console.log("websocket\u8FDE\u63A5\u6210\u529F ==>");
|
41
|
-
}
|
42
|
-
setTimeout(() => {
|
43
|
-
toTry(++times);
|
44
|
-
}, 100);
|
45
|
-
})();
|
46
|
-
} catch (error) {
|
47
|
-
console.log("error ==>", error);
|
48
|
-
}
|
49
|
-
}
|
50
|
-
watch(() => sessionId.value, (value) => {
|
51
|
-
if ((webSocket == null ? void 0 : webSocket.readyState) !== WebSocket.CLOSED) {
|
52
|
-
webSocket == null ? void 0 : webSocket.close();
|
53
|
-
}
|
54
|
-
webSocket = null;
|
55
|
-
isReady = false;
|
56
|
-
connect();
|
57
|
-
}, {
|
58
|
-
immediate: true
|
59
|
-
});
|
60
|
-
onBeforeUnmount(() => {
|
61
|
-
webSocket == null ? void 0 : webSocket.close();
|
62
|
-
webSocket = null;
|
63
|
-
});
|
64
|
-
}
|
65
|
-
|
66
|
-
export { useWebsocket };
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import { VNodeChild } from 'vue';
|
2
|
-
import { AnyObject } from '../../../../shared/types';
|
3
|
-
export type MessageItem = {
|
4
|
-
role: string;
|
5
|
-
contentType: 'json' | 'text';
|
6
|
-
content: AnyObject | string;
|
7
|
-
render?: () => VNodeChild;
|
8
|
-
[key: string]: any;
|
9
|
-
};
|
10
|
-
export type MessageList = Array<{
|
11
|
-
contents: MessageItem[];
|
12
|
-
msgId: string;
|
13
|
-
buttonType?: string;
|
14
|
-
}>;
|
15
|
-
export type QueryData = (props: {
|
16
|
-
content: string;
|
17
|
-
contentType: string;
|
18
|
-
command?: any;
|
19
|
-
prompt?: any;
|
20
|
-
patient?: any;
|
21
|
-
}) => Promise<{
|
22
|
-
contents: AnyObject[];
|
23
|
-
buttonType?: string;
|
24
|
-
[key: string]: any;
|
25
|
-
}>;
|
26
|
-
export type QueryRecord = (props: {
|
27
|
-
page: number;
|
28
|
-
}) => Promise<{
|
29
|
-
records: number;
|
30
|
-
rows: MessageList;
|
31
|
-
}>;
|
32
|
-
export type CommandItem = {
|
33
|
-
shortcutTitle: string;
|
34
|
-
shortcutId: string;
|
35
|
-
shortcutDescription?: string;
|
36
|
-
children?: CommandItem[];
|
37
|
-
[key: string]: any;
|
38
|
-
};
|
39
|
-
export type QueryPrompt = (props: {
|
40
|
-
keyword: string;
|
41
|
-
page: number;
|
42
|
-
}) => Promise<{
|
43
|
-
rows: AnyObject[];
|
44
|
-
records: number;
|
45
|
-
}>;
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { createDiscreteApi } from 'naive-ui';
|
2
|
-
|
3
|
-
const {
|
4
|
-
message: $message,
|
5
|
-
dialog: $dialog
|
6
|
-
} = createDiscreteApi(["message"]);
|
7
|
-
function isValidJSON(str) {
|
8
|
-
try {
|
9
|
-
if (!str)
|
10
|
-
return false;
|
11
|
-
JSON.parse(str);
|
12
|
-
return true;
|
13
|
-
} catch (e) {
|
14
|
-
return false;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
function formatType(str) {
|
18
|
-
const res = {
|
19
|
-
messageType: "",
|
20
|
-
json: {},
|
21
|
-
title: ""
|
22
|
-
};
|
23
|
-
const regexPattern = /##(.*?)##(.*)/;
|
24
|
-
const match = str.match(regexPattern);
|
25
|
-
if (match) {
|
26
|
-
const arr = str.split("##");
|
27
|
-
if (arr.length === 4) {
|
28
|
-
res.title = arr[2];
|
29
|
-
res.messageType = arr[1];
|
30
|
-
res.json = isValidJSON(arr[3]) ? JSON.parse(arr[2]) : {};
|
31
|
-
} else {
|
32
|
-
const enclosedString = match[1];
|
33
|
-
const remainingPart = match[2];
|
34
|
-
res.messageType = enclosedString;
|
35
|
-
res.json = isValidJSON(remainingPart) ? JSON.parse(remainingPart) : {};
|
36
|
-
}
|
37
|
-
}
|
38
|
-
return res;
|
39
|
-
}
|
40
|
-
|
41
|
-
export { $dialog, $message, formatType, isValidJSON };
|