af-mobile-client-vue3 1.4.55 → 1.4.56

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.4.55",
4
+ "version": "1.4.56",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -186,7 +186,7 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
186
186
  .chat-card {
187
187
  width: 100%;
188
188
  max-width: 1200px;
189
- height: calc(100vh - 40px);
189
+ height: calc(100% - 40px);
190
190
  background: #ffffff;
191
191
  border-radius: 24px;
192
192
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
@@ -205,7 +205,7 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
205
205
  /* 移动端适配 */
206
206
  @media (max-width: 768px) {
207
207
  .chat-card {
208
- height: calc(100vh - 16px);
208
+ height: calc(100% - 16px);
209
209
  border-radius: 16px;
210
210
  padding: 8px;
211
211
  }
@@ -41,6 +41,21 @@ const finalLoading = computed(() => forceLoading.value || isLoading.value || !!c
41
41
  // 当前使用的配置
42
42
  const currentConfig = ref<MateChatConfig | null>(null)
43
43
 
44
+ const defaultBackgroundGradient = 'background: linear-gradient(to bottom, #d0c9ff 0%, #e6d6f0 8%, #f1dbea 12%, #c8dcfb 40%, #abc6f6 60%, #87aefe 90%)'
45
+ // 琉璃配色
46
+ // background: linear-gradient(to bottom, #a8f0ed 0%, #a8e6cf 8%, #c5b3ff 12%, #e0b3ff 40%, #fff4b8 60%, #ffb8d1 90%);
47
+ // 紫罗兰配色
48
+ // background: linear-gradient(to bottom, #d0c9ff 0%, #e6d6f0 8%, #f1dbea 12%, #c8dcfb 40%, #abc6f6 60%, #87aefe 90%);
49
+ // 蓝白配色
50
+ // 'linear-gradient(to bottom, #1c57e0 0%, #3b82f6 20%, #60a5fa 40%, #93c5fd 60%, #dbeafe 80%, #ffffff 100%)'
51
+ // 计算背景渐变样式
52
+ const backgroundStyle = computed(() => {
53
+ const gradient = currentConfig.value?.backgroundGradient || defaultBackgroundGradient
54
+ return {
55
+ background: gradient,
56
+ }
57
+ })
58
+
44
59
  // 存储原始配置数据
45
60
  const rawConfigs = ref<MateChatConfigs | MateChatConfig | null>(null)
46
61
 
@@ -305,7 +320,7 @@ onMounted(() => {
305
320
  </script>
306
321
 
307
322
  <template>
308
- <div id="mate-chat-view">
323
+ <div id="mate-chat-view" :style="backgroundStyle">
309
324
  <!-- 密码输入对话框 -->
310
325
  <PasswordDialog
311
326
  ref="passwordDialogRef"
@@ -351,9 +366,8 @@ onMounted(() => {
351
366
  #mate-chat-view {
352
367
  /* 外层渐变背景容器 */
353
368
  width: 100%;
354
- min-height: 100vh;
355
- background: linear-gradient(to bottom, #a8f0ed 0%, #a8e6cf 8%, #c5b3ff 12%, #e0b3ff 40%, #fff4b8 60%, #ffb8d1 90%);
356
- /* background: linear-gradient(to bottom, #d0c9ff 0%, #e6d6f0 8%, #f1dbea 12%, #c8dcfb 40%, #abc6f6 60%, #87aefe 90%); */
369
+ min-height: 100%;
370
+ /* 背景色通过 :style 绑定从配置中获取 */
357
371
  padding: 20px;
358
372
  display: flex;
359
373
  justify-content: center;
@@ -381,7 +395,7 @@ onMounted(() => {
381
395
 
382
396
  /* 移动端适配 */
383
397
  @media (max-width: 768px) {
384
- height: calc(100vh - 16px);
398
+ height: calc(100% - 18px);
385
399
  border-radius: 16px;
386
400
  padding: 8px;
387
401
  }
@@ -1,236 +1,241 @@
1
- /**
2
- * MateChat 提示项接口
3
- */
4
- export interface MateChatPromptItem {
5
- value: string
6
- label: string
7
- iconConfig?: {
8
- name: string
9
- color?: string
10
- }
11
- desc?: string
12
- }
13
-
14
- /**
15
- * MateChat 配置接口
16
- */
17
- export interface MateChatConfig {
18
- /**
19
- * 可选密码,如果存在则需要密码验证
20
- */
21
- password?: string
22
- /**
23
- * FastGPT 应用 ID
24
- */
25
- appId: string
26
- /**
27
- * FastGPT API Key
28
- */
29
- appKey: string
30
- /**
31
- * 介绍文案
32
- */
33
- description: string[]
34
- /**
35
- * 首屏推荐问题列表
36
- */
37
- introPrompt: MateChatPromptItem[]
38
- /**
39
- * 底部快捷问题列表
40
- */
41
- simplePrompt: MateChatPromptItem[]
42
- /**
43
- * 客服名称
44
- */
45
- serviceName: string
46
- /**
47
- * 是否使用流式对话
48
- */
49
- useStream: boolean
50
- }
51
-
52
- /**
53
- * 配置中心返回的多个配置对象
54
- * key 为配置名称,value 为 MateChatConfig
55
- */
56
- export type MateChatConfigs = Record<string, MateChatConfig>
57
-
58
- // ==================== API 相关类型定义 ====================
59
-
60
- /**
61
- * 聊天消息接口
62
- */
63
- export interface ChatMessage {
64
- role: 'user' | 'assistant' | 'system'
65
- content: string
66
- }
67
-
68
- /**
69
- * 聊天请求参数接口
70
- */
71
- export interface ChatCompletionsRequest {
72
- chatId: string
73
- stream: boolean
74
- detail: boolean
75
- messages: ChatMessage[]
76
- customUid?: string
77
- }
78
-
79
- /**
80
- * 聊天响应使用情况接口
81
- */
82
- export interface ChatUsage {
83
- prompt_tokens: number
84
- completion_tokens: number
85
- total_tokens: number
86
- }
87
-
88
- /**
89
- * 聊天响应选择项接口
90
- */
91
- export interface ChatChoice {
92
- message: {
93
- role: 'assistant'
94
- content: string
95
- }
96
- finish_reason: string
97
- index: number
98
- }
99
-
100
- /**
101
- * 聊天响应接口
102
- */
103
- export interface ChatCompletionsResponse {
104
- id: string
105
- model: string
106
- usage: ChatUsage
107
- choices: ChatChoice[]
108
- }
109
-
110
- /**
111
- * 业务层聊天结果
112
- */
113
- export interface ChatBizResult {
114
- /**
115
- * normal: 普通回复
116
- * transfer: 转人工
117
- */
118
- type: 'normal' | 'transfer'
119
- /**
120
- * 大模型原始返回内容
121
- */
122
- content: string
123
- }
124
-
125
- /**
126
- * 流式对话回调
127
- */
128
- export interface ChatStreamCallbacks {
129
- /**
130
- * 每次收到 FastGPT SSE 的增量内容时触发
131
- */
132
- onMessage?: (chunk: string) => void
133
- /**
134
- * 流结束时触发(包括收到 [DONE] 或正常读取结束)
135
- */
136
- onComplete?: () => void
137
- /**
138
- * 请求或解析发生异常时触发
139
- */
140
- onError?: (error: unknown) => void
141
- }
142
-
143
- /**
144
- * 历史会话项接口
145
- */
146
- export interface ChatHistoryItem {
147
- chatId: string
148
- updateTime: string
149
- appId: string
150
- customTitle: string
151
- title: string
152
- top: boolean
153
- [key: string]: any
154
- }
155
-
156
- /**
157
- * 历史会话查询请求参数接口
158
- */
159
- export interface GetHistoriesRequest {
160
- appId: string
161
- outLinkUid: string
162
- offset: number
163
- pageSize: number
164
- source: string
165
- }
166
-
167
- /**
168
- * 历史会话查询响应接口
169
- */
170
- export interface GetHistoriesResponse {
171
- code: number
172
- statusText: string
173
- message: string
174
- data: {
175
- list: ChatHistoryItem[]
176
- total: number
177
- }
178
- }
179
-
180
- /**
181
- * 历史会话记录项接口
182
- */
183
- export interface ChatRecordItem {
184
- _id: string
185
- dataId: string
186
- hideInUI: boolean
187
- obj: 'Human' | 'AI'
188
- value: Array<{
189
- type: string
190
- text: {
191
- content: string
192
- }
193
- }>
194
- customFeedbacks: any[]
195
- time: string
196
- durationSeconds?: number
197
- llmModuleAccount?: number
198
- totalQuoteList?: any[]
199
- historyPreviewLength?: number
200
- [key: string]: any
201
- }
202
-
203
- /**
204
- * 获取历史会话记录请求参数接口
205
- */
206
- export interface GetPaginationRecordsRequest {
207
- appId: string
208
- chatId: string
209
- offset: number
210
- pageSize: number
211
- loadCustomFeedbacks: boolean
212
- }
213
-
214
- /**
215
- * 获取历史会话记录响应接口
216
- */
217
- export interface GetPaginationRecordsResponse {
218
- code: number
219
- statusText: string
220
- message: string
221
- data: {
222
- list: ChatRecordItem[]
223
- total: number
224
- }
225
- }
226
-
227
- // ==================== MateChat 组件内部类型 ====================
228
-
229
- /**
230
- * MateChat 组件内部使用的消息结构
231
- */
232
- export interface MateChatMessage {
233
- from: 'user' | 'model' | 'service'
234
- content: string
235
- loading?: boolean
236
- }
1
+ /**
2
+ * MateChat 提示项接口
3
+ */
4
+ export interface MateChatPromptItem {
5
+ value: string
6
+ label: string
7
+ iconConfig?: {
8
+ name: string
9
+ color?: string
10
+ }
11
+ desc?: string
12
+ }
13
+
14
+ /**
15
+ * MateChat 配置接口
16
+ */
17
+ export interface MateChatConfig {
18
+ /**
19
+ * 可选密码,如果存在则需要密码验证
20
+ */
21
+ password?: string
22
+ /**
23
+ * FastGPT 应用 ID
24
+ */
25
+ appId: string
26
+ /**
27
+ * FastGPT API Key
28
+ */
29
+ appKey: string
30
+ /**
31
+ * 介绍文案
32
+ */
33
+ description: string[]
34
+ /**
35
+ * 首屏推荐问题列表
36
+ */
37
+ introPrompt: MateChatPromptItem[]
38
+ /**
39
+ * 底部快捷问题列表
40
+ */
41
+ simplePrompt: MateChatPromptItem[]
42
+ /**
43
+ * 客服名称
44
+ */
45
+ serviceName: string
46
+ /**
47
+ * 是否使用流式对话
48
+ */
49
+ useStream: boolean
50
+ /**
51
+ * 背景渐变颜色(CSS linear-gradient 字符串)
52
+ * 如果不提供,使用默认蓝白渐变
53
+ */
54
+ backgroundGradient?: string
55
+ }
56
+
57
+ /**
58
+ * 配置中心返回的多个配置对象
59
+ * key 为配置名称,value 为 MateChatConfig
60
+ */
61
+ export type MateChatConfigs = Record<string, MateChatConfig>
62
+
63
+ // ==================== API 相关类型定义 ====================
64
+
65
+ /**
66
+ * 聊天消息接口
67
+ */
68
+ export interface ChatMessage {
69
+ role: 'user' | 'assistant' | 'system'
70
+ content: string
71
+ }
72
+
73
+ /**
74
+ * 聊天请求参数接口
75
+ */
76
+ export interface ChatCompletionsRequest {
77
+ chatId: string
78
+ stream: boolean
79
+ detail: boolean
80
+ messages: ChatMessage[]
81
+ customUid?: string
82
+ }
83
+
84
+ /**
85
+ * 聊天响应使用情况接口
86
+ */
87
+ export interface ChatUsage {
88
+ prompt_tokens: number
89
+ completion_tokens: number
90
+ total_tokens: number
91
+ }
92
+
93
+ /**
94
+ * 聊天响应选择项接口
95
+ */
96
+ export interface ChatChoice {
97
+ message: {
98
+ role: 'assistant'
99
+ content: string
100
+ }
101
+ finish_reason: string
102
+ index: number
103
+ }
104
+
105
+ /**
106
+ * 聊天响应接口
107
+ */
108
+ export interface ChatCompletionsResponse {
109
+ id: string
110
+ model: string
111
+ usage: ChatUsage
112
+ choices: ChatChoice[]
113
+ }
114
+
115
+ /**
116
+ * 业务层聊天结果
117
+ */
118
+ export interface ChatBizResult {
119
+ /**
120
+ * normal: 普通回复
121
+ * transfer: 转人工
122
+ */
123
+ type: 'normal' | 'transfer'
124
+ /**
125
+ * 大模型原始返回内容
126
+ */
127
+ content: string
128
+ }
129
+
130
+ /**
131
+ * 流式对话回调
132
+ */
133
+ export interface ChatStreamCallbacks {
134
+ /**
135
+ * 每次收到 FastGPT SSE 的增量内容时触发
136
+ */
137
+ onMessage?: (chunk: string) => void
138
+ /**
139
+ * 流结束时触发(包括收到 [DONE] 或正常读取结束)
140
+ */
141
+ onComplete?: () => void
142
+ /**
143
+ * 请求或解析发生异常时触发
144
+ */
145
+ onError?: (error: unknown) => void
146
+ }
147
+
148
+ /**
149
+ * 历史会话项接口
150
+ */
151
+ export interface ChatHistoryItem {
152
+ chatId: string
153
+ updateTime: string
154
+ appId: string
155
+ customTitle: string
156
+ title: string
157
+ top: boolean
158
+ [key: string]: any
159
+ }
160
+
161
+ /**
162
+ * 历史会话查询请求参数接口
163
+ */
164
+ export interface GetHistoriesRequest {
165
+ appId: string
166
+ outLinkUid: string
167
+ offset: number
168
+ pageSize: number
169
+ source: string
170
+ }
171
+
172
+ /**
173
+ * 历史会话查询响应接口
174
+ */
175
+ export interface GetHistoriesResponse {
176
+ code: number
177
+ statusText: string
178
+ message: string
179
+ data: {
180
+ list: ChatHistoryItem[]
181
+ total: number
182
+ }
183
+ }
184
+
185
+ /**
186
+ * 历史会话记录项接口
187
+ */
188
+ export interface ChatRecordItem {
189
+ _id: string
190
+ dataId: string
191
+ hideInUI: boolean
192
+ obj: 'Human' | 'AI'
193
+ value: Array<{
194
+ type: string
195
+ text: {
196
+ content: string
197
+ }
198
+ }>
199
+ customFeedbacks: any[]
200
+ time: string
201
+ durationSeconds?: number
202
+ llmModuleAccount?: number
203
+ totalQuoteList?: any[]
204
+ historyPreviewLength?: number
205
+ [key: string]: any
206
+ }
207
+
208
+ /**
209
+ * 获取历史会话记录请求参数接口
210
+ */
211
+ export interface GetPaginationRecordsRequest {
212
+ appId: string
213
+ chatId: string
214
+ offset: number
215
+ pageSize: number
216
+ loadCustomFeedbacks: boolean
217
+ }
218
+
219
+ /**
220
+ * 获取历史会话记录响应接口
221
+ */
222
+ export interface GetPaginationRecordsResponse {
223
+ code: number
224
+ statusText: string
225
+ message: string
226
+ data: {
227
+ list: ChatRecordItem[]
228
+ total: number
229
+ }
230
+ }
231
+
232
+ // ==================== MateChat 组件内部类型 ====================
233
+
234
+ /**
235
+ * MateChat 组件内部使用的消息结构
236
+ */
237
+ export interface MateChatMessage {
238
+ from: 'user' | 'model' | 'service'
239
+ content: string
240
+ loading?: boolean
241
+ }