@liujitcn/kratos-uni-app-system 0.0.62 → 0.0.64

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  ```text
8
8
  packages/modules/system
9
9
  ├── src
10
- │ ├── api/base/v1 # AI 消息、会话和工具接口
10
+ │ ├── api/base/v1 # AI 消息、会话、快捷入口和Provider模型选项接口
11
11
  │ ├── rpc # system 相关 Buf 生成类型
12
12
  │ ├── views
13
13
  │ │ ├── pages/my # 个人中心主页
package/dist/index.mjs CHANGED
@@ -271,6 +271,7 @@ var zh_CN_default = {
271
271
  "system.ai.delete_session_failed": "\u5220\u9664\u4F1A\u8BDD\u5931\u8D25",
272
272
  "system.ai.efficiency_assistant": "\u6548\u7387\u52A9\u624B",
273
273
  "system.ai.failed_response": "\u8FD9\u6B21\u56DE\u590D\u6CA1\u6709\u6210\u529F\u8FD4\u56DE\uFF0C\u4F60\u53EF\u4EE5\u76F4\u63A5\u91CD\u8BD5\u521A\u624D\u7684\u95EE\u9898\u3002",
274
+ "system.ai.chat.error.details_unavailable": "\u804A\u5929\u754C\u9762\u4E0D\u5C55\u793A\u5E95\u5C42\u670D\u52A1\u9519\u8BEF\u8BE6\u60C5\uFF0C\u8BF7\u67E5\u770B\u670D\u52A1\u65E5\u5FD7\u3002",
274
275
  "system.ai.general_assistant": "\u901A\u7528\u52A9\u624B",
275
276
  "system.ai.greeting": "\u60A8\u597D\uFF0C{period}\u597D\uFF01\u4ECA\u5929\u6709\u4EC0\u4E48\u9700\u8981\u6211\u534F\u52A9\u7684\u5417\uFF1F",
276
277
  "system.ai.greeting_hello": "\u60A8\u597D\uFF0CAI\u52A9\u624B\u4E3A\u60A8\u670D\u52A1\uFF01",
@@ -318,6 +319,7 @@ var zh_CN_default = {
318
319
  "system.ai.text_assistant": "\u6587\u672C\u52A9\u624B",
319
320
  "system.ai.thinking": "\u6B63\u5728\u56DE\u590D",
320
321
  "system.ai.tool_called": "\u5DF2\u8C03\u7528\uFF1A{tools}",
322
+ "system.ai.web_search": "\u8054\u7F51\u641C\u7D22",
321
323
  "system.ai.upload_failed": "\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25",
322
324
  "system.profile.account": "\u8D26\u53F7",
323
325
  "system.profile.avatar_change": "\u70B9\u51FB\u4FEE\u6539\u5934\u50CF",
@@ -353,6 +355,7 @@ var zh_CN_default = {
353
355
  "system.settings.ai_title": "\u667A\u80FD\u52A9\u624B",
354
356
  "system.settings.go_ask": "\u53BB\u63D0\u95EE",
355
357
  "system.notification.title": "\u6D88\u606F\u4E2D\u5FC3",
358
+ "system.notification.sender.system": "\u7CFB\u7EDF",
356
359
  "system.notification.description": "\u67E5\u770B\u7CFB\u7EDF\u901A\u77E5\u548C\u4E1A\u52A1\u6D88\u606F",
357
360
  "system.notification.empty": "\u6682\u65E0\u6D88\u606F",
358
361
  "system.notification.action.view_all": "\u67E5\u770B\u5168\u90E8",
@@ -363,7 +366,10 @@ var zh_CN_default = {
363
366
  "system.notification.mark_all_read": "\u5168\u90E8\u5DF2\u8BFB",
364
367
  "system.notification.action.archive": "\u5F52\u6863",
365
368
  "system.notification.action.restore": "\u6062\u590D",
366
- "system.notification.action.delete": "\u5220\u9664"
369
+ "system.notification.action.delete": "\u5220\u9664",
370
+ "system.ai.model.provider_placeholder": "\u9009\u62E9\u4F9B\u5E94\u5546",
371
+ "system.ai.model.model_placeholder": "\u9009\u62E9\u6A21\u578B",
372
+ "system.ai.model.load_failed": "\u52A0\u8F7D\u4F9B\u5E94\u5546\u548C\u6A21\u578B\u5931\u8D25"
367
373
  };
368
374
 
369
375
  // src/locales/en-US.json
@@ -384,6 +390,7 @@ var en_US_default = {
384
390
  "system.ai.delete_session_failed": "Failed to delete session",
385
391
  "system.ai.efficiency_assistant": "Productivity assistant",
386
392
  "system.ai.failed_response": "The response did not complete. You can retry your previous question.",
393
+ "system.ai.chat.error.details_unavailable": "Provider error details are not exposed in chat. See the service logs.",
387
394
  "system.ai.general_assistant": "General assistant",
388
395
  "system.ai.greeting": "Good {period}, how can I help you today?",
389
396
  "system.ai.greeting_hello": "Hello, your AI assistant is ready to help.",
@@ -431,6 +438,7 @@ var en_US_default = {
431
438
  "system.ai.text_assistant": "Writing assistant",
432
439
  "system.ai.thinking": "Responding",
433
440
  "system.ai.tool_called": "Tools used: {tools}",
441
+ "system.ai.web_search": "Web search",
434
442
  "system.ai.upload_failed": "Attachment upload failed",
435
443
  "system.profile.account": "Account",
436
444
  "system.profile.avatar_change": "Tap to change avatar",
@@ -466,6 +474,7 @@ var en_US_default = {
466
474
  "system.settings.ai_title": "AI Assistant",
467
475
  "system.settings.go_ask": "Ask now",
468
476
  "system.notification.title": "Message Center",
477
+ "system.notification.sender.system": "System",
469
478
  "system.notification.description": "View system notifications and business messages",
470
479
  "system.notification.empty": "No messages",
471
480
  "system.notification.action.view_all": "View all",
@@ -476,7 +485,10 @@ var en_US_default = {
476
485
  "system.notification.mark_all_read": "Mark all read",
477
486
  "system.notification.action.archive": "Archive",
478
487
  "system.notification.action.restore": "Restore",
479
- "system.notification.action.delete": "Delete"
488
+ "system.notification.action.delete": "Delete",
489
+ "system.ai.model.provider_placeholder": "Select a provider",
490
+ "system.ai.model.model_placeholder": "Select a model",
491
+ "system.ai.model.load_failed": "Failed to load providers and models"
480
492
  };
481
493
 
482
494
  // src/locales/ja-JP.json
@@ -497,6 +509,7 @@ var ja_JP_default = {
497
509
  "system.ai.delete_session_failed": "\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
498
510
  "system.ai.efficiency_assistant": "\u52B9\u7387\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
499
511
  "system.ai.failed_response": "\u4ECA\u56DE\u306F\u5FDC\u7B54\u304C\u6B63\u5E38\u306B\u8FD4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u8CEA\u554F\u3092\u76F4\u63A5\u518D\u8A66\u884C\u3067\u304D\u307E\u3059\u3002",
512
+ "system.ai.chat.error.details_unavailable": "\u30C1\u30E3\u30C3\u30C8\u3067\u306F\u5185\u90E8\u30A8\u30E9\u30FC\u306E\u8A73\u7D30\u306F\u8868\u793A\u3055\u308C\u307E\u305B\u3093\u3002\u30B5\u30FC\u30D3\u30B9\u30ED\u30B0\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
500
513
  "system.ai.general_assistant": "\u30E6\u30CB\u30D0\u30FC\u30B5\u30EB \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
501
514
  "system.ai.greeting": "\u3053\u3093\u306B\u3061\u306F\u3001{period} \u3053\u3093\u306B\u3061\u306F\uFF01\u4ECA\u65E5\u306F\u4F55\u304B\u304A\u624B\u4F1D\u3044\u304C\u5FC5\u8981\u306A\u3053\u3068\u306F\u3042\u308A\u307E\u3059\u304B?",
502
515
  "system.ai.greeting_hello": "\u3053\u3093\u306B\u3061\u306F\u3001AI \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u304C\u304A\u624B\u4F1D\u3044\u3057\u307E\u3059\u3002",
@@ -544,6 +557,7 @@ var ja_JP_default = {
544
557
  "system.ai.text_assistant": "\u30C6\u30AD\u30B9\u30C8 \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
545
558
  "system.ai.thinking": "\u304C\u8FD4\u4FE1\u3057\u3066\u3044\u307E\u3059",
546
559
  "system.ai.tool_called": "\u547C\u3073\u51FA\u3057\u5148: {tools}",
560
+ "system.ai.web_search": "\u30A6\u30A7\u30D6\u691C\u7D22",
547
561
  "system.ai.upload_failed": "\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
548
562
  "system.profile.account": "\u30A2\u30AB\u30A6\u30F3\u30C8",
549
563
  "system.profile.avatar_change": "\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30A2\u30D0\u30BF\u30FC\u3092\u5909\u66F4\u3057\u307E\u3059",
@@ -579,6 +593,7 @@ var ja_JP_default = {
579
593
  "system.settings.ai_title": "\u30A4\u30F3\u30C6\u30EA\u30B8\u30A7\u30F3\u30C8 \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
580
594
  "system.settings.go_ask": "\u8CEA\u554F\u3057\u3066\u307F\u3088\u3046",
581
595
  "system.notification.title": "\u30E1\u30C3\u30BB\u30FC\u30B8\u30BB\u30F3\u30BF\u30FC",
596
+ "system.notification.sender.system": "\u30B7\u30B9\u30C6\u30E0",
582
597
  "system.notification.description": "\u30B7\u30B9\u30C6\u30E0\u901A\u77E5\u3068\u696D\u52D9\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u78BA\u8A8D",
583
598
  "system.notification.empty": "\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093",
584
599
  "system.notification.action.view_all": "\u3059\u3079\u3066\u8868\u793A",
@@ -589,7 +604,10 @@ var ja_JP_default = {
589
604
  "system.notification.mark_all_read": "\u3059\u3079\u3066\u65E2\u8AAD",
590
605
  "system.notification.action.archive": "\u30A2\u30FC\u30AB\u30A4\u30D6",
591
606
  "system.notification.action.restore": "\u5FA9\u5143",
592
- "system.notification.action.delete": "\u524A\u9664"
607
+ "system.notification.action.delete": "\u524A\u9664",
608
+ "system.ai.model.provider_placeholder": "\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u3092\u9078\u629E",
609
+ "system.ai.model.model_placeholder": "\u30E2\u30C7\u30EB\u3092\u9078\u629E",
610
+ "system.ai.model.load_failed": "\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u3068\u30E2\u30C7\u30EB\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F"
593
611
  };
594
612
 
595
613
  // src/locales/zh-TW.json
@@ -610,6 +628,7 @@ var zh_TW_default = {
610
628
  "system.ai.delete_session_failed": "\u522A\u9664\u6703\u8A71\u5931\u6557",
611
629
  "system.ai.efficiency_assistant": "\u6548\u7387\u52A9\u624B",
612
630
  "system.ai.failed_response": "\u9019\u6B21\u56DE\u8986\u6C92\u6709\u6210\u529F\u8FD4\u56DE\uFF0C\u4F60\u53EF\u4EE5\u76F4\u63A5\u91CD\u8A66\u525B\u624D\u7684\u554F\u984C\u3002",
631
+ "system.ai.chat.error.details_unavailable": "\u804A\u5929\u4ECB\u9762\u4E0D\u6703\u986F\u793A\u5E95\u5C64\u670D\u52D9\u932F\u8AA4\u8A73\u60C5\uFF0C\u8ACB\u67E5\u770B\u670D\u52D9\u65E5\u8A8C\u3002",
613
632
  "system.ai.general_assistant": "\u901A\u7528\u52A9\u624B",
614
633
  "system.ai.greeting": "\u60A8\u597D\uFF0C{period}\u597D\uFF01\u4ECA\u5929\u6709\u4EC0\u9EBC\u9700\u8981\u6211\u5354\u52A9\u7684\u55CE\uFF1F",
615
634
  "system.ai.greeting_hello": "\u60A8\u597D\uFF0CAI\u52A9\u624B\u70BA\u60A8\u670D\u52D9\uFF01",
@@ -657,6 +676,7 @@ var zh_TW_default = {
657
676
  "system.ai.text_assistant": "\u6587\u5B57\u52A9\u624B",
658
677
  "system.ai.thinking": "\u6B63\u5728\u56DE\u8986",
659
678
  "system.ai.tool_called": "\u5DF2\u547C\u53EB\uFF1A{tools}",
679
+ "system.ai.web_search": "\u7DB2\u8DEF\u641C\u5C0B",
660
680
  "system.ai.upload_failed": "\u9644\u4EF6\u4E0A\u50B3\u5931\u6557",
661
681
  "system.profile.account": "\u8CEC\u865F",
662
682
  "system.profile.avatar_change": "\u9EDE\u9078\u4FEE\u6539\u982D\u50CF",
@@ -692,6 +712,7 @@ var zh_TW_default = {
692
712
  "system.settings.ai_title": "\u667A\u6167\u52A9\u624B",
693
713
  "system.settings.go_ask": "\u53BB\u63D0\u554F",
694
714
  "system.notification.title": "\u6D88\u606F\u4E2D\u5FC3",
715
+ "system.notification.sender.system": "\u7CFB\u7D71",
695
716
  "system.notification.description": "\u67E5\u770B\u7CFB\u7D71\u901A\u77E5\u548C\u696D\u52D9\u6D88\u606F",
696
717
  "system.notification.empty": "\u66AB\u7121\u6D88\u606F",
697
718
  "system.notification.action.view_all": "\u67E5\u770B\u5168\u90E8",
@@ -702,7 +723,10 @@ var zh_TW_default = {
702
723
  "system.notification.mark_all_read": "\u5168\u90E8\u5DF2\u8B80",
703
724
  "system.notification.action.archive": "\u6B78\u6A94",
704
725
  "system.notification.action.restore": "\u6062\u5FA9",
705
- "system.notification.action.delete": "\u522A\u9664"
726
+ "system.notification.action.delete": "\u522A\u9664",
727
+ "system.ai.model.provider_placeholder": "\u9078\u64C7\u4F9B\u61C9\u5546",
728
+ "system.ai.model.model_placeholder": "\u9078\u64C7\u6A21\u578B",
729
+ "system.ai.model.load_failed": "\u8F09\u5165\u4F9B\u61C9\u5546\u8207\u6A21\u578B\u5931\u6557"
706
730
  };
707
731
 
708
732
  // src/locales/generated.ts
package/dist/module.mjs CHANGED
@@ -51,6 +51,7 @@ var zh_CN_default = {
51
51
  "system.ai.delete_session_failed": "\u5220\u9664\u4F1A\u8BDD\u5931\u8D25",
52
52
  "system.ai.efficiency_assistant": "\u6548\u7387\u52A9\u624B",
53
53
  "system.ai.failed_response": "\u8FD9\u6B21\u56DE\u590D\u6CA1\u6709\u6210\u529F\u8FD4\u56DE\uFF0C\u4F60\u53EF\u4EE5\u76F4\u63A5\u91CD\u8BD5\u521A\u624D\u7684\u95EE\u9898\u3002",
54
+ "system.ai.chat.error.details_unavailable": "\u804A\u5929\u754C\u9762\u4E0D\u5C55\u793A\u5E95\u5C42\u670D\u52A1\u9519\u8BEF\u8BE6\u60C5\uFF0C\u8BF7\u67E5\u770B\u670D\u52A1\u65E5\u5FD7\u3002",
54
55
  "system.ai.general_assistant": "\u901A\u7528\u52A9\u624B",
55
56
  "system.ai.greeting": "\u60A8\u597D\uFF0C{period}\u597D\uFF01\u4ECA\u5929\u6709\u4EC0\u4E48\u9700\u8981\u6211\u534F\u52A9\u7684\u5417\uFF1F",
56
57
  "system.ai.greeting_hello": "\u60A8\u597D\uFF0CAI\u52A9\u624B\u4E3A\u60A8\u670D\u52A1\uFF01",
@@ -98,6 +99,7 @@ var zh_CN_default = {
98
99
  "system.ai.text_assistant": "\u6587\u672C\u52A9\u624B",
99
100
  "system.ai.thinking": "\u6B63\u5728\u56DE\u590D",
100
101
  "system.ai.tool_called": "\u5DF2\u8C03\u7528\uFF1A{tools}",
102
+ "system.ai.web_search": "\u8054\u7F51\u641C\u7D22",
101
103
  "system.ai.upload_failed": "\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25",
102
104
  "system.profile.account": "\u8D26\u53F7",
103
105
  "system.profile.avatar_change": "\u70B9\u51FB\u4FEE\u6539\u5934\u50CF",
@@ -133,6 +135,7 @@ var zh_CN_default = {
133
135
  "system.settings.ai_title": "\u667A\u80FD\u52A9\u624B",
134
136
  "system.settings.go_ask": "\u53BB\u63D0\u95EE",
135
137
  "system.notification.title": "\u6D88\u606F\u4E2D\u5FC3",
138
+ "system.notification.sender.system": "\u7CFB\u7EDF",
136
139
  "system.notification.description": "\u67E5\u770B\u7CFB\u7EDF\u901A\u77E5\u548C\u4E1A\u52A1\u6D88\u606F",
137
140
  "system.notification.empty": "\u6682\u65E0\u6D88\u606F",
138
141
  "system.notification.action.view_all": "\u67E5\u770B\u5168\u90E8",
@@ -143,7 +146,10 @@ var zh_CN_default = {
143
146
  "system.notification.mark_all_read": "\u5168\u90E8\u5DF2\u8BFB",
144
147
  "system.notification.action.archive": "\u5F52\u6863",
145
148
  "system.notification.action.restore": "\u6062\u590D",
146
- "system.notification.action.delete": "\u5220\u9664"
149
+ "system.notification.action.delete": "\u5220\u9664",
150
+ "system.ai.model.provider_placeholder": "\u9009\u62E9\u4F9B\u5E94\u5546",
151
+ "system.ai.model.model_placeholder": "\u9009\u62E9\u6A21\u578B",
152
+ "system.ai.model.load_failed": "\u52A0\u8F7D\u4F9B\u5E94\u5546\u548C\u6A21\u578B\u5931\u8D25"
147
153
  };
148
154
 
149
155
  // src/locales/en-US.json
@@ -164,6 +170,7 @@ var en_US_default = {
164
170
  "system.ai.delete_session_failed": "Failed to delete session",
165
171
  "system.ai.efficiency_assistant": "Productivity assistant",
166
172
  "system.ai.failed_response": "The response did not complete. You can retry your previous question.",
173
+ "system.ai.chat.error.details_unavailable": "Provider error details are not exposed in chat. See the service logs.",
167
174
  "system.ai.general_assistant": "General assistant",
168
175
  "system.ai.greeting": "Good {period}, how can I help you today?",
169
176
  "system.ai.greeting_hello": "Hello, your AI assistant is ready to help.",
@@ -211,6 +218,7 @@ var en_US_default = {
211
218
  "system.ai.text_assistant": "Writing assistant",
212
219
  "system.ai.thinking": "Responding",
213
220
  "system.ai.tool_called": "Tools used: {tools}",
221
+ "system.ai.web_search": "Web search",
214
222
  "system.ai.upload_failed": "Attachment upload failed",
215
223
  "system.profile.account": "Account",
216
224
  "system.profile.avatar_change": "Tap to change avatar",
@@ -246,6 +254,7 @@ var en_US_default = {
246
254
  "system.settings.ai_title": "AI Assistant",
247
255
  "system.settings.go_ask": "Ask now",
248
256
  "system.notification.title": "Message Center",
257
+ "system.notification.sender.system": "System",
249
258
  "system.notification.description": "View system notifications and business messages",
250
259
  "system.notification.empty": "No messages",
251
260
  "system.notification.action.view_all": "View all",
@@ -256,7 +265,10 @@ var en_US_default = {
256
265
  "system.notification.mark_all_read": "Mark all read",
257
266
  "system.notification.action.archive": "Archive",
258
267
  "system.notification.action.restore": "Restore",
259
- "system.notification.action.delete": "Delete"
268
+ "system.notification.action.delete": "Delete",
269
+ "system.ai.model.provider_placeholder": "Select a provider",
270
+ "system.ai.model.model_placeholder": "Select a model",
271
+ "system.ai.model.load_failed": "Failed to load providers and models"
260
272
  };
261
273
 
262
274
  // src/locales/ja-JP.json
@@ -277,6 +289,7 @@ var ja_JP_default = {
277
289
  "system.ai.delete_session_failed": "\u30BB\u30C3\u30B7\u30E7\u30F3\u306E\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
278
290
  "system.ai.efficiency_assistant": "\u52B9\u7387\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
279
291
  "system.ai.failed_response": "\u4ECA\u56DE\u306F\u5FDC\u7B54\u304C\u6B63\u5E38\u306B\u8FD4\u3055\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u8CEA\u554F\u3092\u76F4\u63A5\u518D\u8A66\u884C\u3067\u304D\u307E\u3059\u3002",
292
+ "system.ai.chat.error.details_unavailable": "\u30C1\u30E3\u30C3\u30C8\u3067\u306F\u5185\u90E8\u30A8\u30E9\u30FC\u306E\u8A73\u7D30\u306F\u8868\u793A\u3055\u308C\u307E\u305B\u3093\u3002\u30B5\u30FC\u30D3\u30B9\u30ED\u30B0\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
280
293
  "system.ai.general_assistant": "\u30E6\u30CB\u30D0\u30FC\u30B5\u30EB \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
281
294
  "system.ai.greeting": "\u3053\u3093\u306B\u3061\u306F\u3001{period} \u3053\u3093\u306B\u3061\u306F\uFF01\u4ECA\u65E5\u306F\u4F55\u304B\u304A\u624B\u4F1D\u3044\u304C\u5FC5\u8981\u306A\u3053\u3068\u306F\u3042\u308A\u307E\u3059\u304B?",
282
295
  "system.ai.greeting_hello": "\u3053\u3093\u306B\u3061\u306F\u3001AI \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u304C\u304A\u624B\u4F1D\u3044\u3057\u307E\u3059\u3002",
@@ -324,6 +337,7 @@ var ja_JP_default = {
324
337
  "system.ai.text_assistant": "\u30C6\u30AD\u30B9\u30C8 \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
325
338
  "system.ai.thinking": "\u304C\u8FD4\u4FE1\u3057\u3066\u3044\u307E\u3059",
326
339
  "system.ai.tool_called": "\u547C\u3073\u51FA\u3057\u5148: {tools}",
340
+ "system.ai.web_search": "\u30A6\u30A7\u30D6\u691C\u7D22",
327
341
  "system.ai.upload_failed": "\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
328
342
  "system.profile.account": "\u30A2\u30AB\u30A6\u30F3\u30C8",
329
343
  "system.profile.avatar_change": "\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30A2\u30D0\u30BF\u30FC\u3092\u5909\u66F4\u3057\u307E\u3059",
@@ -359,6 +373,7 @@ var ja_JP_default = {
359
373
  "system.settings.ai_title": "\u30A4\u30F3\u30C6\u30EA\u30B8\u30A7\u30F3\u30C8 \u30A2\u30B7\u30B9\u30BF\u30F3\u30C8",
360
374
  "system.settings.go_ask": "\u8CEA\u554F\u3057\u3066\u307F\u3088\u3046",
361
375
  "system.notification.title": "\u30E1\u30C3\u30BB\u30FC\u30B8\u30BB\u30F3\u30BF\u30FC",
376
+ "system.notification.sender.system": "\u30B7\u30B9\u30C6\u30E0",
362
377
  "system.notification.description": "\u30B7\u30B9\u30C6\u30E0\u901A\u77E5\u3068\u696D\u52D9\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u78BA\u8A8D",
363
378
  "system.notification.empty": "\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093",
364
379
  "system.notification.action.view_all": "\u3059\u3079\u3066\u8868\u793A",
@@ -369,7 +384,10 @@ var ja_JP_default = {
369
384
  "system.notification.mark_all_read": "\u3059\u3079\u3066\u65E2\u8AAD",
370
385
  "system.notification.action.archive": "\u30A2\u30FC\u30AB\u30A4\u30D6",
371
386
  "system.notification.action.restore": "\u5FA9\u5143",
372
- "system.notification.action.delete": "\u524A\u9664"
387
+ "system.notification.action.delete": "\u524A\u9664",
388
+ "system.ai.model.provider_placeholder": "\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u3092\u9078\u629E",
389
+ "system.ai.model.model_placeholder": "\u30E2\u30C7\u30EB\u3092\u9078\u629E",
390
+ "system.ai.model.load_failed": "\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u3068\u30E2\u30C7\u30EB\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F"
373
391
  };
374
392
 
375
393
  // src/locales/zh-TW.json
@@ -390,6 +408,7 @@ var zh_TW_default = {
390
408
  "system.ai.delete_session_failed": "\u522A\u9664\u6703\u8A71\u5931\u6557",
391
409
  "system.ai.efficiency_assistant": "\u6548\u7387\u52A9\u624B",
392
410
  "system.ai.failed_response": "\u9019\u6B21\u56DE\u8986\u6C92\u6709\u6210\u529F\u8FD4\u56DE\uFF0C\u4F60\u53EF\u4EE5\u76F4\u63A5\u91CD\u8A66\u525B\u624D\u7684\u554F\u984C\u3002",
411
+ "system.ai.chat.error.details_unavailable": "\u804A\u5929\u4ECB\u9762\u4E0D\u6703\u986F\u793A\u5E95\u5C64\u670D\u52D9\u932F\u8AA4\u8A73\u60C5\uFF0C\u8ACB\u67E5\u770B\u670D\u52D9\u65E5\u8A8C\u3002",
393
412
  "system.ai.general_assistant": "\u901A\u7528\u52A9\u624B",
394
413
  "system.ai.greeting": "\u60A8\u597D\uFF0C{period}\u597D\uFF01\u4ECA\u5929\u6709\u4EC0\u9EBC\u9700\u8981\u6211\u5354\u52A9\u7684\u55CE\uFF1F",
395
414
  "system.ai.greeting_hello": "\u60A8\u597D\uFF0CAI\u52A9\u624B\u70BA\u60A8\u670D\u52D9\uFF01",
@@ -437,6 +456,7 @@ var zh_TW_default = {
437
456
  "system.ai.text_assistant": "\u6587\u5B57\u52A9\u624B",
438
457
  "system.ai.thinking": "\u6B63\u5728\u56DE\u8986",
439
458
  "system.ai.tool_called": "\u5DF2\u547C\u53EB\uFF1A{tools}",
459
+ "system.ai.web_search": "\u7DB2\u8DEF\u641C\u5C0B",
440
460
  "system.ai.upload_failed": "\u9644\u4EF6\u4E0A\u50B3\u5931\u6557",
441
461
  "system.profile.account": "\u8CEC\u865F",
442
462
  "system.profile.avatar_change": "\u9EDE\u9078\u4FEE\u6539\u982D\u50CF",
@@ -472,6 +492,7 @@ var zh_TW_default = {
472
492
  "system.settings.ai_title": "\u667A\u6167\u52A9\u624B",
473
493
  "system.settings.go_ask": "\u53BB\u63D0\u554F",
474
494
  "system.notification.title": "\u6D88\u606F\u4E2D\u5FC3",
495
+ "system.notification.sender.system": "\u7CFB\u7D71",
475
496
  "system.notification.description": "\u67E5\u770B\u7CFB\u7D71\u901A\u77E5\u548C\u696D\u52D9\u6D88\u606F",
476
497
  "system.notification.empty": "\u66AB\u7121\u6D88\u606F",
477
498
  "system.notification.action.view_all": "\u67E5\u770B\u5168\u90E8",
@@ -482,7 +503,10 @@ var zh_TW_default = {
482
503
  "system.notification.mark_all_read": "\u5168\u90E8\u5DF2\u8B80",
483
504
  "system.notification.action.archive": "\u6B78\u6A94",
484
505
  "system.notification.action.restore": "\u6062\u5FA9",
485
- "system.notification.action.delete": "\u522A\u9664"
506
+ "system.notification.action.delete": "\u522A\u9664",
507
+ "system.ai.model.provider_placeholder": "\u9078\u64C7\u4F9B\u61C9\u5546",
508
+ "system.ai.model.model_placeholder": "\u9078\u64C7\u6A21\u578B",
509
+ "system.ai.model.load_failed": "\u8F09\u5165\u4F9B\u61C9\u5546\u8207\u6A21\u578B\u5931\u6557"
486
510
  };
487
511
 
488
512
  // src/locales/generated.ts
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "type": "git",
8
8
  "url": "git@github.com:liujitcn/kratos-admin.git"
9
9
  },
10
- "version": "0.0.62",
10
+ "version": "0.0.64",
11
11
  "type": "module",
12
12
  "files": [
13
13
  "dist",
@@ -35,7 +35,7 @@
35
35
  "@dcloudio/uni-app": "3.0.0-5010520260709002",
36
36
  "@dcloudio/uni-ui": "^1.4.28",
37
37
  "vue": "^3.4.21",
38
- "@liujitcn/kratos-uni-app-core": "^0.0.62"
38
+ "@liujitcn/kratos-uni-app-core": "^0.0.64"
39
39
  },
40
40
  "devDependencies": {
41
41
  "esbuild": "^0.20.2",
@@ -0,0 +1,25 @@
1
+ import { http } from '@liujitcn/kratos-uni-app-core/utils/http'
2
+ import type {
3
+ AiModelService,
4
+ ListAiProviderModelOptionsRequest,
5
+ ListAiProviderModelOptionsResponse,
6
+ } from '../../../rpc/base/v1/ai_provider'
7
+
8
+ const AI_PROVIDER_MODELS_URL = '/v1/base/ai/provider-models'
9
+
10
+ /** AI Provider模型选项服务。 */
11
+ export class AiModelServiceImpl implements AiModelService {
12
+ /** 查询已启用Provider及其可用模型。 */
13
+ ListAiProviderModelOptions(
14
+ request: ListAiProviderModelOptionsRequest,
15
+ ): Promise<ListAiProviderModelOptionsResponse> {
16
+ return http<ListAiProviderModelOptionsResponse>({
17
+ url: AI_PROVIDER_MODELS_URL,
18
+ method: 'GET',
19
+ authMode: 'required',
20
+ data: request,
21
+ })
22
+ }
23
+ }
24
+
25
+ export const defAiModelService = new AiModelServiceImpl()
@@ -15,6 +15,7 @@
15
15
  "system.ai.delete_session_failed": "Failed to delete session",
16
16
  "system.ai.efficiency_assistant": "Productivity assistant",
17
17
  "system.ai.failed_response": "The response did not complete. You can retry your previous question.",
18
+ "system.ai.chat.error.details_unavailable": "Provider error details are not exposed in chat. See the service logs.",
18
19
  "system.ai.general_assistant": "General assistant",
19
20
  "system.ai.greeting": "Good {period}, how can I help you today?",
20
21
  "system.ai.greeting_hello": "Hello, your AI assistant is ready to help.",
@@ -62,6 +63,7 @@
62
63
  "system.ai.text_assistant": "Writing assistant",
63
64
  "system.ai.thinking": "Responding",
64
65
  "system.ai.tool_called": "Tools used: {tools}",
66
+ "system.ai.web_search": "Web search",
65
67
  "system.ai.upload_failed": "Attachment upload failed",
66
68
  "system.profile.account": "Account",
67
69
  "system.profile.avatar_change": "Tap to change avatar",
@@ -97,6 +99,7 @@
97
99
  "system.settings.ai_title": "AI Assistant",
98
100
  "system.settings.go_ask": "Ask now",
99
101
  "system.notification.title": "Message Center",
102
+ "system.notification.sender.system": "System",
100
103
  "system.notification.description": "View system notifications and business messages",
101
104
  "system.notification.empty": "No messages",
102
105
  "system.notification.action.view_all": "View all",
@@ -107,5 +110,8 @@
107
110
  "system.notification.mark_all_read": "Mark all read",
108
111
  "system.notification.action.archive": "Archive",
109
112
  "system.notification.action.restore": "Restore",
110
- "system.notification.action.delete": "Delete"
113
+ "system.notification.action.delete": "Delete",
114
+ "system.ai.model.provider_placeholder": "Select a provider",
115
+ "system.ai.model.model_placeholder": "Select a model",
116
+ "system.ai.model.load_failed": "Failed to load providers and models"
111
117
  }
@@ -15,6 +15,7 @@
15
15
  "system.ai.delete_session_failed": "セッションの削除に失敗しました",
16
16
  "system.ai.efficiency_assistant": "効率アシスタント",
17
17
  "system.ai.failed_response": "今回は応答が正常に返されませんでした。質問を直接再試行できます。",
18
+ "system.ai.chat.error.details_unavailable": "チャットでは内部エラーの詳細は表示されません。サービスログを確認してください。",
18
19
  "system.ai.general_assistant": "ユニバーサル アシスタント",
19
20
  "system.ai.greeting": "こんにちは、{period} こんにちは!今日は何かお手伝いが必要なことはありますか?",
20
21
  "system.ai.greeting_hello": "こんにちは、AI アシスタントがお手伝いします。",
@@ -62,6 +63,7 @@
62
63
  "system.ai.text_assistant": "テキスト アシスタント",
63
64
  "system.ai.thinking": "が返信しています",
64
65
  "system.ai.tool_called": "呼び出し先: {tools}",
66
+ "system.ai.web_search": "ウェブ検索",
65
67
  "system.ai.upload_failed": "添付ファイルのアップロードに失敗しました",
66
68
  "system.profile.account": "アカウント",
67
69
  "system.profile.avatar_change": "クリックしてアバターを変更します",
@@ -97,6 +99,7 @@
97
99
  "system.settings.ai_title": "インテリジェント アシスタント",
98
100
  "system.settings.go_ask": "質問してみよう",
99
101
  "system.notification.title": "メッセージセンター",
102
+ "system.notification.sender.system": "システム",
100
103
  "system.notification.description": "システム通知と業務メッセージを確認",
101
104
  "system.notification.empty": "メッセージはありません",
102
105
  "system.notification.action.view_all": "すべて表示",
@@ -107,5 +110,8 @@
107
110
  "system.notification.mark_all_read": "すべて既読",
108
111
  "system.notification.action.archive": "アーカイブ",
109
112
  "system.notification.action.restore": "復元",
110
- "system.notification.action.delete": "削除"
113
+ "system.notification.action.delete": "削除",
114
+ "system.ai.model.provider_placeholder": "プロバイダーを選択",
115
+ "system.ai.model.model_placeholder": "モデルを選択",
116
+ "system.ai.model.load_failed": "プロバイダーとモデルを読み込めませんでした"
111
117
  }
@@ -15,6 +15,7 @@
15
15
  "system.ai.delete_session_failed": "删除会话失败",
16
16
  "system.ai.efficiency_assistant": "效率助手",
17
17
  "system.ai.failed_response": "这次回复没有成功返回,你可以直接重试刚才的问题。",
18
+ "system.ai.chat.error.details_unavailable": "聊天界面不展示底层服务错误详情,请查看服务日志。",
18
19
  "system.ai.general_assistant": "通用助手",
19
20
  "system.ai.greeting": "您好,{period}好!今天有什么需要我协助的吗?",
20
21
  "system.ai.greeting_hello": "您好,AI助手为您服务!",
@@ -62,6 +63,7 @@
62
63
  "system.ai.text_assistant": "文本助手",
63
64
  "system.ai.thinking": "正在回复",
64
65
  "system.ai.tool_called": "已调用:{tools}",
66
+ "system.ai.web_search": "联网搜索",
65
67
  "system.ai.upload_failed": "附件上传失败",
66
68
  "system.profile.account": "账号",
67
69
  "system.profile.avatar_change": "点击修改头像",
@@ -97,6 +99,7 @@
97
99
  "system.settings.ai_title": "智能助手",
98
100
  "system.settings.go_ask": "去提问",
99
101
  "system.notification.title": "消息中心",
102
+ "system.notification.sender.system": "系统",
100
103
  "system.notification.description": "查看系统通知和业务消息",
101
104
  "system.notification.empty": "暂无消息",
102
105
  "system.notification.action.view_all": "查看全部",
@@ -107,5 +110,8 @@
107
110
  "system.notification.mark_all_read": "全部已读",
108
111
  "system.notification.action.archive": "归档",
109
112
  "system.notification.action.restore": "恢复",
110
- "system.notification.action.delete": "删除"
113
+ "system.notification.action.delete": "删除",
114
+ "system.ai.model.provider_placeholder": "选择供应商",
115
+ "system.ai.model.model_placeholder": "选择模型",
116
+ "system.ai.model.load_failed": "加载供应商和模型失败"
111
117
  }
@@ -15,6 +15,7 @@
15
15
  "system.ai.delete_session_failed": "刪除會話失敗",
16
16
  "system.ai.efficiency_assistant": "效率助手",
17
17
  "system.ai.failed_response": "這次回覆沒有成功返回,你可以直接重試剛才的問題。",
18
+ "system.ai.chat.error.details_unavailable": "聊天介面不會顯示底層服務錯誤詳情,請查看服務日誌。",
18
19
  "system.ai.general_assistant": "通用助手",
19
20
  "system.ai.greeting": "您好,{period}好!今天有什麼需要我協助的嗎?",
20
21
  "system.ai.greeting_hello": "您好,AI助手為您服務!",
@@ -62,6 +63,7 @@
62
63
  "system.ai.text_assistant": "文字助手",
63
64
  "system.ai.thinking": "正在回覆",
64
65
  "system.ai.tool_called": "已呼叫:{tools}",
66
+ "system.ai.web_search": "網路搜尋",
65
67
  "system.ai.upload_failed": "附件上傳失敗",
66
68
  "system.profile.account": "賬號",
67
69
  "system.profile.avatar_change": "點選修改頭像",
@@ -97,6 +99,7 @@
97
99
  "system.settings.ai_title": "智慧助手",
98
100
  "system.settings.go_ask": "去提問",
99
101
  "system.notification.title": "消息中心",
102
+ "system.notification.sender.system": "系統",
100
103
  "system.notification.description": "查看系統通知和業務消息",
101
104
  "system.notification.empty": "暫無消息",
102
105
  "system.notification.action.view_all": "查看全部",
@@ -107,5 +110,8 @@
107
110
  "system.notification.mark_all_read": "全部已讀",
108
111
  "system.notification.action.archive": "歸檔",
109
112
  "system.notification.action.restore": "恢復",
110
- "system.notification.action.delete": "刪除"
113
+ "system.notification.action.delete": "刪除",
114
+ "system.ai.model.provider_placeholder": "選擇供應商",
115
+ "system.ai.model.model_placeholder": "選擇模型",
116
+ "system.ai.model.load_failed": "載入供應商與模型失敗"
111
117
  }
@@ -46,7 +46,13 @@ export interface SendAiMessageRequest {
46
46
  /** 附件列表 */
47
47
  attachments: AiAttachment[];
48
48
  /** 助手动作 */
49
- action: AiAction | undefined;
49
+ action:
50
+ | AiAction
51
+ | undefined;
52
+ /** 所选供应商ID;留空时使用首个可用模型 */
53
+ provider_id: number;
54
+ /** 所选模型名称 */
55
+ model_name: string;
50
56
  }
51
57
 
52
58
  /** AI 助手失败消息重试请求 */
@@ -0,0 +1,33 @@
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/ai_provider.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ /** AI Provider模型选项查询请求。 */
10
+ export interface ListAiProviderModelOptionsRequest {
11
+ }
12
+
13
+ /** 已启用的AI Provider及其模型选项。 */
14
+ export interface AiProviderModelOption {
15
+ /** Provider ID */
16
+ provider_id: number;
17
+ /** Provider名称 */
18
+ name: string;
19
+ /** 模型名称列表 */
20
+ models: string[];
21
+ }
22
+
23
+ /** AI Provider模型选项查询响应。 */
24
+ export interface ListAiProviderModelOptionsResponse {
25
+ /** Provider及其模型列表 */
26
+ providers: AiProviderModelOption[];
27
+ }
28
+
29
+ /** AI Provider 可选模型查询服务。 */
30
+ export interface AiModelService {
31
+ /** 查询已启用的AI Provider及其可用模型。 */
32
+ ListAiProviderModelOptions(request: ListAiProviderModelOptionsRequest): Promise<ListAiProviderModelOptionsResponse>;
33
+ }
@@ -108,6 +108,8 @@ export interface DeleteAiSessionResponse {
108
108
  export interface AiSession {
109
109
  /** 会话ID */
110
110
  id: string;
111
+ /** 租户ID */
112
+ tenant_id: number;
111
113
  /** 会话标题 */
112
114
  title: string;
113
115
  /** 会话摘要 */
@@ -124,6 +126,8 @@ export interface AiSession {
124
126
  export interface AiMessage {
125
127
  /** 消息ID */
126
128
  id: string;
129
+ /** 租户ID */
130
+ tenant_id: number;
127
131
  /** 输入内容 */
128
132
  input_content:
129
133
  | AiInputContent
@@ -278,6 +278,8 @@ export interface DeleteNotificationRequest {
278
278
  export interface Notification {
279
279
  /** 投递ID */
280
280
  id: number;
281
+ /** 租户ID */
282
+ tenant_id: number;
281
283
  /** 消息ID */
282
284
  message_id: number;
283
285
  /** 分类ID */
@@ -1,5 +1,7 @@
1
1
  <script setup lang="ts">
2
+ import { computed } from 'vue'
2
3
  import type { AiAttachment } from '../../../../rpc/base/v1/ai_session'
4
+ import type { AiProviderModelOption } from '../../../../rpc/base/v1/ai_provider'
3
5
 
4
6
  type InputEventValue = {
5
7
  detail: {
@@ -7,9 +9,16 @@ type InputEventValue = {
7
9
  }
8
10
  }
9
11
 
10
- defineProps<{
12
+ const props = defineProps<{
11
13
  modelValue: string
12
14
  attachments: AiAttachment[]
15
+ /** 当前可供选择的供应商与模型。 */
16
+ modelProviders: AiProviderModelOption[]
17
+ /** 当前选中的供应商编号和模型名称。 */
18
+ providerId: number
19
+ modelName: string
20
+ providerPlaceholder: string
21
+ modelPlaceholder: string
13
22
  placeholder: string
14
23
  bottom: string
15
24
  recording: boolean
@@ -23,15 +32,60 @@ const emit = defineEmits<{
23
32
  record: []
24
33
  send: []
25
34
  'remove-attachment': [attachment: AiAttachment]
35
+ 'model-change': [providerId: number, modelName: string]
26
36
  }>()
27
37
 
38
+ const providerNames = computed(() => props.modelProviders.map((provider) => provider.name))
39
+ const selectedProvider = computed(() =>
40
+ props.modelProviders.find((provider) => provider.provider_id === props.providerId),
41
+ )
42
+ const modelNames = computed(() => selectedProvider.value?.models ?? [])
43
+ const providerIndex = computed(() =>
44
+ Math.max(
45
+ props.modelProviders.findIndex((provider) => provider.provider_id === props.providerId),
46
+ 0,
47
+ ),
48
+ )
49
+ const modelIndex = computed(() => Math.max(modelNames.value.indexOf(props.modelName), 0))
50
+
28
51
  function handleInput(event: Event) {
29
52
  emit('update:modelValue', ((event as unknown as InputEventValue).detail?.value || '').toString())
30
53
  }
54
+
55
+ function handleProviderChange(event: { detail: { value: number | string } }) {
56
+ const provider = props.modelProviders[Number(event.detail.value)]
57
+ emit('model-change', provider?.provider_id ?? 0, provider?.models[0] ?? '')
58
+ }
59
+
60
+ function handleModelChange(event: { detail: { value: number | string } }) {
61
+ emit('model-change', props.providerId, modelNames.value[Number(event.detail.value)] ?? '')
62
+ }
31
63
  </script>
32
64
 
33
65
  <template>
34
66
  <view class="composer" :style="{ paddingBottom: bottom }">
67
+ <view class="composer-model-selectors">
68
+ <picker
69
+ mode="selector"
70
+ :range="providerNames"
71
+ :value="providerIndex"
72
+ :disabled="sending || !modelProviders.length"
73
+ @change="handleProviderChange"
74
+ >
75
+ <view class="composer-model-select">{{
76
+ selectedProvider?.name || providerPlaceholder
77
+ }}</view>
78
+ </picker>
79
+ <picker
80
+ mode="selector"
81
+ :range="modelNames"
82
+ :value="modelIndex"
83
+ :disabled="sending || !modelNames.length"
84
+ @change="handleModelChange"
85
+ >
86
+ <view class="composer-model-select">{{ modelName || modelPlaceholder }}</view>
87
+ </picker>
88
+ </view>
35
89
  <view class="composer-main">
36
90
  <button class="attach-button" hover-class="none" @tap="emit('attach')">
37
91
  <uni-icons type="plusempty" size="30" color="#111" />
@@ -114,6 +168,29 @@ function handleInput(event: Event) {
114
168
  box-sizing: border-box;
115
169
  }
116
170
 
171
+ .composer-model-selectors {
172
+ display: flex;
173
+ justify-content: flex-end;
174
+ gap: 12rpx;
175
+ min-width: 0;
176
+ margin: 0 8rpx 12rpx;
177
+ }
178
+
179
+ .composer-model-select {
180
+ max-width: 300rpx;
181
+ min-width: 120rpx;
182
+ padding: 8rpx 16rpx;
183
+ overflow: hidden;
184
+ color: #46515b;
185
+ font-size: 22rpx;
186
+ line-height: 32rpx;
187
+ text-overflow: ellipsis;
188
+ white-space: nowrap;
189
+ background: #fff;
190
+ border: 2rpx solid #d6dae2;
191
+ border-radius: 8rpx;
192
+ }
193
+
117
194
  .attach-button {
118
195
  flex-shrink: 0;
119
196
  display: flex;
@@ -7,8 +7,10 @@ import {
7
7
  } from '../../../api/base/v1/ai_message'
8
8
  import { defAiSessionService } from '../../../api/base/v1/ai_session'
9
9
  import { defAiToolService } from '../../../api/base/v1/ai_tool'
10
+ import { defAiModelService } from '../../../api/base/v1/ai_provider'
10
11
  import type { AiMessage } from '../../../rpc/base/v1/ai_session'
11
12
  import type { AiAttachment, AiSession } from '../../../rpc/base/v1/ai_session'
13
+ import type { AiProviderModelOption } from '../../../rpc/base/v1/ai_provider'
12
14
  import type { AiShortcut, AiToolCall } from '../../../rpc/base/v1/ai_tool'
13
15
  import { AiMessageStatus } from '../../../rpc/base/v1/ai_session'
14
16
  import { Terminal } from '../../../rpc/base/v1/ai_tool'
@@ -92,6 +94,9 @@ const chatBottomAnchor = ref('')
92
94
  const sessions = ref<AiSession[]>([])
93
95
  const messages = ref<Record<string, ChatMessageItem[]>>({})
94
96
  const selectedAttachments = ref<AiAttachment[]>([])
97
+ const modelProviders = ref<AiProviderModelOption[]>([])
98
+ const selectedProviderId = ref(0)
99
+ const selectedModelName = ref('')
95
100
  const runningStreamTaskMap = new Map<string, StreamTask>()
96
101
  const pendingDeltaMap = new Map<string, AiStreamPayload>()
97
102
  let pendingDeltaTimer = 0
@@ -464,21 +469,43 @@ async function loadAiShortcuts() {
464
469
  }
465
470
  loadingShortcuts.value = true
466
471
  try {
467
- const response = await defAiToolService.ListAiShortcut({
468
- terminal: AI_TERMINAL,
469
- })
472
+ const [response, providerResponse] = await Promise.all([
473
+ defAiToolService.ListAiShortcut({ terminal: AI_TERMINAL }),
474
+ defAiModelService.ListAiProviderModelOptions({}),
475
+ ])
476
+ modelProviders.value = providerResponse.providers ?? []
477
+ if (
478
+ !modelProviders.value.some(
479
+ (item) =>
480
+ item.provider_id === selectedProviderId.value &&
481
+ item.models.includes(selectedModelName.value),
482
+ )
483
+ ) {
484
+ const firstProvider = modelProviders.value[0]
485
+ selectedProviderId.value = firstProvider?.provider_id ?? 0
486
+ selectedModelName.value = firstProvider?.models[0] ?? ''
487
+ }
470
488
  const shortcuts = normalizeStarterShortcuts(response.shortcuts).filter((item) => !item.action)
471
489
  if (shortcuts.length) {
472
490
  starterShortcuts.value = shortcuts
473
491
  starterPromptGroupIndex.value = 0
474
492
  }
475
493
  } catch (error) {
494
+ modelProviders.value = []
495
+ selectedProviderId.value = 0
496
+ selectedModelName.value = ''
476
497
  showError(error, t('system.ai.load_shortcuts_failed'))
477
498
  } finally {
478
499
  loadingShortcuts.value = false
479
500
  }
480
501
  }
481
502
 
503
+ /** 更新当前聊天使用的供应商和模型。 */
504
+ function handleModelChange(providerId: number, modelName: string) {
505
+ selectedProviderId.value = providerId
506
+ selectedModelName.value = modelName
507
+ }
508
+
482
509
  async function sendAiPayload(payload: { text: string; attachments: AiAttachment[] }) {
483
510
  const sessionID = await ensureActiveSession()
484
511
  if (!sessionID || isSessionSending(sessionID)) {
@@ -507,6 +534,8 @@ async function runAiTask(
507
534
  const request = {
508
535
  session_id: sessionID,
509
536
  content: payload.text,
537
+ provider_id: selectedProviderId.value,
538
+ model_name: selectedModelName.value,
510
539
  attachments: payload.attachments,
511
540
  action: undefined,
512
541
  }
@@ -897,6 +926,7 @@ async function waitForMessagesLoaded(sessionID: string) {
897
926
  function normalizeSession(session?: Partial<AiSession> | null): AiSession {
898
927
  return {
899
928
  id: String(session?.id ?? ''),
929
+ tenant_id: Number(session?.tenant_id ?? 0),
900
930
  title: String(session?.title ?? t('system.ai.new_session')),
901
931
  summary: String(session?.summary ?? ''),
902
932
  updated_at: session?.updated_at,
@@ -989,6 +1019,7 @@ function createLocalUserMessage(payload: { text: string; attachments: AiAttachme
989
1019
  const message = mapMessageItem(
990
1020
  {
991
1021
  id: `${LOCAL_USER_MESSAGE_PREFIX}-${now}`,
1022
+ tenant_id: 0,
992
1023
  input_content: { kind: 'text', content: payload.text },
993
1024
  output_content: undefined,
994
1025
  attachments: payload.attachments,
@@ -1017,6 +1048,7 @@ function createThinkingMessage(options?: { sessionID?: string; messageID?: strin
1017
1048
  const message = mapMessageItem(
1018
1049
  {
1019
1050
  id: streamKey || `ai-thinking-${now}`,
1051
+ tenant_id: 0,
1020
1052
  input_content: undefined,
1021
1053
  output_content: {
1022
1054
  kind: 'text',
@@ -1184,7 +1216,9 @@ function formatAttachmentMeta(attachment: AiAttachment) {
1184
1216
 
1185
1217
  function formatTools(tools: AiToolCall[]) {
1186
1218
  return tools
1187
- .map((item) => item.title || item.name)
1219
+ .map((item) =>
1220
+ item.name === 'web_search' ? t('system.ai.web_search') : item.title || item.name,
1221
+ )
1188
1222
  .filter(Boolean)
1189
1223
  .join(' · ')
1190
1224
  }
@@ -1279,6 +1313,11 @@ function showError(error: unknown, fallback: string) {
1279
1313
  <Composer
1280
1314
  v-model="inputText"
1281
1315
  :attachments="selectedAttachments"
1316
+ :model-providers="modelProviders"
1317
+ :provider-id="selectedProviderId"
1318
+ :model-name="selectedModelName"
1319
+ :provider-placeholder="t('system.ai.model.provider_placeholder')"
1320
+ :model-placeholder="t('system.ai.model.model_placeholder')"
1282
1321
  :placeholder="composerPlaceholder"
1283
1322
  :bottom="composerBottom"
1284
1323
  :recording="isRecording"
@@ -1287,6 +1326,7 @@ function showError(error: unknown, fallback: string) {
1287
1326
  @attach="handleAttachment"
1288
1327
  @record="handleToggleRecord"
1289
1328
  @send="handleSend"
1329
+ @model-change="handleModelChange"
1290
1330
  @remove-attachment="removeSelectedAttachment"
1291
1331
  />
1292
1332
 
@@ -20,6 +20,14 @@ async function loadDetail(id: number) {
20
20
  if (!detail.value.read_at) await defNotificationService.MarkNotificationRead({ ids: [id] })
21
21
  }
22
22
 
23
+ /** 将系统通知发送者映射到当前语言。 */
24
+ function resolveSenderName(value?: string) {
25
+ if (value === '系统' || value === '__I18N__:system.notification.sender.system') {
26
+ return t('system.notification.sender.system')
27
+ }
28
+ return value ?? ''
29
+ }
30
+
23
31
  /** 执行通知携带的稳定 viewKey 动作。 */
24
32
  function openAction() {
25
33
  if (!detail.value || detail.value.action_type !== MessageActionType.MESSAGE_ACTION_TYPE_VIEW_KEY)
@@ -57,7 +65,7 @@ function openAction() {
57
65
  />
58
66
  <text>{{ detail.category_name }}</text>
59
67
  </view>
60
- <text>{{ detail.sender_name }}</text>
68
+ <text>{{ resolveSenderName(detail.sender_name) }}</text>
61
69
  <text>{{ detail.received_at }}</text>
62
70
  </view>
63
71
  <rich-text