af-mobile-client-vue3 1.4.57 → 1.4.59

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/__dummy__ ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "cells": [],
3
+ "metadata": {
4
+ "language_info": {
5
+ "name": "python"
6
+ }
7
+ },
8
+ "nbformat": 4,
9
+ "nbformat_minor": 2
10
+ }
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.57",
4
+ "version": "1.4.59",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -145,7 +145,7 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
145
145
  <McBubble v-else :content="msg.content" :avatar-config="{ imgSrc: liuliLogo }" :loading="msg.loading">
146
146
  <McMarkdownCard
147
147
  :content="msg.content"
148
- :typing="!useStream"
148
+ :typing="msg.typing === true"
149
149
  />
150
150
  </McBubble>
151
151
  </template>
@@ -157,9 +157,10 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
157
157
  v-if="!startPage && simplePrompt && simplePrompt.length"
158
158
  :list="simplePrompt"
159
159
  direction="horizontal"
160
+ variant="shortcut"
160
161
  class="shortcut-prompt"
161
162
  style="flex: 1"
162
- @item-click="onSubmit($event.label)"
163
+ @item-click="onSubmit($event.desc)"
163
164
  />
164
165
  </div>
165
166
  <McLayoutSender>
@@ -18,6 +18,12 @@ interface PromptItem {
18
18
  interface Props {
19
19
  list: PromptItem[]
20
20
  direction?: 'horizontal' | 'vertical'
21
+ /**
22
+ * 展示风格
23
+ * - default: 默认卡片
24
+ * - shortcut: 底部快捷入口,间距和内边距更小
25
+ */
26
+ variant?: 'default' | 'shortcut'
21
27
  }
22
28
 
23
29
  // 定义 emits
@@ -27,6 +33,7 @@ interface Emits {
27
33
 
28
34
  const props = withDefaults(defineProps<Props>(), {
29
35
  direction: 'vertical',
36
+ variant: 'default',
30
37
  })
31
38
 
32
39
  const emit = defineEmits<Emits>()
@@ -48,7 +55,10 @@ function getVantIconName(iconName: string): string {
48
55
  </script>
49
56
 
50
57
  <template>
51
- <div class="prompt-list" :class="[`prompt-list--${direction}`]">
58
+ <div
59
+ class="prompt-list"
60
+ :class="[`prompt-list--${direction}`, { 'shortcut-prompt': props.variant === 'shortcut' }]"
61
+ >
52
62
  <div
53
63
  v-for="item in list"
54
64
  :key="item.value"
@@ -168,8 +178,10 @@ function getVantIconName(iconName: string): string {
168
178
  // 简化版样式(用于快捷提示)
169
179
  .shortcut-prompt {
170
180
  .prompt-item {
171
- padding: 10px 14px;
181
+ padding: 5px 10px;
172
182
  min-width: auto;
183
+ /* 简化模式下按内容自适应宽度,而不是平均分配 */
184
+ flex: 0 0 auto;
173
185
 
174
186
  &__icon {
175
187
  width: 24px;
@@ -179,6 +191,7 @@ function getVantIconName(iconName: string): string {
179
191
  &__label {
180
192
  font-size: 13px;
181
193
  margin-bottom: 0;
194
+ white-space: nowrap;
182
195
  }
183
196
 
184
197
  &__desc {
@@ -106,16 +106,18 @@ export function useMateChat(config: MateChatConfig) {
106
106
  ])
107
107
  }
108
108
  else {
109
- // 正常消息:替换 loading 为模型回复
109
+ // 正常消息:替换 loading 为模型回复,并标记为打字机消息
110
110
  messages.value[loadingMessageIndex] = {
111
111
  from: 'model',
112
112
  content: result.content,
113
113
  loading: false,
114
+ typing: true,
114
115
  }
115
116
  // 更新缓存:追加用户消息和模型回复
116
117
  appendMessages(chatId.value, [
117
118
  { from: 'user', content: evt },
118
- { from: 'model', content: result.content, loading: false },
119
+ // 缓存中仅用于渲染,不做二次打字机动画,这里也保留 typing 标记,方便后续扩展
120
+ { from: 'model', content: result.content, loading: false, typing: false },
119
121
  ])
120
122
  }
121
123
  }
@@ -209,9 +211,10 @@ export function useMateChat(config: MateChatConfig) {
209
211
 
210
212
  // 普通消息:结束 loading,按完整文本渲染并写入缓存
211
213
  msg.loading = false
214
+ msg.typing = true
212
215
  appendMessages(chatId.value, [
213
216
  { from: 'user', content: evt },
214
- { from: 'model', content: msg.content, loading: false },
217
+ { from: 'model', content: msg.content, loading: false, typing: false },
215
218
  ])
216
219
  },
217
220
  onError(error) {
@@ -254,8 +257,11 @@ export function useMateChat(config: MateChatConfig) {
254
257
  // 先检查缓存
255
258
  const cachedMessages = getCachedMessages(targetChatId)
256
259
  if (cachedMessages) {
257
- // 使用缓存数据
258
- messages.value = cachedMessages
260
+ // 使用缓存数据,历史消息不需要打字机效果
261
+ messages.value = cachedMessages.map(msg => ({
262
+ ...msg,
263
+ typing: false,
264
+ }))
259
265
  chatId.value = targetChatId
260
266
  startPage.value = false
261
267
  return
@@ -322,6 +328,8 @@ export function useMateChat(config: MateChatConfig) {
322
328
  from: 'model',
323
329
  content,
324
330
  loading: false,
331
+ // 历史消息不需要打字机效果
332
+ typing: false,
325
333
  })
326
334
  }
327
335
  }
@@ -238,4 +238,10 @@ export interface MateChatMessage {
238
238
  from: 'user' | 'model' | 'service'
239
239
  content: string
240
240
  loading?: boolean
241
+ /**
242
+ * 是否启用打字机效果
243
+ * - true: 启用打字机
244
+ * - false 或未定义: 不启用打字机
245
+ */
246
+ typing?: boolean
241
247
  }