@blueking/ai-ui-sdk 0.3.0-beta.29 → 0.3.0-beta.30
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/dist/components/render-agent/agent-type.vue.css +3 -3
- package/dist/components/render-agent/agent-type.vue.js +1 -1
- package/dist/components/render-auto-height-textarea/index.vue.css +11 -11
- package/dist/components/render-auto-height-textarea/index.vue.js +1 -1
- package/dist/components/render-auto-refresh/index.vue.css +8 -8
- package/dist/components/render-auto-refresh/index.vue.js +1 -1
- package/dist/components/render-card/agent/prefix-info-tool.vue.css +5 -5
- package/dist/components/render-card/agent/prefix-info-tool.vue.js +1 -1
- package/dist/components/render-card/base.vue.css +12 -12
- package/dist/components/render-card/base.vue.js +1 -1
- package/dist/components/render-card/llm/corner-badge.vue.css +3 -3
- package/dist/components/render-card/llm/corner-badge.vue.js +1 -1
- package/dist/components/render-card/llm/icons.vue.css +2 -2
- package/dist/components/render-card/llm/icons.vue.js +1 -1
- package/dist/components/render-card/llm/info.vue.css +1 -1
- package/dist/components/render-card/llm/info.vue.js +1 -1
- package/dist/components/render-card/llm/tag-prefix.vue.css +3 -3
- package/dist/components/render-card/llm/tag-prefix.vue.js +1 -1
- package/dist/components/render-card/mcp/name-suffix.vue.css +2 -2
- package/dist/components/render-card/mcp/name-suffix.vue.js +1 -1
- package/dist/components/render-card/prompt/icons.vue.css +1 -1
- package/dist/components/render-card/prompt/icons.vue.js +1 -1
- package/dist/components/render-card/skill/prefix-info-tool.script.vue.js +11 -84
- package/dist/components/render-card/skill/tag-prefix.vue.css +3 -3
- package/dist/components/render-card/skill/tag-prefix.vue.js +1 -1
- package/dist/components/render-checkbox/index.vue.css +9 -9
- package/dist/components/render-checkbox/index.vue.js +1 -1
- package/dist/components/render-choose-tag/index.vue.css +7 -7
- package/dist/components/render-choose-tag/index.vue.js +1 -1
- package/dist/components/render-collapse/index.vue.css +2 -2
- package/dist/components/render-collapse/index.vue.js +1 -1
- package/dist/components/render-collection/content/index.vue.css +4 -4
- package/dist/components/render-collection/content/index.vue.js +1 -1
- package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.css +3 -3
- package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset/components/batch-edit-valid-dataset-data/index.vue.css +1 -1
- package/dist/components/render-dataset/components/batch-edit-valid-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset/components/dataset-data-tool-icons/index.script.vue.js +1 -1
- package/dist/components/render-dataset/components/dataset-data-valid/index.vue.css +1 -1
- package/dist/components/render-dataset/components/dataset-data-valid/index.vue.js +1 -1
- package/dist/components/render-dataset/components/edit-dataset-data/index.vue.css +3 -3
- package/dist/components/render-dataset/components/edit-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/index.vue.css +4 -4
- package/dist/components/render-dataset/components/operation-record/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/table/index.vue.css +1 -1
- package/dist/components/render-dataset/components/operation-record/table/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.css +2 -2
- package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset/index.vue.css +1 -1
- package/dist/components/render-dataset/components/plus-dataset/index.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.css +2 -2
- package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.css +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.css +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.js +1 -1
- package/dist/components/render-dataset/components/review-dataset-data/index.vue.css +10 -10
- package/dist/components/render-dataset/components/review-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset-detail-origin-data/index.vue.css +3 -3
- package/dist/components/render-dataset-detail-origin-data/index.vue.js +1 -1
- package/dist/components/render-dataset-list/components/main.vue.css +3 -3
- package/dist/components/render-dataset-list/components/main.vue.js +1 -1
- package/dist/components/render-dataset-list/index.vue.css +2 -2
- package/dist/components/render-dataset-list/index.vue.js +1 -1
- package/dist/components/render-dialog/choose-resource.vue.css +3 -3
- package/dist/components/render-dialog/choose-resource.vue.js +1 -1
- package/dist/components/render-dialog/choose-result.vue.css +14 -14
- package/dist/components/render-dialog/choose-result.vue.js +1 -1
- package/dist/components/render-dialog/choose-space.vue.css +9 -9
- package/dist/components/render-dialog/choose-space.vue.js +1 -1
- package/dist/components/render-dialog/index.vue.css +6 -6
- package/dist/components/render-dialog/index.vue.js +1 -1
- package/dist/components/render-file-card/index.vue.css +11 -11
- package/dist/components/render-file-card/index.vue.js +1 -1
- package/dist/components/render-file-type-icon/index.vue.css +6 -6
- package/dist/components/render-file-type-icon/index.vue.js +1 -1
- package/dist/components/render-generate-tag/index.vue.css +5 -5
- package/dist/components/render-generate-tag/index.vue.js +1 -1
- package/dist/components/render-header/index.vue.css +3 -3
- package/dist/components/render-header/index.vue.js +1 -1
- package/dist/components/render-knowledge/icon/index.vue.css +1 -1
- package/dist/components/render-knowledge/icon/index.vue.js +1 -1
- package/dist/components/render-like/index.vue.css +5 -5
- package/dist/components/render-like/index.vue.js +1 -1
- package/dist/components/render-prompt/content/index.vue.css +1 -1
- package/dist/components/render-prompt/content/index.vue.js +1 -1
- package/dist/components/render-reference/index.vue.css +2 -2
- package/dist/components/render-reference/index.vue.js +1 -1
- package/dist/components/render-relate-agent/{index.script.vue.js.js → index.script.vue.js} +183 -199
- package/dist/components/render-relate-agent/index.vue.js +1 -1
- package/dist/components/render-resource-version/index.vue.css +2 -2
- package/dist/components/render-resource-version/index.vue.js +1 -1
- package/dist/components/render-router-tab/index.vue.css +3 -3
- package/dist/components/render-router-tab/index.vue.js +1 -1
- package/dist/components/render-select-plus-extension/index.vue.css +3 -3
- package/dist/components/render-select-plus-extension/index.vue.js +1 -1
- package/dist/components/render-skill/variable-form/index.script.vue.js +136 -0
- package/dist/components/render-skill/variable-form/index.vue.d.ts +14 -0
- package/dist/components/render-skill/variable-form/index.vue.js +3 -0
- package/dist/components/render-t-table/index.vue.css +27 -27
- package/dist/components/render-t-table/index.vue.js +1 -1
- package/dist/components/render-tag-tree/index.vue.css +7 -7
- package/dist/components/render-tag-tree/index.vue.js +1 -1
- package/dist/components/render-tags/index.vue.css +6 -6
- package/dist/components/render-tags/index.vue.js +1 -1
- package/package.json +1 -1
|
@@ -1,92 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (info.done) {
|
|
10
|
-
resolve(value);
|
|
11
|
-
} else {
|
|
12
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1
|
+
var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) {
|
|
3
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
4
|
+
resolve(value);
|
|
5
|
+
});
|
|
13
6
|
}
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function _next(value) {
|
|
21
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
7
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
8
|
+
function fulfilled(value) {
|
|
9
|
+
try {
|
|
10
|
+
step(generator.next(value));
|
|
11
|
+
} catch (e) {
|
|
12
|
+
reject(e);
|
|
22
13
|
}
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
}
|
|
15
|
+
function rejected(value) {
|
|
16
|
+
try {
|
|
17
|
+
step(generator["throw"](value));
|
|
18
|
+
} catch (e) {
|
|
19
|
+
reject(e);
|
|
25
20
|
}
|
|
26
|
-
_next(undefined);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
if (key in obj) {
|
|
32
|
-
Object.defineProperty(obj, key, {
|
|
33
|
-
value: value,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
obj[key] = value;
|
|
40
|
-
}
|
|
41
|
-
return obj;
|
|
42
|
-
}
|
|
43
|
-
function _object_spread(target) {
|
|
44
|
-
for(var i = 1; i < arguments.length; i++){
|
|
45
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
46
|
-
var ownKeys = Object.keys(source);
|
|
47
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
48
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
49
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
50
|
-
}));
|
|
51
21
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
|
-
function ownKeys(object, enumerableOnly) {
|
|
59
|
-
var keys = Object.keys(object);
|
|
60
|
-
if (Object.getOwnPropertySymbols) {
|
|
61
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
62
|
-
if (enumerableOnly) {
|
|
63
|
-
symbols = symbols.filter(function(sym) {
|
|
64
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
65
|
-
});
|
|
22
|
+
function step(result) {
|
|
23
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
66
24
|
}
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
function _object_spread_props(target, source) {
|
|
72
|
-
source = source != null ? source : {};
|
|
73
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
74
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
75
|
-
} else {
|
|
76
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
77
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
import { defineComponent as _defineComponent } from 'vue';
|
|
25
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
import { defineComponent as _defineComponent, createVNode as _createVNode2 } from 'vue';
|
|
83
29
|
import { renderSlot as _renderSlot, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, resolveDirective as _resolveDirective, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, withDirectives as _withDirectives, createElementVNode as _createElementVNode, createVNode as _createVNode, unref as _unref } from "vue";
|
|
84
30
|
const _hoisted_1 = {
|
|
85
31
|
class: "g-flex-row g-justify-end g-mt-16"
|
|
86
32
|
};
|
|
87
33
|
import { ref, toRef, watch } from 'vue';
|
|
88
34
|
import { MAX_PAGE_SIZE, MODULE_NAME } from '../../common/constants.ts.js';
|
|
35
|
+
import { isEmpty } from '../../common/util.ts.js';
|
|
89
36
|
import RenderSelectPlusExtension from '../render-select-plus-extension/index.vue.js';
|
|
37
|
+
import VariableForm from '../render-skill/variable-form/index.vue.js';
|
|
90
38
|
import { useAgentHttp } from '../../hooks/use-agent-http.ts.js';
|
|
91
39
|
import { useClickoutside } from '../../hooks/use-clickoutside.ts.js';
|
|
92
40
|
import { useSpaceHttp } from '../../hooks/use-space-http.ts.js';
|
|
@@ -118,18 +66,40 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
118
66
|
const { getResourceAuthorizedSpaces } = useSpaceHttp(props.apiPrefix, toRef(props, 'spaceId'));
|
|
119
67
|
const { handleInitClickoutside } = useClickoutside();
|
|
120
68
|
const formRef = ref();
|
|
69
|
+
const variableFormRef = ref();
|
|
121
70
|
const agents = ref([]);
|
|
122
71
|
const spaces = ref([]);
|
|
123
72
|
const isLoadingAgents = ref(false);
|
|
124
73
|
const isLoadingSpaces = ref(false);
|
|
125
74
|
const isLoadingConfirm = ref(false);
|
|
126
75
|
const isShowPopover = ref(false);
|
|
127
|
-
const
|
|
76
|
+
const isShowConfirm = ref(false);
|
|
128
77
|
const hasMcpPermission = ref(undefined);
|
|
78
|
+
const hasRequiredSkillEnvs = ref(false);
|
|
79
|
+
const renderEnvs = ref([]);
|
|
129
80
|
const formData = ref({
|
|
130
81
|
selectedAgentId: undefined,
|
|
131
82
|
selectedSpaceId: undefined
|
|
132
83
|
});
|
|
84
|
+
const getWidth = ()=>{
|
|
85
|
+
return props.resourceType === Module.Skill ? 600 : 280;
|
|
86
|
+
};
|
|
87
|
+
const getContent = ()=>{
|
|
88
|
+
if (props.resourceType === Module.Skill) {
|
|
89
|
+
return _createVNode2(VariableForm, {
|
|
90
|
+
"ref": variableFormRef,
|
|
91
|
+
"skillEnvs": renderEnvs.value,
|
|
92
|
+
"onUpdate:skillEnvs": handleUpdateEnvs
|
|
93
|
+
}, null);
|
|
94
|
+
}
|
|
95
|
+
return '当前选择的 MCP 暂无使用权限且未经申请,提交后将自动创建申请单';
|
|
96
|
+
};
|
|
97
|
+
const getTitle = ()=>{
|
|
98
|
+
if (props.resourceType === Module.Skill) {
|
|
99
|
+
return '配置 Skill 环境变量';
|
|
100
|
+
}
|
|
101
|
+
return '确认提交申请?';
|
|
102
|
+
};
|
|
133
103
|
const handleGetSpacesAndSetDefaultSpace = ()=>{
|
|
134
104
|
isLoadingSpaces.value = true;
|
|
135
105
|
const params = {
|
|
@@ -140,9 +110,9 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
140
110
|
params.mcpType = props.resource.mcpType;
|
|
141
111
|
}
|
|
142
112
|
return getResourceAuthorizedSpaces(params).then((data)=>{
|
|
143
|
-
var
|
|
113
|
+
var _a;
|
|
144
114
|
spaces.value = data;
|
|
145
|
-
formData.value.selectedSpaceId = (
|
|
115
|
+
formData.value.selectedSpaceId = (_a = data[0]) === null || _a === void 0 ? void 0 : _a.spaceId;
|
|
146
116
|
}).finally(()=>{
|
|
147
117
|
isLoadingSpaces.value = false;
|
|
148
118
|
});
|
|
@@ -158,16 +128,16 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
158
128
|
agentType: AgentType.Single
|
|
159
129
|
};
|
|
160
130
|
getAgentList(params).then((data)=>{
|
|
161
|
-
var
|
|
131
|
+
var _a;
|
|
162
132
|
let list = data.results.filter((agent)=>{
|
|
163
|
-
var
|
|
164
|
-
return (
|
|
133
|
+
var _a;
|
|
134
|
+
return (_a = agent.permission) === null || _a === void 0 ? void 0 : _a.manageAgent;
|
|
165
135
|
});
|
|
166
136
|
if (props.resourceType === Module.Agent) {
|
|
167
137
|
list = list.filter((agent)=>agent.id !== props.resource.id);
|
|
168
138
|
}
|
|
169
139
|
agents.value = list;
|
|
170
|
-
formData.value.selectedAgentId = (
|
|
140
|
+
formData.value.selectedAgentId = (_a = list[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
171
141
|
}).finally(()=>{
|
|
172
142
|
isLoadingAgents.value = false;
|
|
173
143
|
});
|
|
@@ -181,48 +151,51 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
181
151
|
});
|
|
182
152
|
};
|
|
183
153
|
const handleClose = ()=>{
|
|
184
|
-
var
|
|
185
|
-
_formRef_value;
|
|
154
|
+
var _a;
|
|
186
155
|
// 关闭弹窗
|
|
187
156
|
isShowPopover.value = false;
|
|
188
|
-
|
|
157
|
+
isShowConfirm.value = false;
|
|
189
158
|
// 清空表单数据
|
|
190
159
|
formData.value.selectedAgentId = undefined;
|
|
191
160
|
formData.value.selectedSpaceId = undefined;
|
|
192
161
|
// 清空权限检查结果
|
|
193
162
|
hasMcpPermission.value = undefined;
|
|
194
|
-
|
|
163
|
+
// 清空必填环境变量检查结果
|
|
164
|
+
hasRequiredSkillEnvs.value = false;
|
|
165
|
+
// 清空环境变量
|
|
166
|
+
renderEnvs.value = [];
|
|
167
|
+
// 清空表单验证
|
|
168
|
+
(_a = formRef.value) === null || _a === void 0 ? void 0 : _a.clearValidate();
|
|
195
169
|
};
|
|
196
170
|
const handleClickOutside = ()=>{
|
|
197
171
|
handleClose();
|
|
198
172
|
};
|
|
199
|
-
const
|
|
200
|
-
|
|
173
|
+
const handleUpdateEnvs = (data)=>{
|
|
174
|
+
renderEnvs.value = [
|
|
175
|
+
...data
|
|
176
|
+
];
|
|
177
|
+
};
|
|
178
|
+
const handleShow = ()=>__awaiter(this, void 0, void 0, function*() {
|
|
201
179
|
if (isShowPopover.value) return;
|
|
202
180
|
isShowPopover.value = true;
|
|
203
181
|
yield handleGetSpacesAndSetDefaultSpace();
|
|
204
182
|
handleGetAgentsAndSetDefaultAgent();
|
|
205
183
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
209
|
-
}();
|
|
210
|
-
const handleRelateAgentToAgent = function() {
|
|
211
|
-
var _ref = _async_to_generator(function*(selectedAgent) {
|
|
212
|
-
var _selectedAgent_relatedAgents_agents, _selectedAgent_relatedAgents, _selectedAgent_relatedAgents1;
|
|
184
|
+
const handleRelateAgentToAgent = (selectedAgent)=>__awaiter(this, void 0, void 0, function*() {
|
|
185
|
+
var _a, _b, _c;
|
|
213
186
|
const resourceId = props.resource.id;
|
|
214
|
-
if ((
|
|
187
|
+
if ((_b = (_a = selectedAgent.relatedAgents) === null || _a === void 0 ? void 0 : _a.agents) === null || _b === void 0 ? void 0 : _b.find((agent)=>agent.id === resourceId)) return;
|
|
215
188
|
const currentAgent = yield getAgent(resourceId);
|
|
216
189
|
const selfCommands = currentAgent.conversationSettings.commands.filter((cmd)=>cmd.agentId === currentAgent.id);
|
|
217
190
|
const relatedAgents = [
|
|
218
|
-
...(
|
|
191
|
+
...(_c = selectedAgent.relatedAgents) === null || _c === void 0 ? void 0 : _c.agents,
|
|
219
192
|
currentAgent
|
|
220
193
|
];
|
|
221
|
-
yield updateAgent(
|
|
194
|
+
yield updateAgent(Object.assign(Object.assign({}, selectedAgent), {
|
|
222
195
|
relatedAgents: {
|
|
223
196
|
agents: relatedAgents
|
|
224
197
|
},
|
|
225
|
-
conversationSettings:
|
|
198
|
+
conversationSettings: Object.assign(Object.assign({}, selectedAgent.conversationSettings), {
|
|
226
199
|
commands: [
|
|
227
200
|
...selectedAgent.conversationSettings.commands,
|
|
228
201
|
...selfCommands
|
|
@@ -230,99 +203,71 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
230
203
|
})
|
|
231
204
|
}));
|
|
232
205
|
});
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const handleRelateToolToAgent = function() {
|
|
238
|
-
var _ref = _async_to_generator(function*(selectedAgent) {
|
|
239
|
-
var _selectedAgent_relatedTools_tools, _selectedAgent_relatedTools, _selectedAgent_relatedTools1, _selectedAgent_relatedTools2;
|
|
240
|
-
if ((_selectedAgent_relatedTools = selectedAgent.relatedTools) === null || _selectedAgent_relatedTools === void 0 ? void 0 : (_selectedAgent_relatedTools_tools = _selectedAgent_relatedTools.tools) === null || _selectedAgent_relatedTools_tools === void 0 ? void 0 : _selectedAgent_relatedTools_tools.find((tool)=>tool.id === props.resource.id)) return;
|
|
241
|
-
yield updateAgent(_object_spread_props(_object_spread({}, selectedAgent), {
|
|
206
|
+
const handleRelateToolToAgent = (selectedAgent)=>__awaiter(this, void 0, void 0, function*() {
|
|
207
|
+
var _a, _b, _c, _d;
|
|
208
|
+
if ((_b = (_a = selectedAgent.relatedTools) === null || _a === void 0 ? void 0 : _a.tools) === null || _b === void 0 ? void 0 : _b.find((tool)=>tool.id === props.resource.id)) return;
|
|
209
|
+
yield updateAgent(Object.assign(Object.assign({}, selectedAgent), {
|
|
242
210
|
relatedTools: {
|
|
243
211
|
tools: [
|
|
244
|
-
...((
|
|
212
|
+
...((_c = selectedAgent.relatedTools) === null || _c === void 0 ? void 0 : _c.tools) || [],
|
|
245
213
|
props.resource
|
|
246
214
|
],
|
|
247
|
-
mcps: ((
|
|
215
|
+
mcps: ((_d = selectedAgent.relatedTools) === null || _d === void 0 ? void 0 : _d.mcps) || []
|
|
248
216
|
}
|
|
249
217
|
}));
|
|
250
218
|
});
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
};
|
|
254
|
-
}();
|
|
255
|
-
const handleRelateKnowledgebaseToAgent = function() {
|
|
256
|
-
var _ref = _async_to_generator(function*(selectedAgent) {
|
|
257
|
-
var _selectedAgent_knowledgebaseSettings_knowledgebases, _selectedAgent_knowledgebaseSettings, _selectedAgent_knowledgebaseSettings1;
|
|
219
|
+
const handleRelateKnowledgebaseToAgent = (selectedAgent)=>__awaiter(this, void 0, void 0, function*() {
|
|
220
|
+
var _a, _b, _c;
|
|
258
221
|
const targetKb = props.resource;
|
|
259
|
-
const isAlreadyRelated = (
|
|
222
|
+
const isAlreadyRelated = (_b = (_a = selectedAgent.knowledgebaseSettings) === null || _a === void 0 ? void 0 : _a.knowledgebases) === null || _b === void 0 ? void 0 : _b.find((knowledgebase)=>knowledgebase.id === targetKb.id);
|
|
260
223
|
if (isAlreadyRelated) return;
|
|
261
|
-
yield updateAgent(
|
|
262
|
-
knowledgebaseSettings:
|
|
224
|
+
yield updateAgent(Object.assign(Object.assign({}, selectedAgent), {
|
|
225
|
+
knowledgebaseSettings: Object.assign(Object.assign({}, selectedAgent.knowledgebaseSettings), {
|
|
263
226
|
knowledgebases: [
|
|
264
|
-
...((
|
|
227
|
+
...((_c = selectedAgent.knowledgebaseSettings) === null || _c === void 0 ? void 0 : _c.knowledgebases) || [],
|
|
265
228
|
targetKb
|
|
266
229
|
]
|
|
267
230
|
})
|
|
268
231
|
}));
|
|
269
232
|
});
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const handleRelateMcpToAgent = function() {
|
|
275
|
-
var _ref = _async_to_generator(function*(selectedAgent) {
|
|
276
|
-
var _selectedAgent_relatedTools_mcps, _selectedAgent_relatedTools, _selectedAgent_relatedTools1, _selectedAgent_relatedTools2;
|
|
277
|
-
if ((_selectedAgent_relatedTools = selectedAgent.relatedTools) === null || _selectedAgent_relatedTools === void 0 ? void 0 : (_selectedAgent_relatedTools_mcps = _selectedAgent_relatedTools.mcps) === null || _selectedAgent_relatedTools_mcps === void 0 ? void 0 : _selectedAgent_relatedTools_mcps.find((mcp)=>mcp.id === props.resource.id && mcp.mcpType === props.resource.mcpType)) return;
|
|
278
|
-
yield updateAgent(_object_spread_props(_object_spread({}, selectedAgent), {
|
|
233
|
+
const handleRelateMcpToAgent = (selectedAgent)=>__awaiter(this, void 0, void 0, function*() {
|
|
234
|
+
var _a, _b, _c, _d;
|
|
235
|
+
if ((_b = (_a = selectedAgent.relatedTools) === null || _a === void 0 ? void 0 : _a.mcps) === null || _b === void 0 ? void 0 : _b.find((mcp)=>mcp.id === props.resource.id && mcp.mcpType === props.resource.mcpType)) return;
|
|
236
|
+
yield updateAgent(Object.assign(Object.assign({}, selectedAgent), {
|
|
279
237
|
relatedTools: {
|
|
280
|
-
tools: ((
|
|
238
|
+
tools: ((_c = selectedAgent.relatedTools) === null || _c === void 0 ? void 0 : _c.tools) || [],
|
|
281
239
|
mcps: [
|
|
282
|
-
...((
|
|
240
|
+
...((_d = selectedAgent.relatedTools) === null || _d === void 0 ? void 0 : _d.mcps) || [],
|
|
283
241
|
props.resource
|
|
284
242
|
]
|
|
285
243
|
}
|
|
286
244
|
}));
|
|
287
245
|
});
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const handleRelateSkillToAgent = function() {
|
|
293
|
-
var _ref = _async_to_generator(function*(selectedAgent) {
|
|
294
|
-
var _selectedAgent_relatedSkills_skills, _selectedAgent_relatedSkills, _selectedAgent_relatedSkills1;
|
|
295
|
-
if ((_selectedAgent_relatedSkills = selectedAgent.relatedSkills) === null || _selectedAgent_relatedSkills === void 0 ? void 0 : (_selectedAgent_relatedSkills_skills = _selectedAgent_relatedSkills.skills) === null || _selectedAgent_relatedSkills_skills === void 0 ? void 0 : _selectedAgent_relatedSkills_skills.find((skill)=>skill.id === props.resource.id)) return;
|
|
296
|
-
yield updateAgent(_object_spread_props(_object_spread({}, selectedAgent), {
|
|
246
|
+
const handleRelateSkillToAgent = (selectedAgent)=>__awaiter(this, void 0, void 0, function*() {
|
|
247
|
+
var _a, _b, _c;
|
|
248
|
+
if ((_b = (_a = selectedAgent.relatedSkills) === null || _a === void 0 ? void 0 : _a.skills) === null || _b === void 0 ? void 0 : _b.find((skill)=>skill.id === props.resource.id)) return;
|
|
249
|
+
yield updateAgent(Object.assign(Object.assign({}, selectedAgent), {
|
|
297
250
|
relatedSkills: {
|
|
298
251
|
skills: [
|
|
299
|
-
...(
|
|
300
|
-
props.resource
|
|
252
|
+
...(_c = selectedAgent.relatedSkills) === null || _c === void 0 ? void 0 : _c.skills,
|
|
253
|
+
Object.assign(Object.assign({}, props.resource), {
|
|
254
|
+
envs: renderEnvs.value
|
|
255
|
+
})
|
|
301
256
|
]
|
|
302
257
|
}
|
|
303
258
|
}));
|
|
304
259
|
});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
var _selectedAgent_promptSetting, _props_resource, _props_resource1;
|
|
312
|
-
if (((_selectedAgent_promptSetting = selectedAgent.promptSetting) === null || _selectedAgent_promptSetting === void 0 ? void 0 : _selectedAgent_promptSetting.llmCode) === ((_props_resource = props.resource) === null || _props_resource === void 0 ? void 0 : _props_resource.llmCode)) return;
|
|
313
|
-
yield updateAgent(_object_spread_props(_object_spread({}, selectedAgent), {
|
|
314
|
-
promptSetting: _object_spread_props(_object_spread({}, selectedAgent.promptSetting), {
|
|
315
|
-
llmCode: (_props_resource1 = props.resource) === null || _props_resource1 === void 0 ? void 0 : _props_resource1.llmCode
|
|
260
|
+
const handleRelateLLMToAgent = (selectedAgent)=>__awaiter(this, void 0, void 0, function*() {
|
|
261
|
+
var _a, _b, _c;
|
|
262
|
+
if (((_a = selectedAgent.promptSetting) === null || _a === void 0 ? void 0 : _a.llmCode) === ((_b = props.resource) === null || _b === void 0 ? void 0 : _b.llmCode)) return;
|
|
263
|
+
yield updateAgent(Object.assign(Object.assign({}, selectedAgent), {
|
|
264
|
+
promptSetting: Object.assign(Object.assign({}, selectedAgent.promptSetting), {
|
|
265
|
+
llmCode: (_c = props.resource) === null || _c === void 0 ? void 0 : _c.llmCode
|
|
316
266
|
})
|
|
317
267
|
}));
|
|
318
268
|
});
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
};
|
|
322
|
-
}();
|
|
323
|
-
const handleBindAndNavigate = function() {
|
|
324
|
-
var _ref = _async_to_generator(function*(selectedAgent) {
|
|
325
|
-
var _relateMap_props_resourceType;
|
|
269
|
+
const handleBindAndNavigate = (selectedAgent)=>__awaiter(this, void 0, void 0, function*() {
|
|
270
|
+
var _a;
|
|
326
271
|
const relateMap = {
|
|
327
272
|
[Module.Agent]: handleRelateAgentToAgent,
|
|
328
273
|
[Module.Mcp]: handleRelateMcpToAgent,
|
|
@@ -331,7 +276,7 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
331
276
|
[Module.LLM]: handleRelateLLMToAgent,
|
|
332
277
|
[Module.Knowledgebase]: handleRelateKnowledgebaseToAgent
|
|
333
278
|
};
|
|
334
|
-
yield (
|
|
279
|
+
yield (_a = relateMap[props.resourceType]) === null || _a === void 0 ? void 0 : _a.call(relateMap, selectedAgent);
|
|
335
280
|
emits('navigate', {
|
|
336
281
|
type: SdkNavigateActionType.AgentDetailSetting,
|
|
337
282
|
id: formData.value.selectedAgentId,
|
|
@@ -340,20 +285,15 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
340
285
|
});
|
|
341
286
|
handleClose();
|
|
342
287
|
});
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
};
|
|
346
|
-
}();
|
|
347
|
-
const handleConfirm = function() {
|
|
348
|
-
var _ref = _async_to_generator(function*() {
|
|
288
|
+
const handleConfirm = ()=>__awaiter(this, void 0, void 0, function*() {
|
|
289
|
+
var _a;
|
|
349
290
|
try {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
isShowApplyConfirm.value = true;
|
|
291
|
+
yield (_a = formRef.value) === null || _a === void 0 ? void 0 : _a.validate();
|
|
292
|
+
if (hasMcpPermission.value === false || hasRequiredSkillEnvs.value) {
|
|
293
|
+
// 没有权限或必填环境变量未配置,显示弹窗
|
|
294
|
+
isShowConfirm.value = true;
|
|
355
295
|
} else {
|
|
356
|
-
//
|
|
296
|
+
// 有权限且必填环境变量已配置,绑定并跳转
|
|
357
297
|
isLoadingConfirm.value = true;
|
|
358
298
|
const selectedAgent = yield getAgent(formData.value.selectedAgentId);
|
|
359
299
|
yield handleBindAndNavigate(selectedAgent);
|
|
@@ -364,12 +304,29 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
364
304
|
isLoadingConfirm.value = false;
|
|
365
305
|
}
|
|
366
306
|
});
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
307
|
+
const handlePopoverConfirm = ()=>{
|
|
308
|
+
if (props.resourceType === Module.Skill) {
|
|
309
|
+
handleValidateSkillAndConfirm();
|
|
310
|
+
}
|
|
311
|
+
if (props.resourceType === Module.Mcp) {
|
|
312
|
+
handleApplyPermissionAndConfirm();
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
const handleValidateSkillAndConfirm = ()=>__awaiter(this, void 0, void 0, function*() {
|
|
316
|
+
var _a;
|
|
317
|
+
isLoadingConfirm.value = true;
|
|
318
|
+
try {
|
|
319
|
+
yield (_a = variableFormRef.value) === null || _a === void 0 ? void 0 : _a.validate();
|
|
320
|
+
const selectedAgent = yield getAgent(formData.value.selectedAgentId);
|
|
321
|
+
yield handleBindAndNavigate(selectedAgent);
|
|
322
|
+
isShowConfirm.value = false;
|
|
323
|
+
} catch (error) {
|
|
324
|
+
console.error(error);
|
|
325
|
+
} finally{
|
|
326
|
+
isLoadingConfirm.value = false;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
const handleApplyPermissionAndConfirm = ()=>__awaiter(this, void 0, void 0, function*() {
|
|
373
330
|
isLoadingConfirm.value = true;
|
|
374
331
|
try {
|
|
375
332
|
const selectedAgent = yield getAgent(formData.value.selectedAgentId);
|
|
@@ -381,24 +338,47 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
381
338
|
];
|
|
382
339
|
yield resourceApply(resource, selectedAgent.id);
|
|
383
340
|
yield handleBindAndNavigate(selectedAgent);
|
|
384
|
-
|
|
341
|
+
isShowConfirm.value = false;
|
|
385
342
|
} catch (error) {
|
|
386
343
|
console.error(error);
|
|
387
344
|
} finally{
|
|
388
345
|
isLoadingConfirm.value = false;
|
|
389
346
|
}
|
|
390
347
|
});
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
};
|
|
394
|
-
}();
|
|
395
|
-
const handleCheckMcpPermission = ()=>{
|
|
396
|
-
// 如果资源类型不是 MCP 或者没有选择智能体,则不检查权限
|
|
397
|
-
if (props.resourceType !== Module.Mcp || !formData.value.selectedAgentId) {
|
|
398
|
-
hasMcpPermission.value = undefined;
|
|
348
|
+
const handleCheckConfirm = ()=>{
|
|
349
|
+
if (isEmpty(formData.value.selectedAgentId)) {
|
|
399
350
|
return;
|
|
400
351
|
}
|
|
401
|
-
|
|
352
|
+
if (props.resourceType === Module.Skill) {
|
|
353
|
+
handleCheckSkillEnvs();
|
|
354
|
+
}
|
|
355
|
+
if (props.resourceType === Module.Mcp) {
|
|
356
|
+
handleCheckMcpPermission();
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
// 检查是否有必填的环境变量
|
|
360
|
+
const handleCheckSkillEnvs = ()=>__awaiter(this, void 0, void 0, function*() {
|
|
361
|
+
var _a, _b, _c;
|
|
362
|
+
hasRequiredSkillEnvs.value = !isEmpty((_b = (_a = props.resource.bkaiDependencies) === null || _a === void 0 ? void 0 : _a.envs) === null || _b === void 0 ? void 0 : _b.some((env)=>env.required));
|
|
363
|
+
renderEnvs.value = [
|
|
364
|
+
...(_c = props.resource.bkaiDependencies) === null || _c === void 0 ? void 0 : _c.envs
|
|
365
|
+
];
|
|
366
|
+
if (hasRequiredSkillEnvs.value) {
|
|
367
|
+
isLoadingConfirm.value = true;
|
|
368
|
+
getAgent(formData.value.selectedAgentId).then((agent)=>{
|
|
369
|
+
var _a;
|
|
370
|
+
const isAlreadyRelated = (_a = agent.relatedSkills) === null || _a === void 0 ? void 0 : _a.skills.find((skill)=>skill.id === props.resource.id);
|
|
371
|
+
if (isAlreadyRelated) {
|
|
372
|
+
hasRequiredSkillEnvs.value = false;
|
|
373
|
+
renderEnvs.value = [];
|
|
374
|
+
}
|
|
375
|
+
}).finally(()=>{
|
|
376
|
+
isLoadingConfirm.value = false;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
// 检查 MCP 权限
|
|
381
|
+
const handleCheckMcpPermission = ()=>{
|
|
402
382
|
isLoadingConfirm.value = true;
|
|
403
383
|
const mcp = props.resource;
|
|
404
384
|
getAgentMcpPermission(formData.value.selectedAgentId, mcp.mcpCode, mcp.mcpType).then((res)=>{
|
|
@@ -410,10 +390,10 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
410
390
|
});
|
|
411
391
|
};
|
|
412
392
|
const handleCancelApply = ()=>{
|
|
413
|
-
|
|
393
|
+
isShowConfirm.value = false;
|
|
414
394
|
};
|
|
415
395
|
handleInitClickoutside('render-relate-agent-popover', handleClickOutside);
|
|
416
|
-
watch(()=>formData.value.selectedAgentId,
|
|
396
|
+
watch(()=>formData.value.selectedAgentId, handleCheckConfirm);
|
|
417
397
|
return (_ctx, _cache)=>{
|
|
418
398
|
const _component_bk_button = _resolveComponent("bk-button");
|
|
419
399
|
const _component_bk_select = _resolveComponent("bk-select");
|
|
@@ -515,15 +495,16 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
515
495
|
_createVNode(_component_bk_pop_confirm, {
|
|
516
496
|
trigger: "manual",
|
|
517
497
|
placement: "top",
|
|
518
|
-
width: "280",
|
|
519
|
-
title: "确认提交申请?",
|
|
520
|
-
content: "当前选择的 MCP 暂无使用权限且未经申请,提交后将自动创建申请单",
|
|
521
498
|
boundary: "parent",
|
|
522
|
-
"
|
|
499
|
+
"ext-cls": "g-popover-confirm",
|
|
500
|
+
width: getWidth(),
|
|
501
|
+
title: getTitle(),
|
|
502
|
+
content: getContent(),
|
|
503
|
+
"is-show": isShowConfirm.value,
|
|
523
504
|
"confirm-config": {
|
|
524
505
|
loading: isLoadingConfirm.value
|
|
525
506
|
},
|
|
526
|
-
onConfirm:
|
|
507
|
+
onConfirm: handlePopoverConfirm,
|
|
527
508
|
onCancel: handleCancelApply
|
|
528
509
|
}, {
|
|
529
510
|
default: _withCtx(()=>[
|
|
@@ -544,6 +525,9 @@ export default /*@__PURE__*/ _defineComponent({
|
|
|
544
525
|
]),
|
|
545
526
|
_: 1 /* STABLE */
|
|
546
527
|
}, 8 /* PROPS */ , [
|
|
528
|
+
"width",
|
|
529
|
+
"title",
|
|
530
|
+
"content",
|
|
547
531
|
"is-show",
|
|
548
532
|
"confirm-config"
|
|
549
533
|
]),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
.resource-version[data-v-
|
|
2
|
+
.resource-version[data-v-dy69ci8b] {
|
|
3
3
|
border-radius: 2px;
|
|
4
4
|
text-align: left;
|
|
5
5
|
color: #4D4F56;
|
|
6
6
|
background-color: #F0F1F5;
|
|
7
7
|
white-space: nowrap;
|
|
8
8
|
}
|
|
9
|
-
.resource-version .bkaidev-rizhifenxi[data-v-
|
|
9
|
+
.resource-version .bkaidev-rizhifenxi[data-v-dy69ci8b] {
|
|
10
10
|
color: #3A84FF;
|
|
11
11
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
.router-tab[data-v-
|
|
2
|
+
.router-tab[data-v-k6khudbn] {
|
|
3
3
|
margin-top: 2px;
|
|
4
4
|
height: 42px;
|
|
5
5
|
background: #FFFFFF;
|
|
6
6
|
box-shadow: 0 2px 4px 0 #1919290d;
|
|
7
7
|
padding: 0 24px;
|
|
8
8
|
}
|
|
9
|
-
.router-tab a[data-v-
|
|
9
|
+
.router-tab a[data-v-k6khudbn] {
|
|
10
10
|
padding: 0 8px;
|
|
11
11
|
margin-right: 24px;
|
|
12
12
|
font-size: 14px;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
color: #4D4F56;
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
}
|
|
18
|
-
.router-tab a.router-link-exact-active[data-v-
|
|
18
|
+
.router-tab a.router-link-exact-active[data-v-k6khudbn] {
|
|
19
19
|
color: #3A84FF;
|
|
20
20
|
border-bottom: 2px solid #3A84FF;
|
|
21
21
|
}
|