@liujitcn/kratos-taro-app-system 0.0.21 → 0.0.24
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 +3 -3
- 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.tsx +6 -6
- package/src/views/pagesMember/ai/components/SessionDrawer.tsx +4 -4
- package/src/views/pagesMember/ai/components/WelcomePanel.tsx +5 -5
- package/src/views/pagesMember/ai/index.tsx +52 -51
- package/src/views/pagesMember/profile/profile.tsx +9 -9
- package/src/views/pagesMember/settings/settings.tsx +3 -3
- package/src/rpc/base/v1/enum.ts +0 -54
|
@@ -15,7 +15,8 @@ import { defAiSessionService } from '../../../api/base/ai_session'
|
|
|
15
15
|
import { defAiToolService } from '../../../api/base/ai_tool'
|
|
16
16
|
import type { AiAttachment, AiMessage, AiSession } from '../../../rpc/base/v1/ai_session'
|
|
17
17
|
import type { AiShortcut, AiToolCall } from '../../../rpc/base/v1/ai_tool'
|
|
18
|
-
import { AiMessageStatus
|
|
18
|
+
import { AiMessageStatus } from '../../../rpc/base/v1/ai_session'
|
|
19
|
+
import { Terminal } from '../../../rpc/base/v1/ai_tool'
|
|
19
20
|
import Composer from './components/Composer'
|
|
20
21
|
import SessionDrawer from './components/SessionDrawer'
|
|
21
22
|
import WelcomePanel from './components/WelcomePanel'
|
|
@@ -129,7 +130,7 @@ export default function AiPage() {
|
|
|
129
130
|
const composerPlaceholder = isRecording
|
|
130
131
|
? t('system.ai.recording')
|
|
131
132
|
: uploadingAttachment
|
|
132
|
-
? t('system.ai.
|
|
133
|
+
? t('system.ai.attachment_uploading')
|
|
133
134
|
: hasMessages
|
|
134
135
|
? t('system.ai.placeholder.continue')
|
|
135
136
|
: t('system.ai.placeholder.default')
|
|
@@ -279,7 +280,7 @@ export default function AiPage() {
|
|
|
279
280
|
|
|
280
281
|
const createRemoteSession = async () => {
|
|
281
282
|
const response = await defAiSessionService.CreateAiSession({
|
|
282
|
-
title: t('system.ai.
|
|
283
|
+
title: t('system.ai.new_session'),
|
|
283
284
|
terminal: AI_TERMINAL,
|
|
284
285
|
})
|
|
285
286
|
const session = response.session ? normalizeSession(response.session) : undefined
|
|
@@ -312,7 +313,7 @@ export default function AiPage() {
|
|
|
312
313
|
if (activeSessionIDRef.current === sessionID) scrollChatToBottom()
|
|
313
314
|
} catch (error) {
|
|
314
315
|
if (loadingSessionIDRef.current === sessionID) updateSessionMessages(sessionID, [])
|
|
315
|
-
showError(error, t('system.ai.
|
|
316
|
+
showError(error, t('system.ai.load_messages_failed'))
|
|
316
317
|
} finally {
|
|
317
318
|
if (loadingSessionIDRef.current === sessionID) setLoadingSessionID('')
|
|
318
319
|
}
|
|
@@ -327,7 +328,7 @@ export default function AiPage() {
|
|
|
327
328
|
const sessionID = await ensureActiveSession()
|
|
328
329
|
if (sessionID) await loadMessages(sessionID)
|
|
329
330
|
} catch (error) {
|
|
330
|
-
showError(error, t('system.ai.
|
|
331
|
+
showError(error, t('system.ai.load_sessions_failed'))
|
|
331
332
|
} finally {
|
|
332
333
|
setLoadingSessions(false)
|
|
333
334
|
}
|
|
@@ -344,7 +345,7 @@ export default function AiPage() {
|
|
|
344
345
|
setStarterPromptGroupIndex(0)
|
|
345
346
|
}
|
|
346
347
|
} catch (error) {
|
|
347
|
-
showError(error, t('system.ai.
|
|
348
|
+
showError(error, t('system.ai.load_shortcuts_failed'))
|
|
348
349
|
} finally {
|
|
349
350
|
setLoadingShortcuts(false)
|
|
350
351
|
}
|
|
@@ -373,7 +374,7 @@ export default function AiPage() {
|
|
|
373
374
|
handledByStream = true
|
|
374
375
|
await chunkedTask.promise
|
|
375
376
|
parser.flush()
|
|
376
|
-
if (!task.finished && !task.aborted) throw new Error(t('system.ai.
|
|
377
|
+
if (!task.finished && !task.aborted) throw new Error(t('system.ai.response_incomplete'))
|
|
377
378
|
}
|
|
378
379
|
if (
|
|
379
380
|
process.env.TARO_ENV === 'h5' &&
|
|
@@ -393,15 +394,15 @@ export default function AiPage() {
|
|
|
393
394
|
}
|
|
394
395
|
runningStreamTaskMap.current.set(sessionID, task)
|
|
395
396
|
const response = await defAiMessageService.StreamAiMessage(request, { signal: controller.signal })
|
|
396
|
-
if (!response.body) throw new Error(t('system.ai.
|
|
397
|
+
if (!response.body) throw new Error(t('system.ai.stream_empty'))
|
|
397
398
|
await readAiEventStream(response.body, (event) => handleAiStreamEvent(event, task), controller.signal)
|
|
398
|
-
if (!task.finished && !task.aborted) throw new Error(t('system.ai.
|
|
399
|
+
if (!task.finished && !task.aborted) throw new Error(t('system.ai.response_incomplete'))
|
|
399
400
|
handledByStream = true
|
|
400
401
|
}
|
|
401
402
|
if (!handledByStream) {
|
|
402
403
|
const response = await defAiMessageService.SendAiMessage(request)
|
|
403
404
|
const nextMessages = normalizeNonStreamMessages(response)
|
|
404
|
-
if (!nextMessages.length) throw new Error(t('system.ai.
|
|
405
|
+
if (!nextMessages.length) throw new Error(t('system.ai.response_empty'))
|
|
405
406
|
updateSessionMessages(sessionID, (current) => replacePendingMessages(current, nextMessages))
|
|
406
407
|
scrollChatToBottom()
|
|
407
408
|
if (response.session) upsertSession(normalizeSession(response.session))
|
|
@@ -412,7 +413,7 @@ export default function AiPage() {
|
|
|
412
413
|
if (task?.aborted) return false
|
|
413
414
|
updateSessionMessages(sessionID, markThinkingMessageFailed)
|
|
414
415
|
scrollChatToBottom()
|
|
415
|
-
showError(error, t('system.ai.
|
|
416
|
+
showError(error, t('system.ai.request_failed'))
|
|
416
417
|
return false
|
|
417
418
|
} finally {
|
|
418
419
|
if (task && runningStreamTaskMap.current.get(sessionID) === task) {
|
|
@@ -439,7 +440,7 @@ export default function AiPage() {
|
|
|
439
440
|
})
|
|
440
441
|
|
|
441
442
|
useEffect(() => {
|
|
442
|
-
void Taro.setNavigationBarTitle({ title: t('system.ai.
|
|
443
|
+
void Taro.setNavigationBarTitle({ title: t('system.ai.chat_title') })
|
|
443
444
|
setStarterShortcuts(createDefaultShortcuts())
|
|
444
445
|
setStarterPromptGroupIndex(0)
|
|
445
446
|
}, [locale])
|
|
@@ -479,16 +480,16 @@ export default function AiPage() {
|
|
|
479
480
|
setSessionKeyword('')
|
|
480
481
|
setShowSessionDrawer(false)
|
|
481
482
|
} catch (error) {
|
|
482
|
-
showError(error, t('system.ai.
|
|
483
|
+
showError(error, t('system.ai.create_session_failed'))
|
|
483
484
|
}
|
|
484
485
|
}
|
|
485
486
|
|
|
486
487
|
const deleteSession = async (sessionID: string) => {
|
|
487
488
|
const session = sessionsRef.current.find((item) => item.id === sessionID)
|
|
488
489
|
const result = await Taro.showModal({
|
|
489
|
-
title: t('system.ai.
|
|
490
|
-
content: t('system.ai.
|
|
491
|
-
title: session?.title || t('system.ai.
|
|
490
|
+
title: t('system.ai.delete_session'),
|
|
491
|
+
content: t('system.ai.delete_session_confirm', {
|
|
492
|
+
title: session?.title || t('system.ai.current_session'),
|
|
492
493
|
}),
|
|
493
494
|
confirmText: t('common.action.delete'),
|
|
494
495
|
confirmColor: '#cf4444',
|
|
@@ -505,13 +506,13 @@ export default function AiPage() {
|
|
|
505
506
|
await ensureActiveSession()
|
|
506
507
|
}
|
|
507
508
|
} catch (error) {
|
|
508
|
-
showError(error, t('system.ai.
|
|
509
|
+
showError(error, t('system.ai.delete_session_failed'))
|
|
509
510
|
}
|
|
510
511
|
}
|
|
511
512
|
|
|
512
513
|
const handleSessionAction = async (session: AiSession) => {
|
|
513
514
|
try {
|
|
514
|
-
const result = await Taro.showActionSheet({ itemList: [t('system.ai.
|
|
515
|
+
const result = await Taro.showActionSheet({ itemList: [t('system.ai.delete_session')] })
|
|
515
516
|
if (result.tapIndex === 0) await deleteSession(session.id)
|
|
516
517
|
} catch {
|
|
517
518
|
// 用户取消操作无需提示。
|
|
@@ -520,7 +521,7 @@ export default function AiPage() {
|
|
|
520
521
|
|
|
521
522
|
const copyMessage = async (item: ChatMessageItem) => {
|
|
522
523
|
await Taro.setClipboardData({ data: item.content })
|
|
523
|
-
await Taro.showToast({ icon: 'none', title: t('system.ai.
|
|
524
|
+
await Taro.showToast({ icon: 'none', title: t('system.ai.copy_success') })
|
|
524
525
|
}
|
|
525
526
|
|
|
526
527
|
const deleteMessage = async (item: ChatMessageItem) => {
|
|
@@ -532,7 +533,7 @@ export default function AiPage() {
|
|
|
532
533
|
}
|
|
533
534
|
updateSessionMessages(sessionID, (current) => current.filter((message) => message.messageID !== item.messageID))
|
|
534
535
|
} catch (error) {
|
|
535
|
-
showError(error, t('system.ai.
|
|
536
|
+
showError(error, t('system.ai.delete_message_failed'))
|
|
536
537
|
}
|
|
537
538
|
}
|
|
538
539
|
|
|
@@ -545,7 +546,7 @@ export default function AiPage() {
|
|
|
545
546
|
updateSessionMessages(sessionID, normalizeMessageList(response.messages))
|
|
546
547
|
if (response.session) upsertSession(normalizeSession(response.session))
|
|
547
548
|
} catch (error) {
|
|
548
|
-
showError(error, t('system.ai.
|
|
549
|
+
showError(error, t('system.ai.regenerate_failed'))
|
|
549
550
|
} finally {
|
|
550
551
|
setSessionSending(sessionID, false)
|
|
551
552
|
}
|
|
@@ -575,7 +576,7 @@ export default function AiPage() {
|
|
|
575
576
|
|
|
576
577
|
const handleSend = async () => {
|
|
577
578
|
if (isSubmitDisabled) return
|
|
578
|
-
const text = inputText.trim() || t('system.ai.
|
|
579
|
+
const text = inputText.trim() || t('system.ai.attachment_answer')
|
|
579
580
|
const attachments = [...selectedAttachments]
|
|
580
581
|
setInputText('')
|
|
581
582
|
setSelectedAttachments([])
|
|
@@ -587,7 +588,7 @@ export default function AiPage() {
|
|
|
587
588
|
if (selectedAttachments.length >= MAX_ATTACHMENT_COUNT) {
|
|
588
589
|
await Taro.showToast({
|
|
589
590
|
icon: 'none',
|
|
590
|
-
title: t('system.ai.
|
|
591
|
+
title: t('system.ai.attachment_limit', { count: MAX_ATTACHMENT_COUNT }),
|
|
591
592
|
})
|
|
592
593
|
return
|
|
593
594
|
}
|
|
@@ -600,7 +601,7 @@ export default function AiPage() {
|
|
|
600
601
|
path,
|
|
601
602
|
name:
|
|
602
603
|
result.tempFiles[index]?.originalFileObj?.name ||
|
|
603
|
-
t('system.ai.
|
|
604
|
+
t('system.ai.image_name', { index: index + 1 }),
|
|
604
605
|
size: Number(result.tempFiles[index]?.size || 0),
|
|
605
606
|
}))
|
|
606
607
|
setUploadingAttachment(true)
|
|
@@ -615,7 +616,7 @@ export default function AiPage() {
|
|
|
615
616
|
setSelectedAttachments((current) => [...current, ...attachments].slice(0, MAX_ATTACHMENT_COUNT))
|
|
616
617
|
} catch (error) {
|
|
617
618
|
const message = error instanceof Error ? error.message : String(error)
|
|
618
|
-
if (!/cancel/i.test(message)) showError(error, t('system.ai.
|
|
619
|
+
if (!/cancel/i.test(message)) showError(error, t('system.ai.upload_failed'))
|
|
619
620
|
} finally {
|
|
620
621
|
setUploadingAttachment(false)
|
|
621
622
|
}
|
|
@@ -633,7 +634,7 @@ export default function AiPage() {
|
|
|
633
634
|
<Button className='nav-back-button' hoverClass='none' onClick={navigateBack}>
|
|
634
635
|
<UniIcon type='left' size={24} color='#111' />
|
|
635
636
|
</Button>
|
|
636
|
-
<View className='ai-navbar__title'>{t('system.ai.
|
|
637
|
+
<View className='ai-navbar__title'>{t('system.ai.chat_title')}</View>
|
|
637
638
|
<Button className='nav-menu-button' hoverClass='none' onClick={() => setShowSessionDrawer((open) => !open)}>
|
|
638
639
|
<UniIcon type='bars' size={24} color='#111' />
|
|
639
640
|
</Button>
|
|
@@ -667,11 +668,11 @@ export default function AiPage() {
|
|
|
667
668
|
className={`message-row ${item.role === 'user' ? 'is-user' : 'is-ai'}`}
|
|
668
669
|
>
|
|
669
670
|
<View
|
|
670
|
-
className={`bubble ${item.role === 'ai' ? 'ai-bubble' : 'user-bubble'}${item.status === AiMessageStatus.
|
|
671
|
+
className={`bubble ${item.role === 'ai' ? 'ai-bubble' : 'user-bubble'}${item.status === AiMessageStatus.AI_MESSAGE_STATUS_GENERATING ? ' is-streaming' : ''}`}
|
|
671
672
|
onLongPress={() => void handleMessageAction(item)}
|
|
672
673
|
>
|
|
673
674
|
{item.role === 'ai' && item.model ? (
|
|
674
|
-
<View className='reply-meta'><Text className='reply-tag'>{t('system.ai.
|
|
675
|
+
<View className='reply-meta'><Text className='reply-tag'>{t('system.ai.model_reply')}</Text><Text className='reply-model'>{item.model}</Text></View>
|
|
675
676
|
) : null}
|
|
676
677
|
<View className='bubble-content'>{item.content}</View>
|
|
677
678
|
{item.attachments.length ? (
|
|
@@ -682,7 +683,7 @@ export default function AiPage() {
|
|
|
682
683
|
className='attachment-card'
|
|
683
684
|
onClick={() => previewAttachment(attachment, item.attachments)}
|
|
684
685
|
>
|
|
685
|
-
<View className='attachment-icon'>{isImageAttachment(attachment) ? t('system.ai.
|
|
686
|
+
<View className='attachment-icon'>{isImageAttachment(attachment) ? t('system.ai.image_attachment') : t('system.ai.attachment')}</View>
|
|
686
687
|
<View className='attachment-info'>
|
|
687
688
|
<View className='attachment-name'>{attachment.name}</View>
|
|
688
689
|
<View className='attachment-meta'>{formatAttachmentMeta(attachment)}</View>
|
|
@@ -691,14 +692,14 @@ export default function AiPage() {
|
|
|
691
692
|
))}
|
|
692
693
|
</View>
|
|
693
694
|
) : null}
|
|
694
|
-
{item.tools.length ? <View className='tool-row'>{t('system.ai.
|
|
695
|
+
{item.tools.length ? <View className='tool-row'>{t('system.ai.tool_called', { tools: formatTools(item.tools) })}</View> : null}
|
|
695
696
|
</View>
|
|
696
697
|
</View>
|
|
697
698
|
))}
|
|
698
699
|
<View id='chat-bottom' className='chat-bottom' />
|
|
699
700
|
</View>
|
|
700
701
|
)}
|
|
701
|
-
{loadingSessionID ? <View className='loading-session'>{t('system.ai.
|
|
702
|
+
{loadingSessionID ? <View className='loading-session'>{t('system.ai.load_messages')}</View> : null}
|
|
702
703
|
</ScrollView>
|
|
703
704
|
<Composer
|
|
704
705
|
value={inputText}
|
|
@@ -714,7 +715,7 @@ export default function AiPage() {
|
|
|
714
715
|
setIsRecording((recording) => {
|
|
715
716
|
void Taro.showToast({
|
|
716
717
|
icon: 'none',
|
|
717
|
-
title: !recording ? t('system.ai.recognizing') : t('system.ai.
|
|
718
|
+
title: !recording ? t('system.ai.recognizing') : t('system.ai.speech_stopped'),
|
|
718
719
|
})
|
|
719
720
|
return !recording
|
|
720
721
|
})
|
|
@@ -742,7 +743,7 @@ export default function AiPage() {
|
|
|
742
743
|
function normalizeSession(session?: Partial<AiSession> | null): AiSession {
|
|
743
744
|
return {
|
|
744
745
|
id: String(session?.id ?? ''),
|
|
745
|
-
title: String(session?.title ?? t('system.ai.
|
|
746
|
+
title: String(session?.title ?? t('system.ai.new_session')),
|
|
746
747
|
summary: String(session?.summary ?? ''),
|
|
747
748
|
updated_at: session?.updated_at,
|
|
748
749
|
terminal: Number(session?.terminal ?? AI_TERMINAL),
|
|
@@ -772,7 +773,7 @@ function normalizeMessageList(list?: AiMessage[] | null) {
|
|
|
772
773
|
}
|
|
773
774
|
|
|
774
775
|
function hasSuccessfulAiMessages(list: ChatMessageItem[]) {
|
|
775
|
-
return list.some((item) => item.status === AiMessageStatus.
|
|
776
|
+
return list.some((item) => item.status === AiMessageStatus.AI_MESSAGE_STATUS_SUCCESS)
|
|
776
777
|
}
|
|
777
778
|
|
|
778
779
|
function mapMessageItem(message: AiMessage, role: ChatRole): ChatMessageItem {
|
|
@@ -788,7 +789,7 @@ function mapMessageItem(message: AiMessage, role: ChatRole): ChatMessageItem {
|
|
|
788
789
|
step: message.output_content?.step ?? '',
|
|
789
790
|
blocks_json: message.output_content?.blocks_json ?? '',
|
|
790
791
|
}
|
|
791
|
-
const status = Number(message.status ?? AiMessageStatus.
|
|
792
|
+
const status = Number(message.status ?? AiMessageStatus.AI_MESSAGE_STATUS_SUCCESS)
|
|
792
793
|
return {
|
|
793
794
|
...message,
|
|
794
795
|
key: `${message.id}:${role}`,
|
|
@@ -824,14 +825,14 @@ function createLocalUserMessage(payload: { text: string; attachments: AiAttachme
|
|
|
824
825
|
output_content: undefined,
|
|
825
826
|
attachments: payload.attachments,
|
|
826
827
|
created_at: { seconds: Math.floor(now / 1000), nanos: (now % 1000) * 1_000_000 },
|
|
827
|
-
status: AiMessageStatus.
|
|
828
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_GENERATING,
|
|
828
829
|
token: { input: 0, output: 0, cache: 0, total: 0 },
|
|
829
830
|
tools: [],
|
|
830
831
|
first_token_ms: 0,
|
|
831
832
|
duration_ms: 0,
|
|
832
833
|
}, 'user')
|
|
833
834
|
message.localOnly = true
|
|
834
|
-
message.status = AiMessageStatus.
|
|
835
|
+
message.status = AiMessageStatus.AI_MESSAGE_STATUS_GENERATING
|
|
835
836
|
return message
|
|
836
837
|
}
|
|
837
838
|
|
|
@@ -849,7 +850,7 @@ function createThinkingMessage(options?: { sessionID?: string; messageID?: strin
|
|
|
849
850
|
},
|
|
850
851
|
attachments: [],
|
|
851
852
|
created_at: { seconds: Math.floor(now / 1000), nanos: (now % 1000) * 1_000_000 },
|
|
852
|
-
status: AiMessageStatus.
|
|
853
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_GENERATING,
|
|
853
854
|
token: { input: 0, output: 0, cache: 0, total: 0 },
|
|
854
855
|
tools: [],
|
|
855
856
|
first_token_ms: 0,
|
|
@@ -883,7 +884,7 @@ function appendStreamingDelta(current: ChatMessageItem[], payload: AiStreamPaylo
|
|
|
883
884
|
return current.map((item) => {
|
|
884
885
|
if (item.streamKey !== streamKey || item.role === 'user') return item
|
|
885
886
|
const baseContent = item.content === t('system.ai.thinking') ? '' : item.content
|
|
886
|
-
return { ...item, content: `${baseContent}${payload.delta}`, status: AiMessageStatus.
|
|
887
|
+
return { ...item, content: `${baseContent}${payload.delta}`, status: AiMessageStatus.AI_MESSAGE_STATUS_GENERATING }
|
|
887
888
|
})
|
|
888
889
|
}
|
|
889
890
|
|
|
@@ -892,8 +893,8 @@ function markThinkingMessageFailed(current: ChatMessageItem[]) {
|
|
|
892
893
|
item.localOnly
|
|
893
894
|
? {
|
|
894
895
|
...item,
|
|
895
|
-
status: AiMessageStatus.
|
|
896
|
-
content: item.role === 'ai' ? t('system.ai.
|
|
896
|
+
status: AiMessageStatus.AI_MESSAGE_STATUS_FAILED,
|
|
897
|
+
content: item.role === 'ai' ? t('system.ai.failed_response') : item.content,
|
|
897
898
|
}
|
|
898
899
|
: item,
|
|
899
900
|
)
|
|
@@ -903,7 +904,7 @@ function markStreamingError(current: ChatMessageItem[], payload: AiStreamPayload
|
|
|
903
904
|
const streamKey = buildStreamMessageKey(payload.session_id, payload.message_id)
|
|
904
905
|
return current.map((item) =>
|
|
905
906
|
item.localOnly && item.streamKey === streamKey
|
|
906
|
-
? { ...item, status: AiMessageStatus.
|
|
907
|
+
? { ...item, status: AiMessageStatus.AI_MESSAGE_STATUS_FAILED, content: t('system.ai.failed_response') }
|
|
907
908
|
: item,
|
|
908
909
|
)
|
|
909
910
|
}
|
|
@@ -932,7 +933,7 @@ function normalizeNonStreamMessages(response: unknown) {
|
|
|
932
933
|
const finishEvent = [...events].reverse().find((item) => item.event === 'finish')
|
|
933
934
|
if (finishEvent) return normalizeMessageList(finishEvent.payload.messages)
|
|
934
935
|
if ([...events].reverse().some((item) => item.event === 'error')) {
|
|
935
|
-
throw new Error(t('system.ai.
|
|
936
|
+
throw new Error(t('system.ai.request_failed'))
|
|
936
937
|
}
|
|
937
938
|
return []
|
|
938
939
|
}
|
|
@@ -982,38 +983,38 @@ function createDefaultShortcuts(): AiShortcut[] {
|
|
|
982
983
|
{
|
|
983
984
|
key: 'summarize',
|
|
984
985
|
title: t('system.ai.prompt.summary'),
|
|
985
|
-
prompt: t('system.ai.prompt.
|
|
986
|
+
prompt: t('system.ai.prompt.summary_content'),
|
|
986
987
|
action: undefined,
|
|
987
988
|
required_tools: [],
|
|
988
989
|
sort: 1,
|
|
989
|
-
group: t('system.ai.
|
|
990
|
+
group: t('system.ai.text_assistant'),
|
|
990
991
|
},
|
|
991
992
|
{
|
|
992
993
|
key: 'rewrite',
|
|
993
994
|
title: t('system.ai.prompt.optimize'),
|
|
994
|
-
prompt: t('system.ai.prompt.
|
|
995
|
+
prompt: t('system.ai.prompt.optimize_content'),
|
|
995
996
|
action: undefined,
|
|
996
997
|
required_tools: [],
|
|
997
998
|
sort: 2,
|
|
998
|
-
group: t('system.ai.
|
|
999
|
+
group: t('system.ai.text_assistant'),
|
|
999
1000
|
},
|
|
1000
1001
|
{
|
|
1001
1002
|
key: 'plan',
|
|
1002
1003
|
title: t('system.ai.prompt.plan'),
|
|
1003
|
-
prompt: t('system.ai.prompt.
|
|
1004
|
+
prompt: t('system.ai.prompt.plan_content'),
|
|
1004
1005
|
action: undefined,
|
|
1005
1006
|
required_tools: [],
|
|
1006
1007
|
sort: 3,
|
|
1007
|
-
group: t('system.ai.
|
|
1008
|
+
group: t('system.ai.efficiency_assistant'),
|
|
1008
1009
|
},
|
|
1009
1010
|
{
|
|
1010
1011
|
key: 'ideas',
|
|
1011
1012
|
title: t('system.ai.prompt.idea'),
|
|
1012
|
-
prompt: t('system.ai.prompt.
|
|
1013
|
+
prompt: t('system.ai.prompt.idea_content'),
|
|
1013
1014
|
action: undefined,
|
|
1014
1015
|
required_tools: [],
|
|
1015
1016
|
sort: 4,
|
|
1016
|
-
group: t('system.ai.
|
|
1017
|
+
group: t('system.ai.efficiency_assistant'),
|
|
1017
1018
|
},
|
|
1018
1019
|
]
|
|
1019
1020
|
}
|
|
@@ -72,9 +72,9 @@ export default function ProfilePage() {
|
|
|
72
72
|
await defAuthService.UpdateUserProfile(nextProfile)
|
|
73
73
|
setUserInfo(nextProfile)
|
|
74
74
|
await useUserStore.getState().getUserProfile()
|
|
75
|
-
await Taro.showToast({ icon: 'success', title: t('system.profile.
|
|
75
|
+
await Taro.showToast({ icon: 'success', title: t('system.profile.update_success') })
|
|
76
76
|
} catch {
|
|
77
|
-
await Taro.showToast({ icon: 'error', title: t('system.profile.
|
|
77
|
+
await Taro.showToast({ icon: 'error', title: t('system.profile.avatar_upload_failed') })
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -87,7 +87,7 @@ export default function ProfilePage() {
|
|
|
87
87
|
const file = selected.tempFiles[0]
|
|
88
88
|
const filePath = 'tempFilePath' in file ? file.tempFilePath : file.path
|
|
89
89
|
if (file.size > IMG_MAX_SIZE) {
|
|
90
|
-
await Taro.showToast({ title: t('system.profile.
|
|
90
|
+
await Taro.showToast({ title: t('system.profile.photo_limit'), icon: 'none', duration: 1500 })
|
|
91
91
|
return
|
|
92
92
|
}
|
|
93
93
|
await uploadAvatar(filePath)
|
|
@@ -98,14 +98,14 @@ export default function ProfilePage() {
|
|
|
98
98
|
const response = await defAuthService.BindUserPhone({ code: event.detail.code || '' })
|
|
99
99
|
setUserInfo((current) => ({ ...current, phone: response.phone }))
|
|
100
100
|
await useUserStore.getState().getUserProfile()
|
|
101
|
-
await Taro.showToast({ icon: 'success', title: t('system.profile.
|
|
101
|
+
await Taro.showToast({ icon: 'success', title: t('system.profile.phone_authorization_success') })
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
const onSubmit = async () => {
|
|
105
105
|
if (!requireAuth()) return
|
|
106
106
|
await defAuthService.UpdateUserProfile(userInfo)
|
|
107
107
|
await useUserStore.getState().getUserProfile()
|
|
108
|
-
await Taro.showToast({ icon: 'success', title: t('system.profile.
|
|
108
|
+
await Taro.showToast({ icon: 'success', title: t('system.profile.save_success') })
|
|
109
109
|
setTimeout(() => void Taro.navigateBack(), 400)
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -118,7 +118,7 @@ export default function ProfilePage() {
|
|
|
118
118
|
<View className='profile-avatar'>
|
|
119
119
|
<View className='profile-avatar__content' onClick={() => void onAvatarChange()}>
|
|
120
120
|
<Image className='profile-avatar__image' src={userInfo.avatar ? formatSrc(userInfo.avatar) : defaultAvatar} mode='aspectFill' />
|
|
121
|
-
<Text className='profile-avatar__text'>{t('system.profile.
|
|
121
|
+
<Text className='profile-avatar__text'>{t('system.profile.avatar_change')}</Text>
|
|
122
122
|
</View>
|
|
123
123
|
</View>
|
|
124
124
|
<View className='profile-form'>
|
|
@@ -136,14 +136,14 @@ export default function ProfilePage() {
|
|
|
136
136
|
{userInfo.phone ? (
|
|
137
137
|
<Text className='profile-account'>{userInfo.phone}</Text>
|
|
138
138
|
) : (
|
|
139
|
-
<Button className='profile-auth-button' openType='getPhoneNumber' onGetPhoneNumber={onGetPhoneNumber}>{t('system.profile.
|
|
139
|
+
<Button className='profile-auth-button' openType='getPhoneNumber' onGetPhoneNumber={onGetPhoneNumber}>{t('system.profile.phone_authorization')}</Button>
|
|
140
140
|
)}
|
|
141
141
|
</View>
|
|
142
142
|
</View>
|
|
143
143
|
) : null}
|
|
144
144
|
<View className='profile-form__item'>
|
|
145
|
-
<Text className='profile-label'>{t('system.profile.
|
|
146
|
-
<Input className='profile-input' placeholder={t('system.profile.
|
|
145
|
+
<Text className='profile-label'>{t('system.profile.nick_name')}</Text>
|
|
146
|
+
<Input className='profile-input' placeholder={t('system.profile.nick_name_placeholder')} value={userInfo.nick_name} onInput={(event) => setUserInfo((current) => ({ ...current, nick_name: event.detail.value }))} />
|
|
147
147
|
</View>
|
|
148
148
|
<View className='profile-form__item'>
|
|
149
149
|
<Text className='profile-label'>{t('system.profile.gender')}</Text>
|
|
@@ -18,7 +18,7 @@ export default function SettingsPage() {
|
|
|
18
18
|
const authenticated = useUserStore((state) => state.isAuthenticated())
|
|
19
19
|
const ensureAuthenticated = useUserStore((state) => state.ensureAuthenticated)
|
|
20
20
|
const logout = useUserStore((state) => state.logout)
|
|
21
|
-
const localeLabels = useMemo(() => languageOptions.map((item) => item.
|
|
21
|
+
const localeLabels = useMemo(() => languageOptions.map((item) => item.native_name), [languageOptions])
|
|
22
22
|
const localeIndex = Math.max(0, languageOptions.findIndex((item) => item.language_code === locale))
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
@@ -32,7 +32,7 @@ export default function SettingsPage() {
|
|
|
32
32
|
const onLogout = async () => {
|
|
33
33
|
if (logoutLoading) return
|
|
34
34
|
const result = await Taro.showModal({
|
|
35
|
-
content: t('system.settings.
|
|
35
|
+
content: t('system.settings.logout_confirm'),
|
|
36
36
|
confirmColor: '#27BA9B',
|
|
37
37
|
})
|
|
38
38
|
if (!result.confirm) return
|
|
@@ -41,7 +41,7 @@ export default function SettingsPage() {
|
|
|
41
41
|
await logout()
|
|
42
42
|
await Taro.navigateBack()
|
|
43
43
|
} catch {
|
|
44
|
-
await Taro.showToast({ icon: 'none', title: t('system.settings.
|
|
44
|
+
await Taro.showToast({ icon: 'none', title: t('system.settings.logout_failed') })
|
|
45
45
|
} finally {
|
|
46
46
|
setLogoutLoading(false)
|
|
47
47
|
}
|
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
|
-
}
|