af-mobile-client-vue3 1.4.80 → 1.4.82

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.
@@ -0,0 +1,84 @@
1
+ # list of languages for which language servers are started; choose from:
2
+ # al bash clojure cpp csharp csharp_omnisharp
3
+ # dart elixir elm erlang fortran go
4
+ # haskell java julia kotlin lua markdown
5
+ # nix perl php python python_jedi r
6
+ # rego ruby ruby_solargraph rust scala swift
7
+ # terraform typescript typescript_vts yaml zig
8
+ # Note:
9
+ # - For C, use cpp
10
+ # - For JavaScript, use typescript
11
+ # Special requirements:
12
+ # - csharp: Requires the presence of a .sln file in the project folder.
13
+ # When using multiple languages, the first language server that supports a given file will be used for that file.
14
+ # The first language is the default language and the respective language server will be used as a fallback.
15
+ # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
16
+ languages:
17
+ - vue
18
+
19
+ # the encoding used by text files in the project
20
+ # For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
21
+ encoding: utf-8
22
+
23
+ # whether to use the project's gitignore file to ignore files
24
+ # Added on 2025-04-07
25
+ ignore_all_files_in_gitignore: true
26
+
27
+ # list of additional paths to ignore
28
+ # same syntax as gitignore, so you can use * and **
29
+ # Was previously called `ignored_dirs`, please update your config if you are using that.
30
+ # Added (renamed) on 2025-04-07
31
+ ignored_paths: []
32
+
33
+ # whether the project is in read-only mode
34
+ # If set to true, all editing tools will be disabled and attempts to use them will result in an error
35
+ # Added on 2025-04-18
36
+ read_only: false
37
+
38
+ # list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
39
+ # Below is the complete list of tools for convenience.
40
+ # To make sure you have the latest list of tools, and to view their descriptions,
41
+ # execute `uv run scripts/print_tool_overview.py`.
42
+ #
43
+ # * `activate_project`: Activates a project by name.
44
+ # * `check_onboarding_performed`: Checks whether project onboarding was already performed.
45
+ # * `create_text_file`: Creates/overwrites a file in the project directory.
46
+ # * `delete_lines`: Deletes a range of lines within a file.
47
+ # * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
48
+ # * `execute_shell_command`: Executes a shell command.
49
+ # * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
50
+ # * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
51
+ # * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
52
+ # * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
53
+ # * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
54
+ # * `initial_instructions`: Gets the initial instructions for the current project.
55
+ # Should only be used in settings where the system prompt cannot be set,
56
+ # e.g. in clients you have no control over, like Claude Desktop.
57
+ # * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
58
+ # * `insert_at_line`: Inserts content at a given line in a file.
59
+ # * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
60
+ # * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
61
+ # * `list_memories`: Lists memories in Serena's project-specific memory store.
62
+ # * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
63
+ # * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
64
+ # * `read_file`: Reads a file within the project directory.
65
+ # * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
66
+ # * `remove_project`: Removes a project from the Serena configuration.
67
+ # * `replace_lines`: Replaces a range of lines within a file with new content.
68
+ # * `replace_symbol_body`: Replaces the full definition of a symbol.
69
+ # * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
70
+ # * `search_for_pattern`: Performs a search for a pattern in the project.
71
+ # * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
72
+ # * `switch_modes`: Activates modes by providing a list of their names
73
+ # * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
74
+ # * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
75
+ # * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
76
+ # * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
77
+ excluded_tools: []
78
+
79
+ # initial prompt for the project. It will always be given to the LLM upon activating the project
80
+ # (contrary to the memories, which are loaded on demand).
81
+ initial_prompt: ''
82
+
83
+ project_name: af-mobile-client-vue3
84
+ included_optional_tools: []
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.80",
4
+ "version": "1.4.82",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -29,6 +29,7 @@
29
29
  "@vant/touch-emulator": "^1.4.0",
