@liujitcn/kratos-uni-app-system 0.0.21 → 0.0.23
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 +1 -1
- package/dist/index.mjs +1232 -1245
- package/package.json +2 -2
- package/src/api/base/ai_message.ts +5 -5
- package/src/index.ts +3 -17
- package/src/locales/README.md +4 -2
- package/src/locales/en-US.json +62 -62
- package/src/locales/es-ES.json +83 -83
- package/src/locales/fr-FR.json +83 -83
- package/src/locales/generated.ts +22 -0
- package/src/locales/ja-JP.json +74 -74
- package/src/locales/ko-KR.json +78 -78
- package/src/locales/zh-CN.json +62 -62
- package/src/locales/zh-TW.json +62 -62
- package/src/rpc/base/v1/ai_session.ts +13 -2
- package/src/rpc/base/v1/ai_tool.ts +10 -1
- package/src/views/pages/my/my.vue +8 -6
- package/src/views/pagesMember/ai/components/SessionDrawer.vue +4 -4
- package/src/views/pagesMember/ai/components/WelcomePanel.vue +7 -5
- package/src/views/pagesMember/ai/index.vue +54 -51
- package/src/views/pagesMember/profile/profile.vue +10 -10
- package/src/views/pagesMember/settings/settings.vue +3 -3
- package/src/rpc/base/v1/enum.ts +0 -54
|
@@ -7,7 +7,8 @@ import { defAiToolService } from '../../../api/base/ai_tool'
|
|
|
7
7
|
import type { AiMessage } from '../../../rpc/base/v1/ai_session'
|
|
8
8
|
import type { AiAttachment, AiSession } from '../../../rpc/base/v1/ai_session'
|
|
9
9
|
import type { AiShortcut, AiToolCall } from '../../../rpc/base/v1/ai_tool'
|
|
10
|
-
import { AiMessageStatus
|
|
10
|
+
import { AiMessageStatus } from '../../../rpc/base/v1/ai_session'
|
|
11
|
+
import { Terminal } from '../../../rpc/base/v1/ai_tool'
|
|
11
12
|
import { uploadFile } from '@liujitcn/kratos-uni-app-core/utils/file'
|
|
12
13
|
import { formatSrc } from '@liujitcn/kratos-uni-app-core/utils/index'
|
|
13
14
|
import Composer from './components/Composer.vue'
|
|
@@ -96,38 +97,38 @@ const createStarterShortcuts = (): AiShortcut[] => [
|
|
|
96
97
|
{
|
|
97
98
|
key: 'summarize',
|
|
98
99
|
title: t('system.ai.prompt.summary'),
|
|
99
|
-
prompt: t('system.ai.prompt.
|
|
100
|
+
prompt: t('system.ai.prompt.summary_content'),
|
|
100
101
|
action: undefined,
|
|
101
102
|
required_tools: [],
|
|
102
103
|
sort: 1,
|
|
103
|
-
group: t('system.ai.
|
|
104
|
+
group: t('system.ai.text_assistant'),
|
|
104
105
|
},
|
|
105
106
|
{
|
|
106
107
|
key: 'rewrite',
|
|
107
108
|
title: t('system.ai.prompt.optimize'),
|
|
108
|
-
prompt: t('system.ai.prompt.
|
|
109
|
+
prompt: t('system.ai.prompt.optimize_content'),
|
|
109
110
|
action: undefined,
|
|
110
111
|
required_tools: [],
|
|
111
112
|
sort: 2,
|
|
112
|
-
group: t('system.ai.
|
|
113
|
+
group: t('system.ai.text_assistant'),
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
116
|
key: 'plan',
|
|
116
117
|
title: t('system.ai.prompt.plan'),
|
|
117
|
-
prompt: t('system.ai.prompt.
|
|
118
|
+
prompt: t('system.ai.prompt.plan_content'),
|
|
118
119
|
action: undefined,
|
|
119
120
|
required_tools: [],
|
|
120
121
|
sort: 3,
|
|
121
|
-
group: t('system.ai.
|
|
122
|
+
group: t('system.ai.efficiency_assistant'),
|
|
122
123
|
},
|
|
123
124
|
{
|
|
124
125
|
key: 'ideas',
|
|
125
126
|
title: t('system.ai.prompt.idea'),
|
|
126
|
-
prompt: t('system.ai.prompt.
|
|
127
|
+
prompt: t('system.ai.prompt.idea_content'),
|
|
127
128
|
action: undefined,
|
|
128
129
|
required_tools: [],
|
|
129
130
|
sort: 4,
|
|
130
|
-
group: t('system.ai.
|
|
131
|
+
group: t('system.ai.efficiency_assistant'),
|
|
131
132
|
},
|
|
132
133
|
]
|
|
133
134
|
const starterShortcuts = ref<AiShortcut[]>(createStarterShortcuts())
|
|
@@ -177,7 +178,7 @@ const composerPlaceholder = computed(() => {
|
|
|
177
178
|
return t('system.ai.recording')
|
|
178
179
|
}
|
|
179
180
|
if (uploadingAttachment.value) {
|
|
180
|
-
return t('system.ai.
|
|
181
|
+
return t('system.ai.attachment_uploading')
|
|
181
182
|
}
|
|
182
183
|
return hasMessages.value
|
|
183
184
|
? t('system.ai.placeholder.continue')
|
|
@@ -232,16 +233,16 @@ const createSession = async () => {
|
|
|
232
233
|
sessionKeyword.value = ''
|
|
233
234
|
showSessionDrawer.value = false
|
|
234
235
|
} catch (error) {
|
|
235
|
-
showError(error, t('system.ai.
|
|
236
|
+
showError(error, t('system.ai.create_session_failed'))
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
const deleteSession = async (sessionID: string) => {
|
|
240
241
|
const session = sessions.value.find((item) => item.id === sessionID)
|
|
241
242
|
const result = await uni.showModal({
|
|
242
|
-
title: t('system.ai.
|
|
243
|
-
content: t('system.ai.
|
|
244
|
-
title: session?.title || t('system.ai.
|
|
243
|
+
title: t('system.ai.delete_session'),
|
|
244
|
+
content: t('system.ai.delete_session_confirm', {
|
|
245
|
+
title: session?.title || t('system.ai.current_session'),
|
|
245
246
|
}),
|
|
246
247
|
confirmText: t('common.action.delete'),
|
|
247
248
|
confirmColor: '#cf4444',
|
|
@@ -259,13 +260,13 @@ const deleteSession = async (sessionID: string) => {
|
|
|
259
260
|
await ensureActiveSession()
|
|
260
261
|
}
|
|
261
262
|
} catch (error) {
|
|
262
|
-
showError(error, t('system.ai.
|
|
263
|
+
showError(error, t('system.ai.delete_session_failed'))
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
const handleSessionAction = (session: AiSession) => {
|
|
267
268
|
uni.showActionSheet({
|
|
268
|
-
itemList: [t('system.ai.
|
|
269
|
+
itemList: [t('system.ai.delete_session')],
|
|
269
270
|
success: ({ tapIndex }) => {
|
|
270
271
|
if (tapIndex === 0) {
|
|
271
272
|
void deleteSession(session.id)
|
|
@@ -277,7 +278,7 @@ const handleSessionAction = (session: AiSession) => {
|
|
|
277
278
|
const copyMessage = (item: ChatMessageItem) => {
|
|
278
279
|
uni.setClipboardData({
|
|
279
280
|
data: item.content,
|
|
280
|
-
success: () => uni.showToast({ icon: 'none', title: t('system.ai.
|
|
281
|
+
success: () => uni.showToast({ icon: 'none', title: t('system.ai.copy_success') }),
|
|
281
282
|
})
|
|
282
283
|
}
|
|
283
284
|
|
|
@@ -297,7 +298,7 @@ const deleteMessage = async (item: ChatMessageItem) => {
|
|
|
297
298
|
(message) => message.messageID !== item.messageID,
|
|
298
299
|
)
|
|
299
300
|
} catch (error) {
|
|
300
|
-
showError(error, t('system.ai.
|
|
301
|
+
showError(error, t('system.ai.delete_message_failed'))
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
|
|
@@ -316,7 +317,7 @@ const regenerateMessage = async (item: ChatMessageItem) => {
|
|
|
316
317
|
upsertSession(normalizeSession(response.session))
|
|
317
318
|
}
|
|
318
319
|
} catch (error) {
|
|
319
|
-
showError(error, t('system.ai.
|
|
320
|
+
showError(error, t('system.ai.regenerate_failed'))
|
|
320
321
|
} finally {
|
|
321
322
|
setSessionSending(activeSessionID.value, false)
|
|
322
323
|
}
|
|
@@ -354,7 +355,7 @@ const handleSend = async () => {
|
|
|
354
355
|
if (isSubmitDisabled.value) {
|
|
355
356
|
return
|
|
356
357
|
}
|
|
357
|
-
const text = inputText.value.trim() || t('system.ai.
|
|
358
|
+
const text = inputText.value.trim() || t('system.ai.attachment_answer')
|
|
358
359
|
inputText.value = ''
|
|
359
360
|
const attachments = [...selectedAttachments.value]
|
|
360
361
|
selectedAttachments.value = []
|
|
@@ -382,7 +383,7 @@ const handleToggleRecord = () => {
|
|
|
382
383
|
isRecording.value = !isRecording.value
|
|
383
384
|
uni.showToast({
|
|
384
385
|
icon: 'none',
|
|
385
|
-
title: isRecording.value ? t('system.ai.recognizing') : t('system.ai.
|
|
386
|
+
title: isRecording.value ? t('system.ai.recognizing') : t('system.ai.speech_stopped'),
|
|
386
387
|
})
|
|
387
388
|
}
|
|
388
389
|
|
|
@@ -393,7 +394,7 @@ const handleAttachment = () => {
|
|
|
393
394
|
if (selectedAttachments.value.length >= MAX_ATTACHMENT_COUNT) {
|
|
394
395
|
uni.showToast({
|
|
395
396
|
icon: 'none',
|
|
396
|
-
title: t('system.ai.
|
|
397
|
+
title: t('system.ai.attachment_limit', { count: MAX_ATTACHMENT_COUNT }),
|
|
397
398
|
})
|
|
398
399
|
return
|
|
399
400
|
}
|
|
@@ -414,7 +415,7 @@ const handleAttachment = () => {
|
|
|
414
415
|
path,
|
|
415
416
|
name:
|
|
416
417
|
(tempFiles[index] as { name?: string } | undefined)?.name ||
|
|
417
|
-
t('system.ai.
|
|
418
|
+
t('system.ai.image_name', { index: index + 1 }),
|
|
418
419
|
size: Number((tempFiles[index] as { size?: number } | undefined)?.size || 0),
|
|
419
420
|
}))
|
|
420
421
|
uploadingAttachment.value = true
|
|
@@ -432,7 +433,7 @@ const handleAttachment = () => {
|
|
|
432
433
|
MAX_ATTACHMENT_COUNT,
|
|
433
434
|
)
|
|
434
435
|
} catch (error) {
|
|
435
|
-
showError(error, t('system.ai.
|
|
436
|
+
showError(error, t('system.ai.upload_failed'))
|
|
436
437
|
} finally {
|
|
437
438
|
uploadingAttachment.value = false
|
|
438
439
|
}
|
|
@@ -469,7 +470,7 @@ async function loadAiShortcuts() {
|
|
|
469
470
|
starterPromptGroupIndex.value = 0
|
|
470
471
|
}
|
|
471
472
|
} catch (error) {
|
|
472
|
-
showError(error, t('system.ai.
|
|
473
|
+
showError(error, t('system.ai.load_shortcuts_failed'))
|
|
473
474
|
} finally {
|
|
474
475
|
loadingShortcuts.value = false
|
|
475
476
|
}
|
|
@@ -525,7 +526,7 @@ async function runAiTask(
|
|
|
525
526
|
await chunkedTask.promise
|
|
526
527
|
parser.flush()
|
|
527
528
|
if (!task.finished && !task.aborted) {
|
|
528
|
-
throw new Error(t('system.ai.
|
|
529
|
+
throw new Error(t('system.ai.response_incomplete'))
|
|
529
530
|
}
|
|
530
531
|
// #endif
|
|
531
532
|
|
|
@@ -550,7 +551,7 @@ async function runAiTask(
|
|
|
550
551
|
signal: controller.signal,
|
|
551
552
|
})
|
|
552
553
|
if (!response.body) {
|
|
553
|
-
throw new Error(t('system.ai.
|
|
554
|
+
throw new Error(t('system.ai.stream_empty'))
|
|
554
555
|
}
|
|
555
556
|
await readAiEventStream(
|
|
556
557
|
response.body,
|
|
@@ -558,7 +559,7 @@ async function runAiTask(
|
|
|
558
559
|
controller.signal,
|
|
559
560
|
)
|
|
560
561
|
if (!task.finished && !task.aborted) {
|
|
561
|
-
throw new Error(t('system.ai.
|
|
562
|
+
throw new Error(t('system.ai.response_incomplete'))
|
|
562
563
|
}
|
|
563
564
|
handledByStream = true
|
|
564
565
|
}
|
|
@@ -568,7 +569,7 @@ async function runAiTask(
|
|
|
568
569
|
const response = await defAiMessageService.SendAiMessage(request)
|
|
569
570
|
const nextMessages = normalizeNonStreamMessages(response)
|
|
570
571
|
if (!nextMessages.length) {
|
|
571
|
-
throw new Error(t('system.ai.
|
|
572
|
+
throw new Error(t('system.ai.response_empty'))
|
|
572
573
|
}
|
|
573
574
|
const success = hasSuccessfulAiMessages(nextMessages)
|
|
574
575
|
messages.value[sessionID] = replacePendingMessages(
|
|
@@ -588,7 +589,7 @@ async function runAiTask(
|
|
|
588
589
|
}
|
|
589
590
|
messages.value[sessionID] = markThinkingMessageFailed(messages.value[sessionID] ?? [])
|
|
590
591
|
scrollChatToBottom()
|
|
591
|
-
showError(error, t('system.ai.
|
|
592
|
+
showError(error, t('system.ai.request_failed'))
|
|
592
593
|
} finally {
|
|
593
594
|
if (task && runningStreamTaskMap.get(sessionID) === task) {
|
|
594
595
|
runningStreamTaskMap.delete(sessionID)
|
|
@@ -739,7 +740,7 @@ function normalizeNonStreamMessages(response: unknown) {
|
|
|
739
740
|
}
|
|
740
741
|
const errorEvent = [...events].reverse().find((item) => item.event === 'error')
|
|
741
742
|
if (errorEvent) {
|
|
742
|
-
throw new Error(t('system.ai.
|
|
743
|
+
throw new Error(t('system.ai.request_failed'))
|
|
743
744
|
}
|
|
744
745
|
return []
|
|
745
746
|
}
|
|
@@ -799,7 +800,7 @@ async function ensureSessionsLoaded() {
|
|
|
799
800
|
await loadMessages(sessionID)
|
|
800
801
|
}
|
|
801
802
|
} catch (error) {
|
|
802
|
-
showError(error, t('system.ai.
|
|
803
|
+
showError(error, t('system.ai.load_sessions_failed'))
|
|
803
804
|
} finally {
|
|
804
805
|
loadingSessions.value = false
|
|
805
806
|
}
|
|
@@ -823,7 +824,7 @@ async function ensureActiveSession() {
|
|
|
823
824
|
|
|
824
825
|
async function createRemoteSession() {
|
|
825
826
|
const response = await defAiSessionService.CreateAiSession({
|
|
826
|
-
title: t('system.ai.
|
|
827
|
+
title: t('system.ai.new_session'),
|
|
827
828
|
terminal: AI_TERMINAL,
|
|
828
829
|
})
|
|
829
830
|
const session = response.session ? normalizeSession(response.session) : undefined
|
|
@@ -853,7 +854,7 @@ async function loadMessages(sessionID: string) {
|
|
|
853
854
|
if (loadingSessionID.value === sessionID) {
|
|
854
855
|
messages.value[sessionID] = []
|
|
855
856
|
}
|
|
856
|
-
showError(error, t('system.ai.
|
|
857
|
+
showError(error, t('system.ai.load_messages_failed'))
|
|
857
858
|
} finally {
|
|
858
859
|
if (loadingSessionID.value === sessionID) {
|
|
859
860
|
loadingSessionID.value = ''
|
|
@@ -864,7 +865,7 @@ async function loadMessages(sessionID: string) {
|
|
|
864
865
|
function normalizeSession(session?: Partial<AiSession> | null): AiSession {
|
|
865
866
|
return {
|
|
866
867
|
id: String(session?.id ?? ''),
|
|
867
|
-
title: String(session?.title ?? t('system.ai.
|
|
868
|
+
title: String(session?.title ?? t('system.ai.new_session')),
|
|
868
869
|
summary: String(session?.summary ?? ''),
|
|
869
870
|
updated_at: session?.updated_at,
|
|
870
871
|
terminal: Number(session?.terminal ?? AI_TERMINAL),
|
|
@@ -904,7 +905,7 @@ function normalizeMessageList(list?: AiMessage[] | null) {
|
|
|
904
905
|
}
|
|
905
906
|
|
|
906
907
|
function hasSuccessfulAiMessages(list: ChatMessageItem[]) {
|
|
907
|
-
return list.some((item) => item.status === AiMessageStatus.
|
|
908
|
+
return list.some((item) => item.status === AiMessageStatus.AI_MESSAGE_STATUS_SUCCESS)
|
|
908
909
|
}
|
|
909
910
|
|
|
910
911
|
function mapMessageItem(message: AiMessage, role: ChatRole): ChatMessageItem {
|
|
@@ -923,7 +924,7 @@ function mapMessageItem(message: AiMessage, role: ChatRole): ChatMessageItem {
|
|
|
923
924
|
step: message.output_content?.step ?? '',
|
|
924
925
|
blocks_json: message.output_content?.blocks_json ?? '',
|
|
925
926
|
}
|
|
926
|
-
const status = Number(message.status ?? AiMessageStatus.
|
|
927
|
+
const status = Number(message.status ?? AiMessageStatus.AI_MESSAGE_STATUS_SUCCESS)
|
|
927
928
|
return {
|
|
928
929
|
...message,
|
|
929
930
|
key: `${message.id}:${role}`,
|
|
@@ -963,7 +964,7 @@ function createLocalUserMessage(payload: { text: string; attachments: AiAttachme
|
|
|
963
964
|
seconds: Math.floor(now / 1000),
|
|
964
965
|
nanos: (now % 1000) * 1_000_000,
|
|
965
966
|
},
|
|
966
|
-
status: AiMessageStatus.
|
|
967
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_GENERATING,
|
|
967
968
|
token: { input: 0, output: 0, cache: 0, total: 0 },
|
|
968
969
|
tools: [],
|
|
969
970
|
first_token_ms: 0,
|
|
@@ -972,7 +973,7 @@ function createLocalUserMessage(payload: { text: string; attachments: AiAttachme
|
|
|
972
973
|
'user',
|
|
973
974
|
)
|
|
974
975
|
message.localOnly = true
|
|
975
|
-
message.status = AiMessageStatus.
|
|
976
|
+
message.status = AiMessageStatus.AI_MESSAGE_STATUS_GENERATING
|
|
976
977
|
return message
|
|
977
978
|
}
|
|
978
979
|
|
|
@@ -1001,7 +1002,7 @@ function createThinkingMessage(options?: { sessionID?: string; messageID?: strin
|
|
|
1001
1002
|
seconds: Math.floor(now / 1000),
|
|
1002
1003
|
nanos: (now % 1000) * 1_000_000,
|
|
1003
1004
|
},
|
|
1004
|
-
status: AiMessageStatus.
|
|
1005
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_GENERATING,
|
|
1005
1006
|
token: { input: 0, output: 0, cache: 0, total: 0 },
|
|
1006
1007
|
tools: [],
|
|
1007
1008
|
first_token_ms: 0,
|
|
@@ -1052,7 +1053,7 @@ function appendStreamingDelta(current: ChatMessageItem[], payload: AiStreamPaylo
|
|
|
1052
1053
|
return {
|
|
1053
1054
|
...item,
|
|
1054
1055
|
content: `${baseContent}${payload.delta}`,
|
|
1055
|
-
status: AiMessageStatus.
|
|
1056
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_GENERATING,
|
|
1056
1057
|
}
|
|
1057
1058
|
})
|
|
1058
1059
|
}
|
|
@@ -1064,8 +1065,8 @@ function markThinkingMessageFailed(current: ChatMessageItem[]) {
|
|
|
1064
1065
|
}
|
|
1065
1066
|
return {
|
|
1066
1067
|
...item,
|
|
1067
|
-
status: AiMessageStatus.
|
|
1068
|
-
content: item.role === 'ai' ? t('system.ai.
|
|
1068
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_FAILED,
|
|
1069
|
+
content: item.role === 'ai' ? t('system.ai.failed_response') : item.content,
|
|
1069
1070
|
}
|
|
1070
1071
|
})
|
|
1071
1072
|
}
|
|
@@ -1078,8 +1079,8 @@ function markStreamingError(current: ChatMessageItem[], payload: AiStreamPayload
|
|
|
1078
1079
|
}
|
|
1079
1080
|
return {
|
|
1080
1081
|
...item,
|
|
1081
|
-
status: AiMessageStatus.
|
|
1082
|
-
content: t('system.ai.
|
|
1082
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_FAILED,
|
|
1083
|
+
content: t('system.ai.failed_response'),
|
|
1083
1084
|
}
|
|
1084
1085
|
})
|
|
1085
1086
|
}
|
|
@@ -1168,7 +1169,7 @@ function showError(error: unknown, fallback: string) {
|
|
|
1168
1169
|
<button class="nav-back-button" hover-class="none" @tap="navigateBack">
|
|
1169
1170
|
<uni-icons type="left" size="24" color="#111" />
|
|
1170
1171
|
</button>
|
|
1171
|
-
<view class="ai-navbar__title">{{ t('system.ai.
|
|
1172
|
+
<view class="ai-navbar__title">{{ t('system.ai.chat_title') }}</view>
|
|
1172
1173
|
<button class="nav-menu-button" hover-class="none" @tap="toggleSessionDrawer">
|
|
1173
1174
|
<uni-icons type="bars" size="24" color="#111" />
|
|
1174
1175
|
</button>
|
|
@@ -1204,12 +1205,12 @@ function showError(error: unknown, fallback: string) {
|
|
|
1204
1205
|
class="bubble"
|
|
1205
1206
|
:class="[
|
|
1206
1207
|
item.role === 'ai' ? 'ai-bubble' : 'user-bubble',
|
|
1207
|
-
item.status === AiMessageStatus.
|
|
1208
|
+
item.status === AiMessageStatus.AI_MESSAGE_STATUS_GENERATING ? 'is-streaming' : '',
|
|
1208
1209
|
]"
|
|
1209
1210
|
@longpress="handleMessageAction(item)"
|
|
1210
1211
|
>
|
|
1211
1212
|
<view v-if="item.role === 'ai' && item.model" class="reply-meta">
|
|
1212
|
-
<text class="reply-tag">{{ t('system.ai.
|
|
1213
|
+
<text class="reply-tag">{{ t('system.ai.model_reply') }}</text>
|
|
1213
1214
|
<text class="reply-model">{{ item.model }}</text>
|
|
1214
1215
|
</view>
|
|
1215
1216
|
<view class="bubble-content">{{ item.content }}</view>
|
|
@@ -1222,7 +1223,7 @@ function showError(error: unknown, fallback: string) {
|
|
|
1222
1223
|
>
|
|
1223
1224
|
<view class="attachment-icon">{{
|
|
1224
1225
|
isImageAttachment(attachment)
|
|
1225
|
-
? t('system.ai.
|
|
1226
|
+
? t('system.ai.image_attachment')
|
|
1226
1227
|
: t('system.ai.attachment')
|
|
1227
1228
|
}}</view>
|
|
1228
1229
|
<view class="attachment-info">
|
|
@@ -1232,13 +1233,15 @@ function showError(error: unknown, fallback: string) {
|
|
|
1232
1233
|
</view>
|
|
1233
1234
|
</view>
|
|
1234
1235
|
<view v-if="item.tools.length" class="tool-row">{{
|
|
1235
|
-
t('system.ai.
|
|
1236
|
+
t('system.ai.tool_called', { tools: formatTools(item.tools) })
|
|
1236
1237
|
}}</view>
|
|
1237
1238
|
</view>
|
|
1238
1239
|
</view>
|
|
1239
1240
|
<view id="chat-bottom" class="chat-bottom"></view>
|
|
1240
1241
|
</view>
|
|
1241
|
-
<view v-if="loadingSessionID" class="loading-session">{{
|
|
1242
|
+
<view v-if="loadingSessionID" class="loading-session">{{
|
|
1243
|
+
t('system.ai.load_messages')
|
|
1244
|
+
}}</view>
|
|
1242
1245
|
</scroll-view>
|
|
1243
1246
|
|
|
1244
1247
|
<Composer
|
|
@@ -77,7 +77,7 @@ const onAvatarChange = async () => {
|
|
|
77
77
|
const { path, size } = res.tempFiles[0]
|
|
78
78
|
if (size > imgMaxSize.value) {
|
|
79
79
|
await uni.showToast({
|
|
80
|
-
title: t('system.profile.
|
|
80
|
+
title: t('system.profile.photo_limit'),
|
|
81
81
|
icon: 'none',
|
|
82
82
|
duration: 1500,
|
|
83
83
|
})
|
|
@@ -101,7 +101,7 @@ const onAvatarChange = async () => {
|
|
|
101
101
|
const { tempFilePath, size } = res.tempFiles[0]
|
|
102
102
|
if (size > imgMaxSize.value) {
|
|
103
103
|
await uni.showToast({
|
|
104
|
-
title: t('system.profile.
|
|
104
|
+
title: t('system.profile.photo_limit'),
|
|
105
105
|
icon: 'none',
|
|
106
106
|
duration: 1500,
|
|
107
107
|
})
|
|
@@ -125,9 +125,9 @@ const uploadAvatar = async (file: string) => {
|
|
|
125
125
|
userInfo.value.avatar = fileInfo.url
|
|
126
126
|
await defAuthService.UpdateUserProfile(userInfo.value)
|
|
127
127
|
syncUserStoreProfile(userInfo.value)
|
|
128
|
-
await uni.showToast({ icon: 'success', title: t('system.profile.
|
|
128
|
+
await uni.showToast({ icon: 'success', title: t('system.profile.update_success') })
|
|
129
129
|
} catch {
|
|
130
|
-
await uni.showToast({ icon: 'error', title: t('system.profile.
|
|
130
|
+
await uni.showToast({ icon: 'error', title: t('system.profile.avatar_upload_failed') })
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -148,7 +148,7 @@ const onGetPhoneNumber: UniHelper.ButtonOnGetphonenumber = async (e) => {
|
|
|
148
148
|
const res = await defAuthService.BindUserPhone({ code: e.detail.code || '' })
|
|
149
149
|
userInfo.value.phone = res.phone
|
|
150
150
|
syncUserStoreProfile(userInfo.value)
|
|
151
|
-
await uni.showToast({ icon: 'success', title: t('system.profile.
|
|
151
|
+
await uni.showToast({ icon: 'success', title: t('system.profile.phone_authorization_success') })
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// #endif
|
|
@@ -170,7 +170,7 @@ const onSubmit = async () => {
|
|
|
170
170
|
})
|
|
171
171
|
// 更新Store昵称
|
|
172
172
|
syncUserStoreProfile(userInfo.value)
|
|
173
|
-
await uni.showToast({ icon: 'success', title: t('system.profile.
|
|
173
|
+
await uni.showToast({ icon: 'success', title: t('system.profile.save_success') })
|
|
174
174
|
setTimeout(() => {
|
|
175
175
|
uni.navigateBack()
|
|
176
176
|
}, 400)
|
|
@@ -193,7 +193,7 @@ const onSubmit = async () => {
|
|
|
193
193
|
mode="aspectFill"
|
|
194
194
|
/>
|
|
195
195
|
<image v-else class="image" :src="defaultAvatar" mode="aspectFill"></image>
|
|
196
|
-
<text class="text">{{ t('system.profile.
|
|
196
|
+
<text class="text">{{ t('system.profile.avatar_change') }}</text>
|
|
197
197
|
</view>
|
|
198
198
|
</view>
|
|
199
199
|
<!-- 表单 -->
|
|
@@ -216,17 +216,17 @@ const onSubmit = async () => {
|
|
|
216
216
|
open-type="getPhoneNumber"
|
|
217
217
|
@getphonenumber="onGetPhoneNumber"
|
|
218
218
|
>
|
|
219
|
-
{{ t('system.profile.
|
|
219
|
+
{{ t('system.profile.phone_authorization') }}
|
|
220
220
|
</button>
|
|
221
221
|
</view>
|
|
222
222
|
</view>
|
|
223
223
|
<!-- #endif -->
|
|
224
224
|
<view class="form-item">
|
|
225
|
-
<text class="label">{{ t('system.profile.
|
|
225
|
+
<text class="label">{{ t('system.profile.nick_name') }}</text>
|
|
226
226
|
<input
|
|
227
227
|
class="input"
|
|
228
228
|
type="text"
|
|
229
|
-
:placeholder="t('system.profile.
|
|
229
|
+
:placeholder="t('system.profile.nick_name_placeholder')"
|
|
230
230
|
v-model="userInfo.nick_name"
|
|
231
231
|
/>
|
|
232
232
|
</view>
|
|
@@ -10,7 +10,7 @@ const userStore = useUserStore()
|
|
|
10
10
|
const { locale, setLocale, t } = useI18n()
|
|
11
11
|
const logoutLoading = ref(false)
|
|
12
12
|
const localeOptions = computed(() => getLanguageOptions())
|
|
13
|
-
const localeLabels = computed(() => localeOptions.value.map((item) => item.
|
|
13
|
+
const localeLabels = computed(() => localeOptions.value.map((item) => item.native_name))
|
|
14
14
|
const localeIndex = computed(() =>
|
|
15
15
|
Math.max(
|
|
16
16
|
0,
|
|
@@ -46,7 +46,7 @@ const onLogout = () => {
|
|
|
46
46
|
}
|
|
47
47
|
// 模态弹窗
|
|
48
48
|
uni.showModal({
|
|
49
|
-
content: t('system.settings.
|
|
49
|
+
content: t('system.settings.logout_confirm'),
|
|
50
50
|
confirmColor: '#27BA9B',
|
|
51
51
|
success: async (res) => {
|
|
52
52
|
if (!res.confirm) {
|
|
@@ -61,7 +61,7 @@ const onLogout = () => {
|
|
|
61
61
|
} catch (error) {
|
|
62
62
|
await uni.showToast({
|
|
63
63
|
icon: 'none',
|
|
64
|
-
title: t('system.settings.
|
|
64
|
+
title: t('system.settings.logout_failed'),
|
|
65
65
|
})
|
|
66
66
|
} finally {
|
|
67
67
|
logoutLoading.value = false
|
package/src/rpc/base/v1/enum.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
-
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.8
|
|
4
|
-
// protoc unknown
|
|
5
|
-
// source: base/v1/enum.proto
|
|
6
|
-
|
|
7
|
-
/* eslint-disable */
|
|
8
|
-
|
|
9
|
-
/** AI 助手消息状态 */
|
|
10
|
-
export enum AiMessageStatus {
|
|
11
|
-
/** UNKNOWN_AMS - 未知AI助手消息状态 */
|
|
12
|
-
UNKNOWN_AMS = 0,
|
|
13
|
-
/** GENERATING_AMS - 生成中 */
|
|
14
|
-
GENERATING_AMS = 1,
|
|
15
|
-
/** SUCCESS_AMS - 成功 */
|
|
16
|
-
SUCCESS_AMS = 2,
|
|
17
|
-
/** FAILED_AMS - 失败 */
|
|
18
|
-
FAILED_AMS = 3,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** 终端类型 */
|
|
22
|
-
export enum Terminal {
|
|
23
|
-
/** UNKNOWN_TERMINAL - 未知终端 */
|
|
24
|
-
UNKNOWN_TERMINAL = 0,
|
|
25
|
-
/** TERMINAL_APP - 移动端 */
|
|
26
|
-
TERMINAL_APP = 1,
|
|
27
|
-
/** TERMINAL_ADMIN - 管理端 */
|
|
28
|
-
TERMINAL_ADMIN = 2,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** 系统配置位置 */
|
|
32
|
-
export enum BaseConfigSite {
|
|
33
|
-
UNKNOWN_BCS = 0,
|
|
34
|
-
/** SYSTEM - 系统内使用 */
|
|
35
|
-
SYSTEM = 1,
|
|
36
|
-
/** ADMIN - 管理端 */
|
|
37
|
-
ADMIN = 2,
|
|
38
|
-
/** APP - 移动端 */
|
|
39
|
-
APP = 3,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** 密码加密场景枚举 */
|
|
43
|
-
export enum PasswordCryptoScene {
|
|
44
|
-
/** UNKNOWN_PCS - 未指定密码加密场景 */
|
|
45
|
-
UNKNOWN_PCS = 0,
|
|
46
|
-
/** LOGIN - 登录密码加密场景 */
|
|
47
|
-
LOGIN = 1,
|
|
48
|
-
/** CREATE_BASE_USER - 新增后台用户密码加密场景 */
|
|
49
|
-
CREATE_BASE_USER = 2,
|
|
50
|
-
/** RESET_BASE_USER_PASSWORD - 重置后台用户密码加密场景 */
|
|
51
|
-
RESET_BASE_USER_PASSWORD = 3,
|
|
52
|
-
/** UPDATE_USER_PASSWORD - 个人修改密码加密场景 */
|
|
53
|
-
UPDATE_USER_PASSWORD = 4,
|
|
54
|
-
}
|