af-mobile-client-vue3 1.4.53 → 1.4.55

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.
Files changed (58) hide show
  1. package/build/vite/optimize.ts +36 -36
  2. package/package.json +1 -1
  3. package/public/favicon.svg +4 -4
  4. package/scripts/verifyCommit.js +19 -19
  5. package/src/App.vue +14 -2
  6. package/src/components/common/MateChat/apiService.ts +285 -0
  7. package/src/components/common/MateChat/assets/035-avatar-13.svg +1 -0
  8. package/src/components/common/MateChat/components/MateChatContent.vue +281 -0
  9. package/src/components/common/MateChat/components/MateChatHeader.vue +298 -0
  10. package/src/components/common/MateChat/components/PasswordDialog.vue +97 -0
  11. package/src/components/common/MateChat/components/PromptList/PromptList.vue +189 -0
  12. package/src/components/common/MateChat/components/PromptList/index.ts +1 -0
  13. package/src/components/common/MateChat/composables/useChatHistoryCache.ts +117 -0
  14. package/src/components/common/MateChat/composables/useChatMessagesCache.ts +72 -0
  15. package/src/components/common/MateChat/composables/useMateChat.ts +372 -0
  16. package/src/components/common/MateChat/composables/usePasswordManager.ts +38 -0
  17. package/src/components/common/MateChat/index.vue +429 -0
  18. package/src/components/common/MateChat/types.ts +236 -0
  19. package/src/components/common/otherCharge/ChargePrintSelectorAndRemarks.vue +137 -137
  20. package/src/components/common/otherCharge/CodePayment.vue +357 -357
  21. package/src/components/common/otherCharge/FileUploader.vue +602 -602
  22. package/src/components/common/otherCharge/GridFileUploader.vue +846 -846
  23. package/src/components/common/otherCharge/PaymentMethodSelector.vue +202 -202
  24. package/src/components/common/otherCharge/PaymentMethodSelectorCard.vue +45 -45
  25. package/src/components/common/otherCharge/ReceiptModal.vue +273 -273
  26. package/src/components/common/otherCharge/index.ts +43 -43
  27. package/src/components/data/OtherCharge/OtherChargeItemModal.vue +547 -547
  28. package/src/components/data/UserDetail/types.ts +1 -1
  29. package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
  30. package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
  31. package/src/components/data/XTag/index.vue +10 -10
  32. package/src/components/layout/TabBarLayout/index.vue +40 -40
  33. package/src/hooks/useCommon.ts +9 -9
  34. package/src/plugins/AppData.ts +38 -38
  35. package/src/router/invoiceRoutes.ts +33 -33
  36. package/src/services/api/common.ts +109 -109
  37. package/src/services/api/manage.ts +8 -8
  38. package/src/services/api/search.ts +16 -16
  39. package/src/services/restTools.ts +56 -56
  40. package/src/utils/authority-utils.ts +84 -84
  41. package/src/utils/crypto.ts +39 -39
  42. package/src/utils/queryFormDefaultRangePicker.ts +57 -57
  43. package/src/utils/runEvalFunction.ts +13 -13
  44. package/src/views/component/EvaluateRecordView/index.vue +40 -40
  45. package/src/views/component/MateChat/MateChatView.vue +10 -254
  46. package/src/views/component/XCellDetailView/index.vue +217 -217
  47. package/src/views/component/XCellListView/index.vue +107 -138
  48. package/src/views/component/XFormGroupView/index.vue +78 -82
  49. package/src/views/component/XFormView/index.vue +41 -46
  50. package/src/views/component/XReportFormIframeView/index.vue +47 -47
  51. package/src/views/component/XReportFormView/index.vue +13 -13
  52. package/src/views/component/XSignatureView/index.vue +50 -50
  53. package/src/views/component/notice.vue +46 -46
  54. package/src/views/component/topNav.vue +36 -36
  55. package/src/views/invoiceShow/index.vue +61 -61
  56. package/src/views/user/login/index.vue +22 -22
  57. package/vite.config.ts +2 -1
  58. package/src/views/component/MateChat/apiService.ts +0 -104
