@liujitcn/kratos-admin-system 0.0.65 → 0.0.66
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 +5 -3
- package/dist/package/declarations/src/api/base/v1/ai_knowledge.d.ts +7 -0
- package/dist/package/declarations/src/api/system/admin/v1/ai_provider.d.ts +3 -1
- package/dist/package/declarations/src/api/system/admin/v1/ai_query.d.ts +10 -0
- package/dist/package/declarations/src/api/system/admin/v1/ai_session.d.ts +9 -0
- package/dist/package/declarations/src/locales/generated.d.ts +1801 -1553
- package/dist/package/declarations/src/rpc/base/v1/ai_knowledge.d.ts +22 -0
- package/dist/package/declarations/src/rpc/base/v1/ai_message.d.ts +2 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/ai_provider.d.ts +63 -5
- package/dist/package/declarations/src/rpc/system/admin/v1/ai_query.d.ts +73 -0
- package/dist/package/declarations/src/rpc/system/admin/v1/ai_session.d.ts +114 -0
- package/dist/package/declarations/src/views/ai/chat/components/ChatPanel.vue.d.ts +9 -2
- package/dist/package/declarations/src/views/ai/chat/components/XSender.vue.d.ts +7 -0
- package/dist/package/declarations/src/views/ai/query/index.vue.d.ts +3 -0
- package/dist/package/declarations/src/views/ai/session/index.vue.d.ts +3 -0
- package/dist/package/src/api/base/v1/ai_knowledge.ts +22 -0
- package/dist/package/src/api/system/admin/v1/ai_provider.ts +7 -0
- package/dist/package/src/api/system/admin/v1/ai_query.ts +25 -0
- package/dist/package/src/api/system/admin/v1/ai_session.ts +25 -0
- package/dist/package/src/components/account/ChangePasswordForm.vue +1 -1
- package/dist/package/src/components/tenant-project/TenantProjectSelect.vue +21 -4
- package/dist/package/src/locales/en-US.json +354 -292
- package/dist/package/src/locales/ja-JP.json +351 -289
- package/dist/package/src/locales/zh-CN.json +351 -289
- package/dist/package/src/locales/zh-TW.json +351 -289
- package/dist/package/src/rpc/base/v1/ai_knowledge.ts +33 -0
- package/dist/package/src/rpc/base/v1/ai_message.ts +2 -0
- package/dist/package/src/rpc/system/admin/v1/ai_provider.ts +68 -5
- package/dist/package/src/rpc/system/admin/v1/ai_query.ts +89 -0
- package/dist/package/src/rpc/system/admin/v1/ai_session.ts +131 -0
- package/dist/package/src/views/ai/chat/components/ChatPanel.vue +18 -0
- package/dist/package/src/views/ai/chat/components/XSender.vue +101 -0
- package/dist/package/src/views/ai/chat/index.vue +22 -2
- package/dist/package/src/views/ai/query/index.vue +222 -0
- package/dist/package/src/views/ai/session/index.vue +422 -0
- package/dist/package/src/views/base/ai-provider/index.vue +201 -155
- package/dist/package/src/views/base/message-provider/index.vue +2 -2
- package/dist/package/src/views/base/oauth-provider/index.vue +2 -2
- package/dist/package/src/views/base/tenant-project-grant/index.vue +9 -4
- package/dist/package/src/views/tool/code-gen/config.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** AI知识库选项查询请求。 */
|
|
2
|
+
export interface ListAiKnowledgeOptionsRequest {
|
|
3
|
+
}
|
|
4
|
+
/** AI知识库选项查询响应。 */
|
|
5
|
+
export interface ListAiKnowledgeOptionsResponse {
|
|
6
|
+
/** 知识库选项列表 */
|
|
7
|
+
options: AiKnowledgeOption[];
|
|
8
|
+
}
|
|
9
|
+
/** AI知识库选项。 */
|
|
10
|
+
export interface AiKnowledgeOption {
|
|
11
|
+
/** 知识库ID */
|
|
12
|
+
id: number;
|
|
13
|
+
/** 知识库名称 */
|
|
14
|
+
name: string;
|
|
15
|
+
/** 文档数量 */
|
|
16
|
+
doc_count: number;
|
|
17
|
+
}
|
|
18
|
+
/** AI 知识库选项查询服务。 */
|
|
19
|
+
export interface AiKnowledgeService {
|
|
20
|
+
/** 查询可用的AI知识库选项。 */
|
|
21
|
+
ListAiKnowledgeOptions(request: ListAiKnowledgeOptionsRequest): Promise<ListAiKnowledgeOptionsResponse>;
|
|
22
|
+
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import type { Status } from "../../../common/v1/enum";
|
|
2
2
|
import type { Empty } from "../../../google/protobuf/empty";
|
|
3
|
+
/** AI模型分类枚举。 */
|
|
4
|
+
export declare enum AiModelCategory {
|
|
5
|
+
/** AI_MODEL_CATEGORY_UNSPECIFIED - 未指定AI模型分类。 */
|
|
6
|
+
AI_MODEL_CATEGORY_UNSPECIFIED = 0,
|
|
7
|
+
/** AI_MODEL_CATEGORY_CHAT - 对话模型。 */
|
|
8
|
+
AI_MODEL_CATEGORY_CHAT = 1,
|
|
9
|
+
/** AI_MODEL_CATEGORY_EMBEDDING - 向量模型。 */
|
|
10
|
+
AI_MODEL_CATEGORY_EMBEDDING = 2,
|
|
11
|
+
/** AI_MODEL_CATEGORY_RERANK - 重排序模型。 */
|
|
12
|
+
AI_MODEL_CATEGORY_RERANK = 3,
|
|
13
|
+
/** AI_MODEL_CATEGORY_IMAGE - 图片模型。 */
|
|
14
|
+
AI_MODEL_CATEGORY_IMAGE = 4,
|
|
15
|
+
/** AI_MODEL_CATEGORY_VIDEO - 视频模型。 */
|
|
16
|
+
AI_MODEL_CATEGORY_VIDEO = 5,
|
|
17
|
+
/** AI_MODEL_CATEGORY_AUDIO - 音频模型。 */
|
|
18
|
+
AI_MODEL_CATEGORY_AUDIO = 6
|
|
19
|
+
}
|
|
3
20
|
/** AI供应商分页查询条件。 */
|
|
4
21
|
export interface PageAiProviderRequest {
|
|
5
22
|
/** 供应商名称 */
|
|
@@ -35,8 +52,6 @@ export interface AiProviderForm {
|
|
|
35
52
|
api_key: string;
|
|
36
53
|
/** 是否已保存模型密钥 */
|
|
37
54
|
api_key_configured: boolean;
|
|
38
|
-
/** 多模型JSON数组 */
|
|
39
|
-
models_json: string;
|
|
40
55
|
/** 排序值 */
|
|
41
56
|
sort: number;
|
|
42
57
|
/** Provider稳定标识 */
|
|
@@ -45,6 +60,27 @@ export interface AiProviderForm {
|
|
|
45
60
|
config: {
|
|
46
61
|
[key: string]: any;
|
|
47
62
|
} | undefined;
|
|
63
|
+
/** 供应商下的AI模型列表 */
|
|
64
|
+
models: AiProviderModelForm[];
|
|
65
|
+
/** 状态 */
|
|
66
|
+
status: Status;
|
|
67
|
+
}
|
|
68
|
+
/** AI供应商模型维护表单;provider_id由所属供应商表单隐式给定。 */
|
|
69
|
+
export interface AiProviderModelForm {
|
|
70
|
+
/** 模型ID;新增时为0 */
|
|
71
|
+
id: number;
|
|
72
|
+
/** 模型名称,供应商API标识 */
|
|
73
|
+
model_name: string;
|
|
74
|
+
/** 显示名称 */
|
|
75
|
+
display_name: string;
|
|
76
|
+
/** 模型分类:枚举【AiModelCategory】 */
|
|
77
|
+
category: AiModelCategory;
|
|
78
|
+
/** 分类个性化配置JSON对象 */
|
|
79
|
+
config: {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
} | undefined;
|
|
82
|
+
/** 排序值 */
|
|
83
|
+
sort: number;
|
|
48
84
|
/** 状态 */
|
|
49
85
|
status: Status;
|
|
50
86
|
}
|
|
@@ -58,7 +94,7 @@ export interface UpdateAiProviderRequest {
|
|
|
58
94
|
/** AI供应商表单 */
|
|
59
95
|
ai_provider: AiProviderForm | undefined;
|
|
60
96
|
}
|
|
61
|
-
/** 测试AI
|
|
97
|
+
/** 测试AI供应商模型请求。 */
|
|
62
98
|
export interface TestAiProviderModelsRequest {
|
|
63
99
|
/** 待测试的AI供应商草稿 */
|
|
64
100
|
ai_provider: AiProviderForm | undefined;
|
|
@@ -79,6 +115,23 @@ export interface TestAiProviderModelsResponse {
|
|
|
79
115
|
/** 模型测试结果 */
|
|
80
116
|
results: AiProviderModelTestResult[];
|
|
81
117
|
}
|
|
118
|
+
/** 查询AI供应商选项请求。 */
|
|
119
|
+
export interface ListAiProviderOptionsRequest {
|
|
120
|
+
}
|
|
121
|
+
/** 查询AI供应商选项响应。 */
|
|
122
|
+
export interface ListAiProviderOptionsResponse {
|
|
123
|
+
/** 已启用的AI供应商列表 */
|
|
124
|
+
options: AiProviderOption[];
|
|
125
|
+
}
|
|
126
|
+
/** AI供应商选项。 */
|
|
127
|
+
export interface AiProviderOption {
|
|
128
|
+
/** 供应商ID */
|
|
129
|
+
id: number;
|
|
130
|
+
/** 供应商名称 */
|
|
131
|
+
name: string;
|
|
132
|
+
/** Provider稳定标识 */
|
|
133
|
+
provider: string;
|
|
134
|
+
}
|
|
82
135
|
/** 删除AI供应商请求。 */
|
|
83
136
|
export interface DeleteAiProviderRequest {
|
|
84
137
|
/** 供应商ID */
|
|
@@ -101,12 +154,12 @@ export interface AiProvider {
|
|
|
101
154
|
base_url: string;
|
|
102
155
|
/** 是否已保存模型密钥 */
|
|
103
156
|
api_key_configured: boolean;
|
|
104
|
-
/** 模型名称列表 */
|
|
105
|
-
model_names: string[];
|
|
106
157
|
/** 排序值 */
|
|
107
158
|
sort: number;
|
|
108
159
|
/** Provider稳定标识 */
|
|
109
160
|
provider: string;
|
|
161
|
+
/** 供应商下的模型名称列表 */
|
|
162
|
+
model_names: string[];
|
|
110
163
|
/** 状态 */
|
|
111
164
|
status: Status;
|
|
112
165
|
/** 创建时间 */
|
|
@@ -118,6 +171,11 @@ export interface AiProvider {
|
|
|
118
171
|
export interface AiProviderService {
|
|
119
172
|
/** 分页查询AI供应商。 */
|
|
120
173
|
PageAiProvider(request: PageAiProviderRequest): Promise<PageAiProviderResponse>;
|
|
174
|
+
/**
|
|
175
|
+
* 查询已启用的AI供应商选项。
|
|
176
|
+
* 字面路径必须先于 /{id} 声明:gorilla mux 按注册顺序匹配,否则会被 {id} 路由抢占。
|
|
177
|
+
*/
|
|
178
|
+
ListAiProviderOptions(request: ListAiProviderOptionsRequest): Promise<ListAiProviderOptionsResponse>;
|
|
121
179
|
/** 查询AI供应商表单。 */
|
|
122
180
|
GetAiProvider(request: GetAiProviderRequest): Promise<AiProviderForm>;
|
|
123
181
|
/** 创建AI供应商。 */
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** 智能问数状态枚举。 */
|
|
2
|
+
export declare enum AiQueryStatus {
|
|
3
|
+
/** AI_QUERY_STATUS_UNSPECIFIED - 未指定智能问数状态。 */
|
|
4
|
+
AI_QUERY_STATUS_UNSPECIFIED = 0,
|
|
5
|
+
/** AI_QUERY_STATUS_SUCCESS - 成功。 */
|
|
6
|
+
AI_QUERY_STATUS_SUCCESS = 1,
|
|
7
|
+
/** AI_QUERY_STATUS_FAILED - 失败。 */
|
|
8
|
+
AI_QUERY_STATUS_FAILED = 2
|
|
9
|
+
}
|
|
10
|
+
/** 智能问数分页查询条件。 */
|
|
11
|
+
export interface PageAiQueryRequest {
|
|
12
|
+
/** 问题内容 */
|
|
13
|
+
question: string;
|
|
14
|
+
/** 问数状态:枚举【AiQueryStatus】 */
|
|
15
|
+
status?: AiQueryStatus | undefined;
|
|
16
|
+
/** 当前页码 */
|
|
17
|
+
page_num: number;
|
|
18
|
+
/** 每页行数 */
|
|
19
|
+
page_size: number;
|
|
20
|
+
}
|
|
21
|
+
/** 智能问数分页响应。 */
|
|
22
|
+
export interface PageAiQueryResponse {
|
|
23
|
+
/** 智能问数记录列表 */
|
|
24
|
+
queries: AiQueryRecord[];
|
|
25
|
+
/** 总数 */
|
|
26
|
+
total: number;
|
|
27
|
+
}
|
|
28
|
+
/** 查询智能问数记录请求。 */
|
|
29
|
+
export interface GetAiQueryRequest {
|
|
30
|
+
/** 记录ID */
|
|
31
|
+
id: number;
|
|
32
|
+
}
|
|
33
|
+
/** 智能问数结果快照行。 */
|
|
34
|
+
export interface AiQueryResultRow {
|
|
35
|
+
/** 行数据 */
|
|
36
|
+
values: string[];
|
|
37
|
+
}
|
|
38
|
+
/** 智能问数记录。 */
|
|
39
|
+
export interface AiQueryRecord {
|
|
40
|
+
/** 记录ID */
|
|
41
|
+
id: number;
|
|
42
|
+
/** 租户ID */
|
|
43
|
+
tenant_id: number;
|
|
44
|
+
/** 用户ID */
|
|
45
|
+
user_id: number;
|
|
46
|
+
/** 用户账号 */
|
|
47
|
+
user_name: string;
|
|
48
|
+
/** 自然语言问题 */
|
|
49
|
+
question: string;
|
|
50
|
+
/** 生成的只读SQL */
|
|
51
|
+
sql: string;
|
|
52
|
+
/** 问数状态:枚举【AiQueryStatus】 */
|
|
53
|
+
status: AiQueryStatus;
|
|
54
|
+
/** 结果行数 */
|
|
55
|
+
row_count: number;
|
|
56
|
+
/** SQL执行耗时毫秒 */
|
|
57
|
+
elapsed_ms: number;
|
|
58
|
+
/** 失败原因 */
|
|
59
|
+
error_msg: string;
|
|
60
|
+
/** 结果快照列名,仅详情返回 */
|
|
61
|
+
result_columns: string[];
|
|
62
|
+
/** 结果快照数据行,仅详情返回 */
|
|
63
|
+
result_rows: AiQueryResultRow[];
|
|
64
|
+
/** 创建时间 */
|
|
65
|
+
created_at: string;
|
|
66
|
+
}
|
|
67
|
+
/** 智能问数记录管理服务。 */
|
|
68
|
+
export interface AiQueryService {
|
|
69
|
+
/** 分页查询智能问数记录。 */
|
|
70
|
+
PageAiQuery(request: PageAiQueryRequest): Promise<PageAiQueryResponse>;
|
|
71
|
+
/** 查询智能问数记录详情。 */
|
|
72
|
+
GetAiQuery(request: GetAiQueryRequest): Promise<AiQueryRecord>;
|
|
73
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { AiMessageStatus } from "../../../base/v1/ai_session";
|
|
2
|
+
import type { Terminal } from "../../../base/v1/ai_tool";
|
|
3
|
+
/** AI会话分页查询条件。 */
|
|
4
|
+
export interface PageAiSessionRequest {
|
|
5
|
+
/** 会话标题 */
|
|
6
|
+
title: string;
|
|
7
|
+
/** 终端类型:枚举【Terminal】 */
|
|
8
|
+
terminal?: Terminal | undefined;
|
|
9
|
+
/** 当前页码 */
|
|
10
|
+
page_num: number;
|
|
11
|
+
/** 每页行数 */
|
|
12
|
+
page_size: number;
|
|
13
|
+
}
|
|
14
|
+
/** AI会话分页响应。 */
|
|
15
|
+
export interface PageAiSessionResponse {
|
|
16
|
+
/** 会话列表 */
|
|
17
|
+
sessions: AiSessionRecord[];
|
|
18
|
+
/** 总数 */
|
|
19
|
+
total: number;
|
|
20
|
+
}
|
|
21
|
+
/** AI会话分页记录。 */
|
|
22
|
+
export interface AiSessionRecord {
|
|
23
|
+
/** 会话ID */
|
|
24
|
+
id: number;
|
|
25
|
+
/** 所属用户ID */
|
|
26
|
+
user_id: number;
|
|
27
|
+
/** 用户账号 */
|
|
28
|
+
user_name: string;
|
|
29
|
+
/** 用户昵称 */
|
|
30
|
+
nick_name: string;
|
|
31
|
+
/** 会话标题 */
|
|
32
|
+
title: string;
|
|
33
|
+
/** 会话摘要 */
|
|
34
|
+
summary: string;
|
|
35
|
+
/** 终端类型:枚举【Terminal】 */
|
|
36
|
+
terminal: Terminal;
|
|
37
|
+
/** 消息轮次数 */
|
|
38
|
+
message_count: number;
|
|
39
|
+
/** 累计输入Token数 */
|
|
40
|
+
input_tokens: number;
|
|
41
|
+
/** 累计输出Token数 */
|
|
42
|
+
output_tokens: number;
|
|
43
|
+
/** 累计缓存Token数 */
|
|
44
|
+
cache_tokens: number;
|
|
45
|
+
/** 累计总Token数 */
|
|
46
|
+
total_tokens: number;
|
|
47
|
+
/** 创建时间 */
|
|
48
|
+
created_at: string;
|
|
49
|
+
/** 更新时间 */
|
|
50
|
+
updated_at: string;
|
|
51
|
+
}
|
|
52
|
+
/** 分页查询AI会话消息请求。 */
|
|
53
|
+
export interface PageAiSessionMessageRequest {
|
|
54
|
+
/** 会话ID */
|
|
55
|
+
id: number;
|
|
56
|
+
/** 当前页码 */
|
|
57
|
+
page_num: number;
|
|
58
|
+
/** 每页行数 */
|
|
59
|
+
page_size: number;
|
|
60
|
+
}
|
|
61
|
+
/** 分页查询AI会话消息响应。 */
|
|
62
|
+
export interface PageAiSessionMessageResponse {
|
|
63
|
+
/** 消息列表 */
|
|
64
|
+
messages: AiSessionMessageRecord[];
|
|
65
|
+
/** 总数 */
|
|
66
|
+
total: number;
|
|
67
|
+
}
|
|
68
|
+
/** AI会话消息记录。 */
|
|
69
|
+
export interface AiSessionMessageRecord {
|
|
70
|
+
/** 消息ID */
|
|
71
|
+
id: number;
|
|
72
|
+
/** 用户输入内容 */
|
|
73
|
+
input_content: string;
|
|
74
|
+
/** AI回复内容 */
|
|
75
|
+
output_content: string;
|
|
76
|
+
/** 回复使用的模型名称 */
|
|
77
|
+
model: string;
|
|
78
|
+
/** 消息生成状态:枚举【AiMessageStatus】 */
|
|
79
|
+
status: AiMessageStatus;
|
|
80
|
+
/** 输入Token数 */
|
|
81
|
+
input_tokens: number;
|
|
82
|
+
/** 输出Token数 */
|
|
83
|
+
output_tokens: number;
|
|
84
|
+
/** 缓存Token数 */
|
|
85
|
+
cache_tokens: number;
|
|
86
|
+
/** 总Token数 */
|
|
87
|
+
total_tokens: number;
|
|
88
|
+
/** 首Token耗时毫秒 */
|
|
89
|
+
first_token_ms: number;
|
|
90
|
+
/** 总耗时毫秒 */
|
|
91
|
+
duration_ms: number;
|
|
92
|
+
/** 附件列表 */
|
|
93
|
+
attachments: AiSessionMessageAttachment[];
|
|
94
|
+
/** 创建时间 */
|
|
95
|
+
created_at: string;
|
|
96
|
+
}
|
|
97
|
+
/** AI会话消息附件。 */
|
|
98
|
+
export interface AiSessionMessageAttachment {
|
|
99
|
+
/** 附件名称 */
|
|
100
|
+
name: string;
|
|
101
|
+
/** 附件大小 */
|
|
102
|
+
size: number;
|
|
103
|
+
/** 附件地址 */
|
|
104
|
+
url: string;
|
|
105
|
+
/** 附件 MIME 类型 */
|
|
106
|
+
mime_type: string;
|
|
107
|
+
}
|
|
108
|
+
/** AI会话管理服务。 */
|
|
109
|
+
export interface AiSessionService {
|
|
110
|
+
/** 分页查询AI会话。 */
|
|
111
|
+
PageAiSession(request: PageAiSessionRequest): Promise<PageAiSessionResponse>;
|
|
112
|
+
/** 分页查询AI会话消息。 */
|
|
113
|
+
PageAiSessionMessage(request: PageAiSessionMessageRequest): Promise<PageAiSessionMessageResponse>;
|
|
114
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AiSession } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_session";
|
|
2
2
|
import type { AiProviderModelOption } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_provider";
|
|
3
|
+
import type { AiKnowledgeOption } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_knowledge";
|
|
3
4
|
import type { AiShortcut } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_tool";
|
|
4
5
|
import type { ChatMessageAction, ChatMessageEditPayload, ChatMessageItem, SubmitPayload } from "../types";
|
|
5
6
|
type __VLS_Props = {
|
|
@@ -19,17 +20,22 @@ type __VLS_Props = {
|
|
|
19
20
|
providerId: number;
|
|
20
21
|
/** 当前选择的模型名称。 */
|
|
21
22
|
modelName: string;
|
|
23
|
+
/** 当前可供选择的知识库。 */
|
|
24
|
+
knowledgeOptions: AiKnowledgeOption[];
|
|
25
|
+
/** 当前选择的知识库编号列表。 */
|
|
26
|
+
knowledgeIds: number[];
|
|
22
27
|
};
|
|
23
|
-
declare var
|
|
28
|
+
declare var __VLS_104: {
|
|
24
29
|
message: ChatMessageItem;
|
|
25
30
|
activeFlowMessageId: string;
|
|
26
31
|
};
|
|
27
32
|
type __VLS_Slots = {} & {
|
|
28
|
-
'flow-blocks'?: (props: typeof
|
|
33
|
+
'flow-blocks'?: (props: typeof __VLS_104) => any;
|
|
29
34
|
};
|
|
30
35
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
36
|
submit: (payload: SubmitPayload) => any;
|
|
32
37
|
modelChange: (providerId: number, modelName: string) => any;
|
|
38
|
+
knowledgeChange: (knowledgeIds: number[]) => any;
|
|
33
39
|
messageAction: (payload: {
|
|
34
40
|
action: ChatMessageAction;
|
|
35
41
|
item: ChatMessageItem;
|
|
@@ -38,6 +44,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
38
44
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
39
45
|
onSubmit?: ((payload: SubmitPayload) => any) | undefined;
|
|
40
46
|
onModelChange?: ((providerId: number, modelName: string) => any) | undefined;
|
|
47
|
+
onKnowledgeChange?: ((knowledgeIds: number[]) => any) | undefined;
|
|
41
48
|
onMessageAction?: ((payload: {
|
|
42
49
|
action: ChatMessageAction;
|
|
43
50
|
item: ChatMessageItem;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AiProviderModelOption } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_provider";
|
|
2
|
+
import type { AiKnowledgeOption } from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_knowledge";
|
|
2
3
|
import type { SubmitPayload } from "../types";
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
/** 消息发送加载状态。 */
|
|
@@ -9,13 +10,19 @@ type __VLS_Props = {
|
|
|
9
10
|
providerId: number;
|
|
10
11
|
/** 当前选择的模型名称。 */
|
|
11
12
|
modelName: string;
|
|
13
|
+
/** 当前可供选择的知识库。 */
|
|
14
|
+
knowledgeOptions: AiKnowledgeOption[];
|
|
15
|
+
/** 当前选择的知识库编号列表。 */
|
|
16
|
+
knowledgeIds: number[];
|
|
12
17
|
};
|
|
13
18
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
19
|
submit: (payload: SubmitPayload) => any;
|
|
15
20
|
"model-change": (providerId: number, modelName: string) => any;
|
|
21
|
+
"knowledge-change": (knowledgeIds: number[]) => any;
|
|
16
22
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
23
|
onSubmit?: ((payload: SubmitPayload) => any) | undefined;
|
|
18
24
|
"onModel-change"?: ((providerId: number, modelName: string) => any) | undefined;
|
|
25
|
+
"onKnowledge-change"?: ((knowledgeIds: number[]) => any) | undefined;
|
|
19
26
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
27
|
declare const _default: typeof __VLS_export;
|
|
21
28
|
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import service from "@liujitcn/kratos-admin-core/request";
|
|
2
|
+
import type {
|
|
3
|
+
AiKnowledgeService,
|
|
4
|
+
ListAiKnowledgeOptionsRequest,
|
|
5
|
+
ListAiKnowledgeOptionsResponse
|
|
6
|
+
} from "@liujitcn/kratos-admin-system/rpc/base/v1/ai_knowledge";
|
|
7
|
+
|
|
8
|
+
const AI_KNOWLEDGE_OPTIONS_URL = "/v1/base/ai/knowledge/options";
|
|
9
|
+
|
|
10
|
+
/** AI知识库选项服务。 */
|
|
11
|
+
export class AiKnowledgeServiceImpl implements AiKnowledgeService {
|
|
12
|
+
/** 查询可用的AI知识库选项。 */
|
|
13
|
+
ListAiKnowledgeOptions(request: ListAiKnowledgeOptionsRequest): Promise<ListAiKnowledgeOptionsResponse> {
|
|
14
|
+
return service<ListAiKnowledgeOptionsRequest, ListAiKnowledgeOptionsResponse>({
|
|
15
|
+
url: AI_KNOWLEDGE_OPTIONS_URL,
|
|
16
|
+
method: "get",
|
|
17
|
+
params: request
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const defAiKnowledgeService = new AiKnowledgeServiceImpl();
|
|
@@ -5,6 +5,8 @@ import type {
|
|
|
5
5
|
CreateAiProviderRequest,
|
|
6
6
|
DeleteAiProviderRequest,
|
|
7
7
|
GetAiProviderRequest,
|
|
8
|
+
ListAiProviderOptionsRequest,
|
|
9
|
+
ListAiProviderOptionsResponse,
|
|
8
10
|
PageAiProviderRequest,
|
|
9
11
|
PageAiProviderResponse,
|
|
10
12
|
SetAiProviderStatusRequest,
|
|
@@ -38,6 +40,11 @@ export class AiProviderServiceImpl implements AiProviderService {
|
|
|
38
40
|
return service({ url: `${AI_PROVIDER_URL}/${request.ai_provider?.id ?? ""}`, method: "put", data: request.ai_provider });
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
/** 查询已启用的AI供应商选项。 */
|
|
44
|
+
ListAiProviderOptions(request: ListAiProviderOptionsRequest): Promise<ListAiProviderOptionsResponse> {
|
|
45
|
+
return service({ url: `${AI_PROVIDER_URL}/options`, method: "get", params: request });
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
/** 测试供应商表单中的全部模型。 */
|
|
42
49
|
TestAiProviderModels(request: TestAiProviderModelsRequest): Promise<TestAiProviderModelsResponse> {
|
|
43
50
|
return service({ url: `${AI_PROVIDER_URL}/test-models`, method: "post", data: request.ai_provider });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import service from "@liujitcn/kratos-admin-core/request";
|
|
2
|
+
import type {
|
|
3
|
+
AiQueryService,
|
|
4
|
+
GetAiQueryRequest,
|
|
5
|
+
PageAiQueryRequest,
|
|
6
|
+
PageAiQueryResponse
|
|
7
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/ai_query";
|
|
8
|
+
import type { AiQueryRecord } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/ai_query";
|
|
9
|
+
|
|
10
|
+
const AI_QUERY_URL = "/v1/admin/base/ai-query";
|
|
11
|
+
|
|
12
|
+
/** 智能问数记录管理服务实现。 */
|
|
13
|
+
export class AiQueryServiceImpl implements AiQueryService {
|
|
14
|
+
/** 分页查询智能问数记录。 */
|
|
15
|
+
PageAiQuery(request: PageAiQueryRequest): Promise<PageAiQueryResponse> {
|
|
16
|
+
return service({ url: AI_QUERY_URL, method: "get", params: request });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 查询智能问数记录详情。 */
|
|
20
|
+
GetAiQuery(request: GetAiQueryRequest): Promise<AiQueryRecord> {
|
|
21
|
+
return service({ url: `${AI_QUERY_URL}/${request.id}`, method: "get" });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const defAiQueryService = new AiQueryServiceImpl();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import service from "@liujitcn/kratos-admin-core/request";
|
|
2
|
+
import type {
|
|
3
|
+
AiSessionService,
|
|
4
|
+
PageAiSessionMessageRequest,
|
|
5
|
+
PageAiSessionMessageResponse,
|
|
6
|
+
PageAiSessionRequest,
|
|
7
|
+
PageAiSessionResponse
|
|
8
|
+
} from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/ai_session";
|
|
9
|
+
|
|
10
|
+
const AI_SESSION_URL = "/v1/admin/base/ai-session";
|
|
11
|
+
|
|
12
|
+
/** AI会话管理服务实现。 */
|
|
13
|
+
export class AiSessionServiceImpl implements AiSessionService {
|
|
14
|
+
/** 分页查询AI会话。 */
|
|
15
|
+
PageAiSession(request: PageAiSessionRequest): Promise<PageAiSessionResponse> {
|
|
16
|
+
return service({ url: AI_SESSION_URL, method: "get", params: request });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 分页查询AI会话消息。 */
|
|
20
|
+
PageAiSessionMessage(request: PageAiSessionMessageRequest): Promise<PageAiSessionMessageResponse> {
|
|
21
|
+
return service({ url: `${AI_SESSION_URL}/${request.id}/message`, method: "get", params: { page_num: request.page_num, page_size: request.page_size } });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const defAiSessionService = new AiSessionServiceImpl();
|
|
@@ -58,7 +58,7 @@ const passwordFormFields = computed<ProFormField[]>(() => [
|
|
|
58
58
|
prop: "old_pwd",
|
|
59
59
|
label: t("system.profile.password.field.old_password"),
|
|
60
60
|
component: "password",
|
|
61
|
-
props: { placeholder: t("system.profile.password.placeholder.old_password") }
|
|
61
|
+
props: { autocomplete: "current-password", placeholder: t("system.profile.password.placeholder.old_password") }
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
prop: "new_pwd",
|
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
check-strictly
|
|
8
8
|
filterable
|
|
9
9
|
clearable
|
|
10
|
-
|
|
11
|
-
v-bind="$attrs"
|
|
10
|
+
v-bind="treeSelectAttrs"
|
|
12
11
|
/>
|
|
13
12
|
</template>
|
|
14
13
|
|
|
15
14
|
<script setup lang="ts">
|
|
16
|
-
import { computed, onMounted, ref } from "vue";
|
|
15
|
+
import { computed, onMounted, ref, useAttrs } from "vue";
|
|
17
16
|
import { defBaseTenantProjectService } from "@liujitcn/kratos-admin-system/api/system/admin/v1/base_tenant_project";
|
|
18
17
|
import type { TreeBaseTenantProjectResponse_Option } from "@liujitcn/kratos-admin-system/rpc/system/admin/v1/base_tenant_project";
|
|
19
18
|
|
|
@@ -50,12 +49,19 @@ const emit = defineEmits<{
|
|
|
50
49
|
(event: "change", value: TenantProjectSelection | undefined): void;
|
|
51
50
|
}>();
|
|
52
51
|
|
|
52
|
+
const attrs = useAttrs();
|
|
53
53
|
const loadedOptions = ref<TreeBaseTenantProjectResponse_Option[]>([]);
|
|
54
54
|
const treeOptions = computed(() => props.options ?? loadedOptions.value);
|
|
55
55
|
const treeProps = { label: "label", value: "value", children: "children" };
|
|
56
56
|
|
|
57
|
+
/** 消费方传入的 renderAfterExpand=false 会清空 el-tree-select 的选中标签缓存,导致已选值显示成节点原始值,这里统一忽略并保持标签缓存可用。 */
|
|
58
|
+
const treeSelectAttrs = computed(() => {
|
|
59
|
+
const { renderAfterExpand: _ignored, ...rest } = attrs;
|
|
60
|
+
return { ...rest, renderAfterExpand: true };
|
|
61
|
+
});
|
|
62
|
+
|
|
57
63
|
const selectedValue = computed<string | undefined>({
|
|
58
|
-
get: () => props.modelValue
|
|
64
|
+
get: () => resolveSelectedKey(props.modelValue),
|
|
59
65
|
set: value => {
|
|
60
66
|
const selection = parseSelection(value);
|
|
61
67
|
emit("update:modelValue", selection);
|
|
@@ -63,6 +69,17 @@ const selectedValue = computed<string | undefined>({
|
|
|
63
69
|
}
|
|
64
70
|
});
|
|
65
71
|
|
|
72
|
+
/** 解析选中的树节点值;容错误包了一层对象或非字符串的值,避免选中后显示 [object Object]。 */
|
|
73
|
+
function resolveSelectedKey(modelValue?: TenantProjectSelection): string | undefined {
|
|
74
|
+
const raw = modelValue?.value as unknown;
|
|
75
|
+
if (typeof raw === "string") return raw || undefined;
|
|
76
|
+
if (raw && typeof raw === "object") {
|
|
77
|
+
const nested = (raw as { value?: unknown }).value;
|
|
78
|
+
if (typeof nested === "string") return nested || undefined;
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
66
83
|
onMounted(async () => {
|
|
67
84
|
if (props.options) return;
|
|
68
85
|
const response = await defBaseTenantProjectService.TreeBaseTenantProject({ keyword: "" });
|