30
30
  "@vant/use": "^1.6.0",
31
31
  "@vueuse/core": "^13.5.0",
32
+ "mermaid": "11.12.2",
32
33
  "axios": "^1.10.0",
33
34
  "bcryptjs": "^2.4.3",
34
35
  "crypto-js": "^4.2.0",
package/src/App.vue CHANGED
@@ -55,7 +55,7 @@ const mode = computed(() => {
55
55
  </script>
56
56
 
57
57
  <template>
58
- <VanConfigProvider :theme="mode" theme-vars-scope="global">
58
+ <VanConfigProvider :theme="mode" theme-vars-scope="global" class="app-container">
59
59
  <NavBar />
60
60
  <router-view v-slot="{ Component }">
61
61
  <section class="app-wrapper">
@@ -70,6 +70,14 @@ const mode = computed(() => {
70
70
 
71
71
  <style>
72
72
  @import './font-style/font.css';
73
+ html,
74
+ body,
75
+ #system-app {
76
+ height: 100%;
77
+ margin: 0;
78
+ padding: 0;
79
+ overflow: hidden;
80
+ }
73
81
  body {
74
82
  font-family:
75
83
  Inter,
@@ -97,15 +105,27 @@ input[type='password']::-ms-clear {
97
105
  </style>
98
106
 
99
107
  <style scoped>
100
- .app-wrapper {
108
+ .app-container {
109
+ display: flex;
110
+ flex-direction: column;
111
+ height: 100vh; /* 使用 vh 确保在移动端浏览器中也能撑满 */
112
+ height: 100dvh; /* 使用动态视口高度,处理移动端工具栏遮挡 */
101
113
  width: 100%;
102
- position: relative;
103
114
  }
104
- /*
105
- // 此处注释的原因是 height: 100vh 会触发vue的滚动条问题
115
+
106
116
  .app-wrapper {
107
117
  width: 100%;
108
- height: 100vh;
109
118
  position: relative;
110
- }*/
119
+ flex: 1;
120
+ min-height: 0; /* 关键:允许 flex 项目收缩,防止溢出 */
121
+ overflow-y: auto;
122
+ display: flex;
123
+ flex-direction: column;
124
+ }
125
+
126
+ .app-wrapper > :deep(*) {
127
+ flex: 1;
128
+ display: flex;
129
+ flex-direction: column;
130
+ }
111
131
  </style>
@@ -7,6 +7,7 @@ import { PromptList } from '@af-mobile-client-vue3/components/common/MateChat/co
7
7
  import { useMateChat } from '@af-mobile-client-vue3/components/common/MateChat/composables/useMateChat'
8
8
  import { useDebounceFn } from '@vueuse/core'
9
9
  import { computed, nextTick, ref, watch } from 'vue'
10
+ import { useRouter } from 'vue-router'
10
11
  import 'vant/es/image-preview/style'
11
12
 
12
13
  interface MateChatContentProps {
@@ -27,6 +28,7 @@ const useStream = computed(() => props.config.useStream || false)
27
28
 
28
29
  // 初始化 useMateChat
29
30
  const mateChatInstance = useMateChat(props.config)
31
+ const router = useRouter()
30
32
 
31
33
  const startPage = computed(() => mateChatInstance.startPage.value)
32
34
  const inputValue = computed({
@@ -38,6 +40,21 @@ const inputValue = computed({
38
40
  const messages = computed(() => mateChatInstance.messages.value)
39
41
  const newConversation = () => mateChatInstance.newConversation()
40
42
  const onSubmit = (evt: string) => mateChatInstance.onSubmit(evt)
43
+ function onCardClick(msg: any) {
44
+ if (msg?.action?.type === 'route' && msg?.action?.path) {
45
+ router.push(msg.action.path)
46
+ }
47
+ }
48
+ function parseCard(content: string) {
49
+ try {
50
+ const data = JSON.parse(content)
51
+ if (data && data.msgType === 'card') {
52
+ return data
53
+ }
54
+ }
55
+ catch {}
56
+ return null
57
+ }
41
58
 
42
59
  // 消息容器的 ref
43
60
  const messageContainerRef = ref<HTMLElement | null>(null)
@@ -144,9 +161,19 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
144
161
  />
145
162
  <McBubble v-else :content="msg.content" :avatar-config="{ imgSrc: liuliLogo }" :loading="msg.loading">
146
163
  <McMarkdownCard
147
- :content="msg.content"
164
+ :content="parseCard(msg.content) ? (parseCard(msg.content).msg || '') : msg.content"
148
165
  :typing="msg.typing === true"
149
166
  />
167
+ <template v-if="parseCard(msg.content)">
168
+ <div class="mc-card" @click="onCardClick(parseCard(msg.content))">
169
+ <div class="mc-card-title">
170
+ {{ parseCard(msg.content)?.title }}
171
+ </div>
172
+ <div class="mc-card-desc">
173
+ {{ parseCard(msg.content)?.desc }}
174
+ </div>
175
+ </div>
176
+ </template>
150
177
  </McBubble>
151
178
  </template>
152
179
  <!-- 滚动锚点 -->
@@ -217,6 +244,29 @@ function handleSelectSession(session: { chatId: string, title: string, lastTime:
217
244
  flex-shrink: 0;
218
245
  }
219
246
 
247
+ .mc-card {
248
+ display: flex;
249
+ flex-direction: column;
250
+ gap: 4px;
251
+ padding: 10px 12px;
252
+ border: 1px solid #e5e6eb;
253
+ border-radius: 8px;
254
+ background-color: #fff;
255
+ cursor: pointer;
256
+ }
257
+ .mc-card:hover {
258
+ background-color: #f7f8fa;
259
+ }
260
+ .mc-card-title {
261
+ font-size: 14px;
262
+ font-weight: 600;
263
+ color: #1d2129;
264
+ }
265
+ .mc-card-desc {
266
+ font-size: 12px;
267
+ color: #86909c;
268
+ }
269
+
220
270
  .input-foot-wrapper {
221
271
  display: flex;
222
272
  justify-content: space-between;
@@ -143,12 +143,12 @@ export function useMateChat(config: MateChatConfig) {
143
143
  // 流式:使用 FastGPT SSE,增量更新最后一条模型消息内容
144
144
  // 规则:
145
145
  // 1)每次收到 chunk 都立即累加到 msg.content,保证实时流式效果
146
- // 2)在累加后的内容上做一次“是否为转人工 JSON 消息”的前缀粗判:以 {"msgType 开头
147
- // 3)如果判断为转人工,则保持 loading 状态,等待 onComplete 再统一处理整条消息
148
- // 4)如果判断不是转人工,则当作普通文本流式展示,onComplete 时仅结束 loading
149
- const transferPrefix = '{"msgType'
150
- let checkedTransfer = false // 是否已经做过类型判定
151
- let isTransferMessage = false // 是否判定为转人工消息
146
+ // 2)在累加后的内容上做一次“是否为 JSON 消息”的前缀粗判:以 {"msgType 开头
147
+ // 3)如果是判断为 JSON(可能是转人工或卡片),则保持 loading 状态,等待 onComplete 再统一处理整条消息
148
+ // 4)如果判断不是 JSON,则当作普通文本流式展示,onComplete 时仅结束 loading
149
+ const jsonPrefix = '{"msgType'
150
+ let checkedType = false // 是否已经做过类型判定
151
+ let isJsonMessage = false // 是否判定为 JSON 消息
152
152
 
153
153
  const callbacks: ChatStreamCallbacks = {
154
154
  onMessage(chunk) {
@@ -160,23 +160,23 @@ export function useMateChat(config: MateChatConfig) {
160
160
  msg.content += chunk
161
161
 
162
162
  // 2. 如果还没有做过类型判定,基于当前累积内容做一次前缀粗判
163
- if (!checkedTransfer) {
163
+ if (!checkedType) {
164
164
  const trimmed = msg.content.trimStart()
165
165
  // 内容太短,无法判断,继续等待更多 chunk
166
- if (!trimmed || trimmed.length < transferPrefix.length) {
166
+ if (!trimmed || trimmed.length < jsonPrefix.length) {
167
167
  return
168
168
  }
169
169
 
170
- if (trimmed.startsWith(transferPrefix)) {
171
- // 以 {"msgType 开头,标记为“可能是转人工消息”
172
- isTransferMessage = true
170
+ if (trimmed.startsWith(jsonPrefix)) {
171
+ // 以 {"msgType 开头,标记为“可能是 JSON 消息”
172
+ isJsonMessage = true
173
173
  }
174
174
  else {
175
175
  // 不以 {"msgType 开头,当作普通文本处理
176
- isTransferMessage = false
176
+ isJsonMessage = false
177
177
  msg.loading = false
178
178
  }
179
- checkedTransfer = true
179
+ checkedType = true
180
180
  }
181
181
  },
182
182
  onComplete() {
@@ -185,10 +185,11 @@ export function useMateChat(config: MateChatConfig) {
185
185
  return
186
186
  }
187
187
  // 根据前面判定结果决定如何处理整条消息
188
- if (isTransferMessage) {
189
- // 尝试按 JSON 解析,判断是否真的是转人工指令
188
+ if (isJsonMessage) {
189
+ // 尝试按 JSON 解析
190
190
  try {
191
- const parsed = JSON.parse(msg.content.trim())
191
+ const contentText = msg.content.trim()
192
+ const parsed = JSON.parse(contentText)
192
193
  if (parsed && parsed.msgType === 'transfer') {
193
194
  // 确认为转人工:移除模型气泡,插入客服气泡
194
195
  messages.value.splice(loadingMessageIndex, 1)
@@ -203,15 +204,23 @@ export function useMateChat(config: MateChatConfig) {
203
204
  ])
204
205
  return
205
206
  }
207
+ // 如果是 card,不进入转人工逻辑,保持为普通模型回复气泡,UI 层会解析 content 展示卡片
208
+ msg.loading = false
209
+ msg.typing = false // JSON 卡片不需要打字机效果
206
210
  }
207
211
  catch {
208
212
  // 解析失败则回退为普通文本处理
213
+ msg.loading = false
214
+ msg.typing = true
209
215
  }
210
216
  }
217
+ else {
218
+ // 普通消息:结束 loading
219
+ msg.loading = false
220
+ msg.typing = true
221
+ }
211
222
 
212
- // 普通消息:结束 loading,按完整文本渲染并写入缓存
213
- msg.loading = false
214
- msg.typing = true
223
+ // 统一更新缓存
215
224
  appendMessages(chatId.value, [
216
225
  { from: 'user', content: evt },
217
226
  { from: 'model', content: msg.content, loading: false, typing: false },
@@ -1,137 +1,137 @@
1
- <script setup lang="ts">
2
- import CardContainer from '@af-mobile-client-vue3/components/data/CardContainer/CardContainer.vue'
3
- import CardHeader from '@af-mobile-client-vue3/components/data/CardContainer/CardHeader.vue'
4
- import {
5
- Field as VanField,
6
- Picker as VanPicker,
7
- Popup as VanPopup,
8
- } from 'vant'
9
- import { ref, watch } from 'vue'
10
-
11
- const props = defineProps<{
12
- modelValue: string
13
- remarks: string
14
- }>()
15
-
16
- const emit = defineEmits<{
17
- (e: 'update:modelValue', value: string): void
18
- (e: 'update:remarks', value: string): void
19
- }>()
20
-
21
- const printOptions = [
22
- { text: '电子发票', value: '电子发票' },
23
- { text: '普通收据', value: '普通收据' },
24
- { text: '两者都需要', value: 'both' },
25
- ]
26
-
27
- const selectedOption = ref(getOptionText(props.modelValue))
28
- const remarks = ref(props.remarks)
29
- const showPicker = ref(false)
30
-
31
- function getOptionText(value: string): string {
32
- const option = printOptions.find(opt => opt.value === value)
33
- return option ? option.text : ''
34
- }
35
-
36
- function onConfirm({ selectedValues }: { selectedValues: string[] }) {
37
- selectedOption.value = selectedValues[0]
38
- emit('update:modelValue', selectedValues[0])
39
- showPicker.value = false
40
- }
41
-
42
- watch(() => remarks.value, (newValue) => {
43
- emit('update:remarks', newValue)
44
- })
45
-
46
- // 当从外部更新值时更新内部状态
47
- watch(() => props.modelValue, (newValue) => {
48
- selectedOption.value = getOptionText(newValue)
49
- })
50
-
51
- watch(() => props.remarks, (newValue) => {
52
- remarks.value = newValue
53
- })
54
- </script>
55
-
56
- <template>
57
- <CardContainer class="charge-print-and-remarks">
58
- <CardHeader title="打印及备注" />
59
- <div class="charge-print-options">
60
- <div class="charge-print-options__section">
61
- <label class="charge-print-options__label">收据打印选项</label>
62
- <div class="charge-print-options__selector">
63
- <VanField
64
- v-model="selectedOption"
65
- is-link
66
- readonly
67
- placeholder="请选择打印方式"
68
- @click="showPicker = true"
69
- />
70
- </div>
71
- </div>
72
-
73
- <div class="charge-print-options__section">
74
- <label class="charge-print-options__label">备注</label>
75
- <div class="charge-print-options__selector">
76
- <VanField
77
- v-model="remarks"
78
- type="textarea"
79
- placeholder="可选填写备注信息"
80
- rows="2"
81
- autosize
82
- maxlength="200"
83
- show-word-limit
84
- />
85
- </div>
86
- </div>
87
-
88
- <VanPopup v-model:show="showPicker" position="bottom" round teleport="body">
89
- <VanPicker
90
- :columns="printOptions"
91
- show-toolbar
92
- title="选择打印方式"
93
- @confirm="onConfirm"
94
- @cancel="showPicker = false"
95
- />
96
- </VanPopup>
97
- </div>
98
- </CardContainer>
99
- </template>
100
-
101
- <style scoped lang="less">
102
- .charge-print-and-remarks {
103
- margin-bottom: 16px;
104
- }
105
-
106
- .charge-print-options {
107
- &__section {
108
- margin-bottom: 16px;
109
-
110
- &:last-child {
111
- margin-bottom: 0;
112
- }
113
- }
114
-
115
- &__label {
116
- display: block;
117
- font-size: 12px;
118
- font-weight: 500;
119
- color: #6b7280;
120
- margin-bottom: 4px;
121
- }
122
-
123
- &__selector {
124
- position: relative;
125
-
126
- :deep(.van-field) {
127
- background-color: #f9fafb;
128
- border-radius: 6px;
129
- }
130
- }
131
-
132
- :deep(.van-field__control) {
133
- background-color: #f9fafb;
134
- border-radius: 6px;
135
- }
136
- }
137
- </style>
1
+ <script setup lang="ts">
2
+ import CardContainer from '@af-mobile-client-vue3/components/data/CardContainer/CardContainer.vue'
3
+ import CardHeader from '@af-mobile-client-vue3/components/data/CardContainer/CardHeader.vue'
4
+ import {
5
+ Field as VanField,
6
+ Picker as VanPicker,
7
+ Popup as VanPopup,
8
+ } from 'vant'
9
+ import { ref, watch } from 'vue'
10
+
11
+ const props = defineProps<{
12
+ modelValue: string
13
+ remarks: string
14
+ }>()
15
+
16
+ const emit = defineEmits<{
17
+ (e: 'update:modelValue', value: string): void
18
+ (e: 'update:remarks', value: string): void
19
+ }>()
20
+
21
+ const printOptions = [
22
+ { text: '电子发票', value: '电子发票' },
23
+ { text: '普通收据', value: '普通收据' },
24
+ { text: '两者都需要', value: 'both' },
25
+ ]
26
+
27
+ const selectedOption = ref(getOptionText(props.modelValue))
28
+ const remarks = ref(props.remarks)
29
+ const showPicker = ref(false)
30
+
31
+ function getOptionText(value: string): string {
32
+ const option = printOptions.find(opt => opt.value === value)
33
+ return option ? option.text : ''
34
+ }
35
+
36
+ function onConfirm({ selectedValues }: { selectedValues: string[] }) {
37
+ selectedOption.value = selectedValues[0]
38
+ emit('update:modelValue', selectedValues[0])
39
+ showPicker.value = false
40
+ }
41
+
42
+ watch(() => remarks.value, (newValue) => {
43
+ emit('update:remarks', newValue)
44
+ })
45
+
46
+ // 当从外部更新值时更新内部状态
47
+ watch(() => props.modelValue, (newValue) => {
48
+ selectedOption.value = getOptionText(newValue)
49
+ })
50
+
51
+ watch(() => props.remarks, (newValue) => {
52
+ remarks.value = newValue
53
+ })
54
+ </script>
55
+
56
+ <template>
57
+ <CardContainer class="charge-print-and-remarks">
58
+ <CardHeader title="打印及备注" />
59
+ <div class="charge-print-options">
60
+ <div class="charge-print-options__section">
61
+ <label class="charge-print-options__label">收据打印选项</label>
62
+ <div class="charge-print-options__selector">
63
+ <VanField
64
+ v-model="selectedOption"
65
+ is-link
66
+ readonly
67
+ placeholder="请选择打印方式"
68
+ @click="showPicker = true"
69
+ />
70
+ </div>
71
+ </div>
72
+
73
+ <div class="charge-print-options__section">
74
+ <label class="charge-print-options__label">备注</label>
75
+ <div class="charge-print-options__selector">
76
+ <VanField
77
+ v-model="remarks"
78
+ type="textarea"
79
+ placeholder="可选填写备注信息"
80
+ rows="2"
81
+ autosize
82
+ maxlength="200"
83
+ show-word-limit
84
+ />
85
+ </div>
86
+ </div>
87
+
88
+ <VanPopup v-model:show="showPicker" position="bottom" round teleport="body">
89
+ <VanPicker
90
+ :columns="printOptions"
91
+ show-toolbar
92
+ title="选择打印方式"
93
+ @confirm="onConfirm"
94
+ @cancel="showPicker = false"
95
+ />
96
+ </VanPopup>
97
+ </div>
98
+ </CardContainer>
99
+ </template>
100
+
101
+ <style scoped lang="less">
102
+ .charge-print-and-remarks {
103
+ margin-bottom: 16px;
104
+ }
105
+
106
+ .charge-print-options {
107
+ &__section {
108
+ margin-bottom: 16px;
109
+
110
+ &:last-child {
111
+ margin-bottom: 0;
112
+ }
113
+ }
114
+
115
+ &__label {
116
+ display: block;
117
+ font-size: 12px;
118
+ font-weight: 500;
119
+ color: #6b7280;
120
+ margin-bottom: 4px;
121
+ }
122
+
123
+ &__selector {
124
+ position: relative;
125
+
126
+ :deep(.van-field) {
127
+ background-color: #f9fafb;
128
+ border-radius: 6px;
129
+ }
130
+ }
131
+
132
+ :deep(.van-field__control) {
133
+ background-color: #f9fafb;
134
+ border-radius: 6px;
135
+ }
136
+ }
137
+ </style>