@liujitcn/kratos-uni-app-system 0.0.18 → 0.0.20

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 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.18",
10
+ "version": "0.0.20",
11
11
  "type": "module",
12
12
  "files": [
13
13
  "dist",
@@ -30,7 +30,7 @@
30
30
  "@dcloudio/uni-app": "3.0.0-5010520260709002",
31
31
  "@dcloudio/uni-ui": "^1.4.28",
32
32
  "vue": "^3.4.21",
33
- "@liujitcn/kratos-uni-app-core": "^0.0.18"
33
+ "@liujitcn/kratos-uni-app-core": "^0.0.20"
34
34
  },
35
35
  "devDependencies": {
36
36
  "esbuild": "^0.20.2",
@@ -5,9 +5,9 @@
5
5
  // source: base/v1/ai_session.proto
6
6
 
7
7
  /* eslint-disable */
8
- import type { AiMessageStatus, Terminal } from "../../common/v1/enum";
9
8
  import type { Timestamp } from "../../google/protobuf/timestamp";
10
9
  import type { AiToolCall } from "./ai_tool";
10
+ import type { AiMessageStatus, Terminal } from "./enum";
11
11
 
12
12
  /** AI 助手消息列表查询条件 */
13
13
  export interface ListAiMessageRequest {
@@ -5,7 +5,7 @@
5
5
  // source: base/v1/ai_tool.proto
6
6
 
7
7
  /* eslint-disable */
8
- import type { Terminal } from "../../common/v1/enum";
8
+ import type { Terminal } from "./enum";
9
9
 
10
10
  /** AI 助手快捷入口列表查询条件 */
11
11
  export interface ListAiShortcutRequest {
@@ -2,17 +2,30 @@
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.11.8
4
4
  // protoc unknown
5
- // source: common/v1/enum.proto
5
+ // source: base/v1/enum.proto
6
6
 
7
7
  /* eslint-disable */
8
8
 
9
- /** 状态 */
10
- export enum Status {
11
- UNKNOWN = 0,
12
- /** ENABLE - 启用 */
13
- ENABLE = 1,
14
- /** DISABLE - 禁用 */
15
- DISABLE = 2,
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,
16
29
  }
17
30
 
18
31
  /** 系统配置位置 */
@@ -39,33 +52,3 @@ export enum PasswordCryptoScene {
39
52
  /** UPDATE_USER_PASSWORD - 个人修改密码加密场景 */
40
53
  UPDATE_USER_PASSWORD = 4,
41
54
  }
42
-
43
- /** AI 助手消息状态 */
44
- export enum AiMessageStatus {
45
- /** UNKNOWN_AAMS - 未知AI助手消息状态 */
46
- UNKNOWN_AAMS = 0,
47
- /** GENERATING_AAMS - 生成中 */
48
- GENERATING_AAMS = 1,
49
- /** SUCCESS_AAMS - 成功 */
50
- SUCCESS_AAMS = 2,
51
- /** FAILED_AAMS - 失败 */
52
- FAILED_AAMS = 3,
53
- }
54
-
55
- /** 支付通知资源类型 */
56
- export enum ResourceType {
57
- /** TRANSACTION - 支付 */
58
- TRANSACTION = 0,
59
- /** REFUND - 退款 */
60
- REFUND = 1,
61
- }
62
-
63
- /** 终端类型 */
64
- export enum Terminal {
65
- /** TERMINAL_UNSPECIFIED - 未知终端 */
66
- TERMINAL_UNSPECIFIED = 0,
67
- /** TERMINAL_APP - 移动端 */
68
- TERMINAL_APP = 1,
69
- /** TERMINAL_ADMIN - 管理端 */
70
- TERMINAL_ADMIN = 2,
71
- }
@@ -7,7 +7,7 @@ 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, Terminal } from '../../../rpc/common/v1/enum'
10
+ import { AiMessageStatus, Terminal } from '../../../rpc/base/v1/enum'
11
11
  import { uploadFile } from '@liujitcn/kratos-uni-app-core/utils/file'
12
12
  import { formatSrc } from '@liujitcn/kratos-uni-app-core/utils/index'
13
13
  import Composer from './components/Composer.vue'
@@ -70,7 +70,7 @@ safeAreaTop = safeAreaTop || 44
70
70
  // #endif
71
71
  const safeAreaBottom = Math.max(windowInfo.safeAreaInsets?.bottom || 0, 9)
72
72
  const windowHeight = windowInfo.windowHeight || windowInfo.screenHeight || 667
73
- const composerBottom = `${safeAreaBottom}px`
73
+ const composerBottom = `${safeAreaBottom + 48}px`
74
74
  const drawerTopPadding = `${safeAreaTop + 12}px`
75
75
 
76
76
  const showSessionDrawer = ref(false)
@@ -886,7 +886,7 @@ function normalizeMessageList(list?: AiMessage[] | null) {
886
886
  }
887
887
 
888
888
  function hasSuccessfulAiMessages(list: ChatMessageItem[]) {
889
- return list.some((item) => item.status === AiMessageStatus.SUCCESS_AAMS)
889
+ return list.some((item) => item.status === AiMessageStatus.SUCCESS_AMS)
890
890
  }
891
891
 
892
892
  function mapMessageItem(message: AiMessage, role: ChatRole): ChatMessageItem {
@@ -905,7 +905,7 @@ function mapMessageItem(message: AiMessage, role: ChatRole): ChatMessageItem {
905
905
  step: message.output_content?.step ?? '',
906
906
  blocks_json: message.output_content?.blocks_json ?? '',
907
907
  }
908
- const status = Number(message.status ?? AiMessageStatus.SUCCESS_AAMS)
908
+ const status = Number(message.status ?? AiMessageStatus.SUCCESS_AMS)
909
909
  return {
910
910
  ...message,
911
911
  key: `${message.id}:${role}`,
@@ -945,7 +945,7 @@ function createLocalUserMessage(payload: { text: string; attachments: AiAttachme
945
945
  seconds: Math.floor(now / 1000),
946
946
  nanos: (now % 1000) * 1_000_000,
947
947
  },
948
- status: AiMessageStatus.GENERATING_AAMS,
948
+ status: AiMessageStatus.GENERATING_AMS,
949
949
  token: { input: 0, output: 0, cache: 0, total: 0 },
950
950
  tools: [],
951
951
  first_token_ms: 0,
@@ -954,7 +954,7 @@ function createLocalUserMessage(payload: { text: string; attachments: AiAttachme
954
954
  'user',
955
955
  )
956
956
  message.localOnly = true
957
- message.status = AiMessageStatus.GENERATING_AAMS
957
+ message.status = AiMessageStatus.GENERATING_AMS
958
958
  return message
959
959
  }
960
960
 
@@ -983,7 +983,7 @@ function createThinkingMessage(options?: { sessionID?: string; messageID?: strin
983
983
  seconds: Math.floor(now / 1000),
984
984
  nanos: (now % 1000) * 1_000_000,
985
985
  },
986
- status: AiMessageStatus.GENERATING_AAMS,
986
+ status: AiMessageStatus.GENERATING_AMS,
987
987
  token: { input: 0, output: 0, cache: 0, total: 0 },
988
988
  tools: [],
989
989
  first_token_ms: 0,
@@ -1034,7 +1034,7 @@ function appendStreamingDelta(current: ChatMessageItem[], payload: AiStreamPaylo
1034
1034
  return {
1035
1035
  ...item,
1036
1036
  content: `${baseContent}${payload.delta}`,
1037
- status: AiMessageStatus.GENERATING_AAMS,
1037
+ status: AiMessageStatus.GENERATING_AMS,
1038
1038
  }
1039
1039
  })
1040
1040
  }
@@ -1046,7 +1046,7 @@ function markThinkingMessageFailed(current: ChatMessageItem[]) {
1046
1046
  }
1047
1047
  return {
1048
1048
  ...item,
1049
- status: AiMessageStatus.FAILED_AAMS,
1049
+ status: AiMessageStatus.FAILED_AMS,
1050
1050
  content:
1051
1051
  item.role === 'ai' ? '这次回复没有成功返回,你可以直接重试刚才的问题。' : item.content,
1052
1052
  }
@@ -1061,7 +1061,7 @@ function markStreamingError(current: ChatMessageItem[], payload: AiStreamPayload
1061
1061
  }
1062
1062
  return {
1063
1063
  ...item,
1064
- status: AiMessageStatus.FAILED_AAMS,
1064
+ status: AiMessageStatus.FAILED_AMS,
1065
1065
  content: '这次回复没有成功返回,你可以直接重试刚才的问题。',
1066
1066
  }
1067
1067
  })
@@ -1187,7 +1187,7 @@ function showError(error: unknown, fallback: string) {
1187
1187
  class="bubble"
1188
1188
  :class="[
1189
1189
  item.role === 'ai' ? 'ai-bubble' : 'user-bubble',
1190
- item.status === AiMessageStatus.GENERATING_AAMS ? 'is-streaming' : '',
1190
+ item.status === AiMessageStatus.GENERATING_AMS ? 'is-streaming' : '',
1191
1191
  ]"
1192
1192
  @longpress="handleMessageAction(item)"
1193
1193
  >
@@ -1288,6 +1288,33 @@ page {
1288
1288
  /* #endif */
1289
1289
  }
1290
1290
 
1291
+ /* #ifdef MP-WEIXIN */
1292
+ .ai-navbar {
1293
+ position: relative;
1294
+ }
1295
+
1296
+ .ai-navbar .nav-back-button,
1297
+ .ai-navbar .nav-menu-button {
1298
+ position: absolute;
1299
+ bottom: 0;
1300
+ }
1301
+
1302
+ .ai-navbar .nav-back-button {
1303
+ left: 0;
1304
+ }
1305
+
1306
+ .ai-navbar .nav-menu-button {
1307
+ left: 56rpx;
1308
+ right: auto;
1309
+ }
1310
+
1311
+ .ai-navbar__title {
1312
+ width: 100%;
1313
+ height: 44px;
1314
+ line-height: 44px;
1315
+ }
1316
+ /* #endif */
1317
+
1291
1318
  .nav-back-button,
1292
1319
  .nav-menu-button {
1293
1320
  display: flex;