@@ -1,254 +1,10 @@
1
- <script setup lang="ts">
2
- import liuliLogo from '@af-mobile-client-vue3/assets/img/component/liuli.png'
3
- // MateChat ai 对话相关
4
- import { showToast, Button as VanButton } from 'vant'
5
- import { ref } from 'vue'
6
- import { chatCompletions } from './apiService'
7
- import 'vant/es/image-preview/style'
8
-
9
- const description = [
10
- '我是【奥枫天然气公司】官方公众号专属 AI 客服小璃,可以为您提供专业、高效、易懂的天然气相关咨询服务。',
11
- ]
12
- const introPrompt = {
13
- direction: 'horizontal',
14
- list: [
15
- {
16
- value: 'howToPay',
17
- label: '如何缴纳燃气费?',
18
- iconConfig: { name: 'icon-info-o', color: '#5e7ce0' },
19
- desc: '了解线上缴费方式和操作步骤',
20
- },
21
- {
22
- value: 'howToRepair',
23
- label: '燃气故障如何报修?',
24
- iconConfig: { name: 'icon-star', color: 'rgb(255, 215, 0)' },
25
- desc: '遇到燃气问题时的处理流程',
26
- },
27
- {
28
- value: 'safetyTips',
29
- label: '安全使用注意事项',
30
- iconConfig: { name: 'icon-priority', color: '#3ac295' },
31
- desc: '了解燃气安全使用常识',
32
- },
33
- ],
34
- }
35
- const simplePrompt = [
36
- {
37
- value: 'howToPay',
38
- iconConfig: { name: 'icon-info-o', color: '#5e7ce0' },
39
- label: '如何缴费',
40
- },
41
- {
42
- value: 'howToRepair',
43
- iconConfig: { name: 'icon-star', color: 'rgb(255, 215, 0)' },
44
- label: '如何报修',
45
- },
46
- ]
47
- const startPage = ref(true)
48
- const inputValue = ref('')
49
-
50
- const messages = ref<any[]>([])
51
-
52
- function newConversation() {
53
- startPage.value = true
54
- messages.value = []
55
- }
56
-
57
- async function onSubmit(evt: string) {
58
- if (!evt.trim()) {
59
- return
60
- }
61
-
62
- inputValue.value = ''
63
- startPage.value = false
64
-
65
- // 用户发送消息
66
- messages.value.push({
67
- from: 'user',
68
- content: evt,
69
- })
70
-
71
- // 添加 loading 状态的 model 消息
72
- const loadingMessageIndex = messages.value.length
73
- messages.value.push({
74
- from: 'model',
75
- content: '',
76
- loading: true,
77
- })
78
-
79
- try {
80
- // 调用 API
81
- const response = await chatCompletions(evt)
82
-
83
- // 更新 model 消息内容
84
- if (response.choices && response.choices.length > 0) {
85
- const content = response.choices[0].message.content
86
-
87
- // 检测是否为转人工标识
88
- try {
89
- const parsedContent = JSON.parse(content)
90
- if (parsedContent.msgType === 'transfer') {
91
- // 移除 loading 消息
92
- messages.value.splice(loadingMessageIndex, 1)
93
- // 添加人工客服消息
94
- messages.value.push({
95
- from: 'service',
96
- content: '您好,客服xxx工号xxx为你服务',
97
- })
98
- }
99
- else {
100
- // 正常消息
101
- messages.value[loadingMessageIndex] = {
102
- from: 'model',
103
- content,
104
- loading: false,
105
- }
106
- }
107
- }
108
- catch {
109
- // 如果不是 JSON,按正常消息处理
110
- messages.value[loadingMessageIndex] = {
111
- from: 'model',
112
- content,
113
- loading: false,
114
- }
115
- }
116
- }
117
- else {
118
- throw new Error('响应数据格式错误')
119
- }
120
- }
121
- catch (error: any) {
122
- // 处理错误
123
- console.error('聊天请求失败:', error)
124
- messages.value[loadingMessageIndex] = {
125
- from: 'model',
126
- content: '抱歉,服务暂时不可用,请稍后再试。',
127
- loading: false,
128
- }
129
- showToast(error?.message || '请求失败,请稍后再试')
130
- }
131
- }
132
- </script>
133
-
134
- <template>
135
- <McLayout class="container">
136
- <McLayoutContent
137
- v-if="startPage"
138
- style="display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px"
139
- >
140
- <McIntroduction
141
- :logo-img="liuliLogo"
142
- title="小璃"
143
- sub-title="Hi,我是小璃"
144
- :description="description"
145
- />
146
- <McPrompt
147
- :list="introPrompt.list"
148
- :direction="introPrompt.direction"
149
- @item-click="onSubmit($event.label)"
150
- />
151
- </McLayoutContent>
152
- <McLayoutContent v-else class="content-container">
153
- <template v-for="(msg, idx) in messages" :key="idx">
154
- <McBubble
155
- v-if="msg.from === 'user'"
156
- :content="msg.content"
157
- align="right"
158
- :avatar-config="{ imgSrc: 'https://matechat.gitcode.com/png/demo/userAvatar.svg' }"
159
- />
160
- <McBubble
161
- v-else-if="msg.from === 'service'"
162
- :content="msg.content"
163
- :avatar-config="{ imgSrc: 'https://matechat.gitcode.com/png/demo/userAvatar.svg' }"
164
- />
165
- <McBubble v-else :content="msg.content" :avatar-config="{ imgSrc: liuliLogo }" :loading="msg.loading">
166
- <McMarkdownCard
167
- :content="msg.content" :typing="true"
168
- />
169
- </McBubble>
170
- </template>
171
- </McLayoutContent>
172
- <div class="shortcut" style="display: flex; align-items: center; gap: 8px">
173
- <McPrompt
174
- v-if="!startPage"
175
- :list="simplePrompt"
176
- direction="horizontal"
177
- class="shortcut-prompt"
178
- style="flex: 1"
179
- @item-click="onSubmit($event.label)"
180
- />
181
- <VanButton
182
- style="margin-left: auto"
183
- icon="add"
184
- title="新建对话"
185
- size="small"
186
- round
187
- @click="newConversation"
188
- />
189
- </div>
190
- <McLayoutSender>
191
- <McInput :value="inputValue" :autofocus="true" :max-length="2000" @change="(e) => (inputValue = e)" @submit="onSubmit" />
192
- </McLayoutSender>
193
- </McLayout>
194
- </template>
195
-
196
- <style>
197
- .container {
198
- width: 100%;
199
- height: 100vh;
200
- padding: 20px;
201
- gap: 8px;
202
- background: #fff;
203
- }
204
-
205
- .content-container {
206
- display: flex;
207
- flex-direction: column;
208
- gap: 8px;
209
- overflow: auto;
210
- }
211
-
212
- .input-foot-wrapper {
213
- display: flex;
214
- justify-content: space-between;
215
- align-items: center;
216
- width: 100%;
217
- height: 100%;
218
- margin-right: 8px;
219
-
220
- .input-foot-left {
221
- display: flex;
222
- align-items: center;
223
- gap: 8px;
224
-
225
- span {
226
- font-size: 14px;
227
- line-height: 18px;
228
- color: #252b3a;
229
- cursor: pointer;
230
- }
231
-
232
- .input-foot-dividing-line {
233
- width: 1px;
234
- height: 14px;
235
- background-color: #d7d8da;
236
- }
237
-
238
- .input-foot-maxlength {
239
- font-size: 14px;
240
- color: #71757f;
241
- }
242
- }
243
-
244
- .input-foot-right {
245
- .demo-button-content {
246
- font-size: 14px;
247
- }
248
-
249
- & > *:not(:first-child) {
250
- margin-left: 8px;
251
- }
252
- }
253
- }
254
- </style>
1
+ <script setup lang="ts">
2
+ import MateChat from '@af-mobile-client-vue3/components/common/MateChat/index.vue'
3
+
4
+ // 配置名称,从云端配置中心获取配置
5
+ const configName = '用户端AiChat配置'
6
+ </script>
7
+
8
+ <template>
9
+ <MateChat :config-name="configName" service-name="af-wechat" />
10
+ </template>