china-mobile-international-custom-components 0.0.58 → 0.0.60

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.
@@ -1,1008 +0,0 @@
1
- import { w as ge } from "./index.bCzIhWFw.js";
2
- import { createElementBlock as E, openBlock as c, Fragment as P, createCommentVNode as h, unref as e, renderSlot as _e, createVNode as a, withCtx as d, renderList as Y, createBlock as w, createElementVNode as M, resolveDynamicComponent as ue, toDisplayString as R, createTextVNode as S, normalizeClass as ve, computed as me, ref as g, onMounted as Re, reactive as Ae } from "vue";
3
- import { u as ce } from "./i18n.Bd7hh14j.js";
4
- import { g as F } from "./request.24c3shPx.js";
5
- import { ElRow as De, ElCol as Ce, ElIcon as N, ElButton as V, ElMessage as G, ElForm as Ie, ElFormItem as b, ElInput as B, ElSelect as we, ElOption as Te } from "element-plus";
6
- import { IconDelete as pe, IconHide as ye, IconWarn as Ne, IconGoto3 as Oe, Workflow as he } from "color-message-aibox-vue";
7
- import { UploadTypesEnum as re, FileUploader as xe } from "../FileUploader.mjs";
8
- import { api as ie } from "v-viewer";
9
- import { _ as Z } from "./_plugin-vue_export-helper.CHgC5LLL.js";
10
- import { useDialog as fe, DialogContainer as Le } from "../DialogContainer.mjs";
11
- import { useRouter as be } from "vue-router";
12
- import '../assets/index3.css';const Me = () => {
13
- const { $request: l, $env: r } = F();
14
- return {
15
- deleteKey: (_) => l({
16
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/model/key/${_}`,
17
- method: "delete"
18
- }),
19
- deleteOwnerModel: (_) => l({
20
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/model/${_}`,
21
- method: "delete"
22
- }),
23
- addModel: (_) => l({
24
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/model`,
25
- method: "post",
26
- data: _
27
- }),
28
- updateModel: (_, L) => l({
29
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/model/${_}`,
30
- method: "put",
31
- data: L
32
- })
33
- };
34
- }, Pe = (l) => /(txt|yaml)/i.test(l), Ue = (l) => /ppt|pptx/i.test(l), ke = (l) => /pdf/i.test(l);
35
- function Be(l) {
36
- return /(docx|doc|msword)/i.test(l);
37
- }
38
- function Se(l) {
39
- return /(xlsx|xls|sheet|csv)/i.test(l);
40
- }
41
- function $e(l) {
42
- return /(zip|rar|7z)$/i.test(l);
43
- }
44
- const q = (l) => /(jpe?g|png|bmp|gif|webp|svg|ico)(\?.*)?$/i.test(l), Ve = (l) => /(mp4|avi|rmvb|rm|wmv|flv|3gp|mkv|mov)(\?.*)?$/i.test(l), Ye = (l) => /(mp3|wav|wma|aac|flac)(\?.*)?$/i.test(l), Fe = (l) => /(md|markdown)/i.test(l), Ke = (l) => /(html|htm|xhtml|xml)/i.test(l), He = (l) => /(json)/i.test(l), Xe = (l) => {
45
- if (ke(l.suffix))
46
- return "Pdf1";
47
- if (Be(l.suffix))
48
- return "Doc";
49
- if (Se(l.suffix))
50
- return "Excel1";
51
- if (Ve(l.suffix))
52
- return "Video";
53
- if (Ye(l.suffix))
54
- return "Music";
55
- if (Ue(l.suffix))
56
- return "Ppt1";
57
- if (Fe(l.suffix))
58
- return "Md";
59
- if (Ke(l.suffix))
60
- return "Html";
61
- if (Pe(l.suffix))
62
- return "Txt1";
63
- if (He(l.suffix))
64
- return "Other";
65
- if ($e(l.suffix))
66
- return "Other";
67
- }, de = () => {
68
- const { $request: l, $env: r } = F();
69
- return {
70
- commonDownloadInterior: (O) => l({
71
- method: "get",
72
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/common/file/download/streams`,
73
- params: O,
74
- responseType: "arraybuffer"
75
- }),
76
- commonDownloadForeign: (O) => l({
77
- method: "get",
78
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/common/file/download/urls`,
79
- params: O
80
- }),
81
- commonFileDelete: (O) => l({
82
- method: "delete",
83
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/common/file`,
84
- params: O
85
- })
86
- };
87
- }, Ee = (l, r = "", f = "file") => {
88
- const t = new Blob([l]);
89
- if (f == "image")
90
- return URL.createObjectURL(t);
91
- {
92
- const u = document.createElement("a");
93
- u.style.display = "none";
94
- const O = window.URL.createObjectURL(t);
95
- u.href = O, u.setAttribute("download", r), document.body.appendChild(u), u.click(), document.body.removeChild(u), setTimeout(() => {
96
- window.URL.revokeObjectURL(O);
97
- }, 5e3);
98
- }
99
- }, Ge = () => ({
100
- downloadPrew: async (u) => {
101
- const { commonDownloadForeign: O } = de(), { data: _ } = await O({ "file-ids": [u.bnid] });
102
- _ && (q(u.suffix) || q(_[0].suffix) ? (_ && _.length, ie({
103
- images: [_[0].url],
104
- options: {
105
- zIndex: 3e3
106
- }
107
- })) : window.open(_[0].url, "_blank"));
108
- },
109
- downloadStreamPrew: async (u) => {
110
- const { commonDownloadInterior: O } = de(), _ = await O({ "file-ids": [u.bnid] });
111
- if (_)
112
- if (q(u.suffix)) {
113
- const L = Ee(_, u.name, "image");
114
- _ && ie({
115
- images: [L],
116
- options: {
117
- zIndex: 3e3
118
- }
119
- });
120
- } else
121
- Ee(_, u.name);
122
- },
123
- previewImage: (u) => {
124
- ie({
125
- images: [u],
126
- options: {
127
- zIndex: 3e3
128
- }
129
- });
130
- },
131
- deleteFile: async (u) => {
132
- const { commonFileDelete: O } = de();
133
- await O({ "file-ids": [u.bnid] });
134
- }
135
- }), qe = {
136
- key: 0,
137
- class: "panel-preview"
138
- }, ze = { class: "panel-preview__item" }, je = ["onClick"], We = ["src", "alt"], Qe = { class: "panel-preview__name ellipsis" }, Je = { key: 0 }, Ze = { key: 1 }, el = {
139
- key: 1,
140
- class: "upload-preview"
141
- }, ll = ["src", "alt"], tl = { class: "preview-item__mask" }, ol = {
142
- __name: "FilePreview",
143
- props: {
144
- fileList: {
145
- type: Array,
146
- default: () => []
147
- },
148
- canEdit: {
149
- type: Boolean,
150
- default: !0
151
- },
152
- previewType: {
153
- type: String,
154
- default: re.面板
155
- },
156
- isStream: {
157
- type: Boolean,
158
- default: !1
159
- },
160
- isCustom: {
161
- type: Boolean,
162
- default: !1
163
- }
164
- },
165
- emits: ["on-remove", "on-preview"],
166
- setup(l, { emit: r }) {
167
- const { downloadPrew: f, downloadStreamPrew: t } = Ge(), { t: u } = ce(), O = l, _ = r, L = (p) => Xe(p);
168
- function $(p) {
169
- O.isCustom ? _("on-preview", p) : O.isStream ? t(p) : f(p);
170
- }
171
- function A(p, D) {
172
- _("on-remove", p, D);
173
- }
174
- return (p, D) => (c(), E(P, null, [
175
- l.previewType === e(re).面板 ? (c(), E("div", qe, [
176
- _e(p.$slots, "PanelUploader", {}, void 0, !0),
177
- a(e(De), {
178
- gutter: 20,
179
- class: "panel-preview__row"
180
- }, {
181
- default: d(() => [
182
- (c(!0), E(P, null, Y(l.fileList, (m, C) => (c(), w(e(Ce), {
183
- span: 8,
184
- key: m.bnid
185
- }, {
186
- default: d(() => [
187
- M("div", ze, [
188
- M("div", {
189
- class: "panel-preview__box",
190
- onClick: (x) => $(m)
191
- }, [
192
- e(q)(m.suffix) ? (c(), E("img", {
193
- key: 0,
194
- src: m.url,
195
- alt: m.name,
196
- class: "panel-preview__img"
197
- }, null, 8, We)) : (c(), w(e(N), {
198
- key: 1,
199
- size: "32px",
200
- class: "panel-preview__img"
201
- }, {
202
- default: d(() => [
203
- (c(), w(ue(L(m))))
204
- ]),
205
- _: 2
206
- }, 1024)),
207
- M("span", Qe, R(m.name), 1)
208
- ], 8, je),
209
- m.isUploading ? (c(), E("div", Je, [
210
- a(e(V), {
211
- text: "",
212
- size: "small",
213
- loading: ""
214
- }, {
215
- default: d(() => [
216
- S(R(e(u)("COMPONENTS.UPLOADING")) + "...", 1)
217
- ]),
218
- _: 1
219
- })
220
- ])) : (c(), E("div", Ze, [
221
- l.canEdit ? (c(), w(e(N), {
222
- key: 0,
223
- size: "18",
224
- style: { cursor: "pointer" },
225
- onClick: (x) => A(C, m)
226
- }, {
227
- default: d(() => [
228
- a(e(pe))
229
- ]),
230
- _: 1
231
- }, 8, ["onClick"])) : h("", !0)
232
- ]))
233
- ])
234
- ]),
235
- _: 2
236
- }, 1024))), 128))
237
- ]),
238
- _: 1
239
- })
240
- ])) : h("", !0),
241
- l.previewType === e(re).卡片 ? (c(), E("ul", el, [
242
- (c(!0), E(P, null, Y(l.fileList, (m, C) => (c(), E("li", {
243
- class: "preview-item",
244
- key: m.bnid
245
- }, [
246
- e(q)(m.suffix) ? (c(), E("img", {
247
- key: 0,
248
- src: m.url,
249
- alt: m.name,
250
- class: "preview-item__img"
251
- }, null, 8, ll)) : (c(), w(e(N), {
252
- key: 1,
253
- size: "32px",
254
- class: "preview-item__img"
255
- }, {
256
- default: d(() => [
257
- (c(), w(ue(L(m))))
258
- ]),
259
- _: 2
260
- }, 1024)),
261
- M("div", tl, [
262
- a(e(N), {
263
- class: "preview-item__mask--view",
264
- onClick: (x) => $(m)
265
- }, {
266
- default: d(() => [
267
- a(e(ye))
268
- ]),
269
- _: 1
270
- }, 8, ["onClick"]),
271
- l.canEdit ? (c(), w(e(N), {
272
- key: 0,
273
- class: "preview-item__mask--delete",
274
- onClick: (x) => A(C, m)
275
- }, {
276
- default: d(() => [
277
- a(e(pe))
278
- ]),
279
- _: 1
280
- }, 8, ["onClick"])) : h("", !0)
281
- ])
282
- ]))), 128)),
283
- _e(p.$slots, "CardUploader", {}, void 0, !0)
284
- ])) : h("", !0)
285
- ], 64));
286
- }
287
- }, sl = /* @__PURE__ */ Z(ol, [["__scopeId", "data-v-7db94a07"]]), nl = () => {
288
- const { $request: l, $env: r } = F();
289
- return {
290
- getSystemReference: (t) => l({
291
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/system/reference`,
292
- method: "get",
293
- params: t
294
- })
295
- };
296
- }, al = () => {
297
- const { $request: l, $env: r } = F();
298
- return {
299
- deleteKnowledgeBase: (t) => l({
300
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/library/${t}`,
301
- method: "delete"
302
- })
303
- };
304
- }, rl = () => {
305
- const { $request: l, $env: r } = F();
306
- return {
307
- del: (t) => l({
308
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/workflow/${t}`,
309
- method: "delete"
310
- })
311
- };
312
- }, il = () => {
313
- const { $request: l, $env: r } = F();
314
- return {
315
- deleteId: (u) => l({
316
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/plugin/${u}`,
317
- method: "delete"
318
- }),
319
- deleteTools: (u) => l({
320
- url: `${r.VITE_APP_AIBOX_BASE_URL}/api/v1/plugin/tools/${u}`,
321
- method: "delete"
322
- })
323
- };
324
- }, dl = { class: "ai-box-tabs overflow-hidden" }, ul = ["onClick"], cl = {
325
- __name: "AiboxTabs",
326
- props: {
327
- modelValue: {
328
- type: [String, Number],
329
- default: () => ""
330
- },
331
- tabList: {
332
- type: Array,
333
- default: () => []
334
- }
335
- },
336
- emits: ["update:modelValue", "change"],
337
- setup(l, { emit: r }) {
338
- const f = r, t = (u) => {
339
- f("update:modelValue", u.value), f("change", u.value);
340
- };
341
- return (u, O) => (c(), E("div", dl, [
342
- M("ul", null, [
343
- (c(!0), E(P, null, Y(l.tabList, (_) => (c(), E("li", {
344
- key: _.value,
345
- onClick: (L) => t(_),
346
- class: ve(l.modelValue === _.value ? "current" : "")
347
- }, R(_.label), 11, ul))), 128))
348
- ])
349
- ]));
350
- }
351
- }, _l = /* @__PURE__ */ Z(cl, [["__scopeId", "data-v-f526f5ca"]]), pl = { class: "delete-title" }, Ol = { class: "custom-message-box" }, El = {
352
- class: "custom-message-box__title",
353
- style: { "line-height": "24px" }
354
- }, ml = { style: { color: "red" } }, fl = {
355
- key: 0,
356
- class: "custom-message-box__tip"
357
- }, Ll = {
358
- key: 0,
359
- class: "delete-tabs"
360
- }, Ml = {
361
- key: 0,
362
- class: "resource-list"
363
- }, gl = ["onClick"], vl = { class: "item-title" }, Rl = {
364
- key: 1,
365
- class: "resource-list"
366
- }, Al = ["onClick"], Dl = { class: "item-title" }, Cl = { class: "dialog-footer" }, Il = {
367
- __name: "DeleteResourceDialog",
368
- props: {
369
- title: {
370
- type: String,
371
- default: ""
372
- },
373
- deleteType: {
374
- type: String,
375
- default: ""
376
- }
377
- },
378
- emits: ["success"],
379
- setup(l, { expose: r, emit: f }) {
380
- const { getSystemReference: t } = nl(), { deleteKnowledgeBase: u } = al(), { del: O } = rl(), { deleteId: _, deleteTools: L } = il(), { deleteKey: $, deleteOwnerModel: A } = Me(), { t: p } = ce(), D = be(), { dialogRef: m, showDialog: C, hideDialog: x } = fe(), z = l, K = f, i = me(() => {
381
- const o = [];
382
- return T.value.length && o.push({
383
- // label: `${t('PLUGINLIST.APPLICATION_REFERENCED') || '已发布应用引用'}(${applyList.value.length})`,
384
- label: p("COMPONENTS_OUTER_SPHERE.APPLICATION_REFERENCE", {
385
- num: T.value.length
386
- }),
387
- value: "1"
388
- }), y.value.length && o.push({
389
- // label: `${t('PLUGINLIST.APPLICATION_REFERENCED_INFO') || '已发布工作流引用'}(${workflowList.value.length})`,
390
- label: p("COMPONENTS_OUTER_SPHERE.WORKFLOW_REFERENCE", {
391
- num: y.value.length
392
- }),
393
- value: "2"
394
- }), o;
395
- }), U = g("1"), v = g(""), T = g([]), y = g([]), ee = (o) => {
396
- const n = {
397
- model: {
398
- code: 1,
399
- desc: p("COMMON_TAG.APPLICATION"),
400
- deleteFn: async () => await A(v.value)
401
- },
402
- knowledge: {
403
- code: 2,
404
- desc: p("COMMON_TAG.KNOWLEDGE_BASE"),
405
- deleteFn: async () => await u(v.value)
406
- },
407
- workflow: {
408
- code: 4,
409
- desc: p("COMMON_TAG.WORKFLOW"),
410
- deleteFn: async () => await O(v.value)
411
- },
412
- plugin: {
413
- code: 6,
414
- desc: p("COMMON_TAG.PLUGIN"),
415
- deleteFn: async () => await _(v.value)
416
- },
417
- pluglit: {
418
- code: 6,
419
- desc: p("COMMON_TAG.TOOL"),
420
- deleteFn: async () => await L(v.value)
421
- },
422
- modelKey: {
423
- code: 7,
424
- desc: p("COMMON_TAG.MODEL_KEY"),
425
- deleteFn: async () => await $(v.value)
426
- }
427
- };
428
- return console.log(o, "value"), n[o];
429
- }, le = async () => {
430
- let o = v.value;
431
- z.deleteType == "plugin" && (o = W.value);
432
- const n = {
433
- bnid: o,
434
- size: 999,
435
- page: 1,
436
- "business-type": j
437
- }, { code: s, data: I } = await t(n);
438
- s === 0 && ((I.data || []).forEach((J) => {
439
- J.name == "workflow" && (y.value = J.data), J.name == "agent" && (T.value = J.data);
440
- }), T.value.length || (U.value = "2"));
441
- }, k = g("");
442
- let j = "", H = null;
443
- Re(() => {
444
- const o = ee(z.deleteType);
445
- k.value = o.desc || "", j = o.code || "", H = o.deleteFn || null;
446
- });
447
- const W = g(""), te = (o, n = "") => {
448
- v.value = o, W.value = n, C(), le();
449
- }, oe = async () => {
450
- if (!H) return;
451
- const o = await H();
452
- o && o.code == 0 ? (G({
453
- // message: `${t('COMMON_BUTTON.DELETE_TEXT') || '删除'}${deleteTypeStr.value}${t('MESSAGE_REMIND.SUCCESS_TEXT') || '成功'}`,
454
- message: p("COMPONENTS_OUTER_SPHERE.DELETE_DATA_SUCCESS", {
455
- name: k.value
456
- }),
457
- type: "success"
458
- }), K("success"), X()) : G({
459
- // message: `${t('COMMON_BUTTON.DELETE_TEXT' || '删除')}${deleteTypeStr.value}${t('MESSAGE_REMIND.FAIL_TEXT') || '失败'}`,
460
- message: p("COMPONENTS_OUTER_SPHERE.DELETE_DATA_FAILED", {
461
- name: k.value
462
- }),
463
- type: "error"
464
- });
465
- }, se = (o) => {
466
- D.push({ name: "AgentDetail", params: { bnid: o.skillet } });
467
- }, Q = (o) => {
468
- D.push({ name: "Workflow", params: { workflowBnid: o.skillet } });
469
- }, ne = () => {
470
- }, X = () => {
471
- x(), v.value = "", T.value = [], y.value = [];
472
- };
473
- return r({ showDeleteDialog: te, hideDeleteDialog: X }), (o, n) => (c(), w(e(Le), {
474
- title: l.title || e(p)("COMPONENTS_OUTER_SPHERE.CONFIRM_DELETE", { deleteTypeStr: k.value }),
475
- width: "520px",
476
- ref_key: "dialogRef",
477
- ref: m
478
- }, {
479
- footer: d(() => [
480
- M("div", Cl, [
481
- a(e(V), { onClick: X }, {
482
- default: d(() => [
483
- S(R(e(p)("COMMON_BUTTON.CANCEL_TEXT")), 1)
484
- ]),
485
- _: 1
486
- }),
487
- a(e(V), {
488
- type: "danger",
489
- onClick: oe
490
- }, {
491
- default: d(() => [
492
- S(R(e(p)("COMMON_BUTTON.CONFIRM_AFFIRM")), 1)
493
- ]),
494
- _: 1
495
- })
496
- ])
497
- ]),
498
- default: d(() => [
499
- M("div", pl, [
500
- a(e(N), { class: "warning-icon" }, {
501
- default: d(() => [
502
- a(e(Ne))
503
- ]),
504
- _: 1
505
- }),
506
- M("div", Ol, [
507
- M("div", El, [
508
- S(R(e(p)("COMPONENTS_OUTER_SPHERE.HISTORY_REFERENCE", { deleteTypeStr: k.value })) + " ", 1),
509
- M("span", ml, R(e(p)("PLUGINLIST.CAUTION")), 1)
510
- ]),
511
- T.value.length || y.value.length ? (c(), E("div", fl, R(e(p)("PLUGINLIST.CAUTION_INFO")), 1)) : h("", !0),
512
- n[1] || (n[1] = M("div", null, null, -1))
513
- ])
514
- ]),
515
- T.value.length || y.value.length ? (c(), E("div", Ll, [
516
- a(_l, {
517
- modelValue: U.value,
518
- "onUpdate:modelValue": n[0] || (n[0] = (s) => U.value = s),
519
- tabList: i.value,
520
- onChange: ne
521
- }, null, 8, ["modelValue", "tabList"]),
522
- U.value == "1" ? (c(), E("div", Ml, [
523
- (c(!0), E(P, null, Y(T.value, (s) => (c(), E("div", {
524
- class: "resource-item",
525
- key: s.resource,
526
- onClick: (I) => se(s)
527
- }, [
528
- n[2] || (n[2] = M("div", { class: "flow-name__icon-placeholder" }, null, -1)),
529
- M("div", vl, R(s.name), 1),
530
- a(e(N), null, {
531
- default: d(() => [
532
- a(e(Oe))
533
- ]),
534
- _: 1
535
- })
536
- ], 8, gl))), 128))
537
- ])) : h("", !0),
538
- U.value == "2" ? (c(), E("div", Rl, [
539
- (c(!0), E(P, null, Y(y.value, (s) => (c(), E("div", {
540
- class: "resource-item",
541
- key: s.resource,
542
- onClick: (I) => Q(s)
543
- }, [
544
- a(e(N), { size: "32px" }, {
545
- default: d(() => [
546
- a(e(he))
547
- ]),
548
- _: 1
549
- }),
550
- M("div", Dl, R(s.name), 1),
551
- a(e(N), null, {
552
- default: d(() => [
553
- a(e(Oe))
554
- ]),
555
- _: 1
556
- })
557
- ], 8, Al))), 128))
558
- ])) : h("", !0)
559
- ])) : h("", !0)
560
- ]),
561
- _: 1
562
- }, 8, ["title"]));
563
- }
564
- }, wl = /* @__PURE__ */ Z(Il, [["__scopeId", "data-v-71205bec"]]), Tl = { class: "dialog-footer" }, yl = {
565
- __name: "AddOrEditSupplierDialog",
566
- emits: ["submit", "success"],
567
- setup(l, { expose: r, emit: f }) {
568
- const { t } = ce(), { addModel: u, updateModel: O } = Me(), _ = g(null), L = g([]), $ = g(!1), A = g(!1), { dialogRef: p, hideDialog: D, resetDialog: m } = fe(A), C = g(!1), x = g(""), z = me(() => C.value ? t("COMMON_MODEL_LIBRARY.EDIT_MODEL") : t("COMMON_MODEL_LIBRARY.ADD_MODEL")), K = g(""), i = Ae({
569
- name: "",
570
- code: "",
571
- type: "",
572
- description: "",
573
- // supplier: '',
574
- apiKey: "",
575
- apiUrl: "",
576
- bnid: null,
577
- maxTokens: 2e6,
578
- contextLength: 2e6,
579
- icon: "0",
580
- avatarUrl: ""
581
- }), U = [
582
- {
583
- label: t("COMMON_MODEL_LIBRARY.MODEL_TYPE_LARGE_LANGUAGE_MODEL"),
584
- value: "llm"
585
- },
586
- {
587
- label: t("COMMON_MODEL_LIBRARY.MODEL_TYPE_MULTIMODAL_MODEL"),
588
- value: "multimodal"
589
- },
590
- {
591
- label: t("COMMON_MODEL_LIBRARY.MODEL_TYPE_EMBEDDING_MODEL"),
592
- value: "embedding"
593
- },
594
- { label: t("COMMON_MODEL_LIBRARY.MODEL_TYPE_RERANK_MODEL"), value: "rerank" }
595
- ], v = g(!i.bnid), T = {
596
- name: [
597
- {
598
- required: !0,
599
- message: t("COMMON_MODEL_LIBRARY.MODEL_NAME_REQUIRED"),
600
- trigger: "blur"
601
- },
602
- {
603
- max: 64,
604
- message: t("COMMON_MODEL_LIBRARY.MODEL_NAME_MAX_LENGTH"),
605
- trigger: "blur"
606
- },
607
- {
608
- validator: (o, n, s) => {
609
- n && /\s/.test(n) ? s(new Error(t("COMMON_MODEL_LIBRARY.MODEL_NAME_NO_SPACE"))) : s();
610
- },
611
- trigger: "blur"
612
- }
613
- ],
614
- code: [
615
- {
616
- required: !0,
617
- message: t("COMMON_MODEL_LIBRARY.MODEL_CODE_REQUIRED"),
618
- trigger: "blur"
619
- },
620
- {
621
- max: 64,
622
- message: t("COMMON_MODEL_LIBRARY.MODEL_CODE_MAX_LENGTH"),
623
- trigger: "blur"
624
- },
625
- {
626
- validator: (o, n, s) => {
627
- n && /\s/.test(n) ? s(new Error(t("COMMON_MODEL_LIBRARY.MODEL_CODE_NO_SPACE"))) : s();
628
- },
629
- trigger: "blur"
630
- }
631
- ],
632
- type: [
633
- {
634
- required: !0,
635
- message: t("COMMON_MODEL_LIBRARY.MODEL_TYPE_PLACEHOLDER"),
636
- trigger: "change"
637
- }
638
- ],
639
- // description: [{ required: true, message: '请输入供应商描述', trigger: 'blur' }],
640
- maxTokens: [
641
- {
642
- required: !0,
643
- message: t("COMMON_MODEL_LIBRARY.MAX_TOKENS_PLACEHOLDER"),
644
- trigger: "blur"
645
- }
646
- ],
647
- contextLength: [
648
- {
649
- required: !0,
650
- message: t("COMMON_MODEL_LIBRARY.CONTEXT_LENGTH_PLACEHOLDER"),
651
- trigger: "blur"
652
- }
653
- ],
654
- apiKey: [
655
- {
656
- required: !0,
657
- message: t("COMMON_MODEL_LIBRARY.API_KEY_REQUIRED"),
658
- trigger: "blur"
659
- }
660
- ],
661
- apiUrl: [
662
- {
663
- required: !0,
664
- message: t("COMMON_MODEL_LIBRARY.API_URL_REQUIRED"),
665
- trigger: "blur"
666
- },
667
- {
668
- validator: (o, n, s) => {
669
- if (!n) {
670
- s();
671
- return;
672
- }
673
- try {
674
- const I = new URL(n);
675
- if (I.protocol !== "http:" && I.protocol !== "https:") {
676
- s(new Error(t("COMMON_MODEL_LIBRARY.API_URL_INVALID")));
677
- return;
678
- }
679
- s();
680
- } catch {
681
- s(new Error(t("COMMON_MODEL_LIBRARY.API_URL_INVALID_DESC")));
682
- }
683
- },
684
- trigger: "blur"
685
- }
686
- ]
687
- }, y = f, ee = (o = null) => {
688
- console.log("data:", o), Object.assign(i, {
689
- name: "",
690
- code: "",
691
- type: "",
692
- description: "",
693
- maxTokens: 2e6,
694
- contextLength: 2e6,
695
- supplier: "",
696
- apiKey: "",
697
- apiUrl: "",
698
- bnid: null,
699
- avatarUrl: "",
700
- icon: "0"
701
- }), x.value = o?.rowData?.bnid || "", o?.rowData ? (console.log("rowData:", o.rowData), o.rowData.apiKey || ($.value = !0), Object.assign(i, o.rowData), K.value = o.rowData.apiUrl || "") : K.value = "", L.value = [], o ? (i.supplier = o.supplier || "", C.value = o.isEditDialog ?? !1, o.rowData?.icon && o.rowData.icon !== "0" && o.rowData?.avatarUrl && (L.value = [
702
- {
703
- bnid: o.rowData.icon,
704
- url: o.rowData.avatarUrl
705
- }
706
- ])) : C.value = !1, p.value?.showDialog();
707
- }, le = (o) => {
708
- o > 2e9 ? i.maxTokens = 2e9 : i.maxTokens = o;
709
- }, k = (o) => {
710
- o > 2e9 ? i.contextLength = 2e9 : i.contextLength = o;
711
- }, j = async () => {
712
- _.value && await _.value.validate(async (o) => {
713
- if (o) {
714
- A.value = !0;
715
- const n = 2e9;
716
- let s = Number(i.maxTokens), I = Number(i.contextLength);
717
- s = Math.min(s, n), I = Math.min(I, n);
718
- const ae = {
719
- name: i.name,
720
- code: i.code,
721
- icon: i.icon,
722
- type: i.type,
723
- description: i.description,
724
- maxTokens: s,
725
- contextLength: I,
726
- apiKey: i.apiKey,
727
- apiUrl: i.apiUrl
728
- };
729
- C.value ? await W(ae) : H(ae);
730
- } else
731
- G.error(t("COMMON_MODEL_LIBRARY.REQUIRED"));
732
- });
733
- }, H = async (o) => {
734
- try {
735
- console.log(o), (await u(o)).code === 0 && (G.success(t("COMMON_MODEL_LIBRARY.CREATE_MODEL_SUCCESS")), D(), y("submit"));
736
- } finally {
737
- A.value = !1;
738
- }
739
- }, W = async (o) => {
740
- console.log("更新模型formData:", o);
741
- try {
742
- (await O(x.value, o)).code === 0 && (G.success(t("COMMON_MODEL_LIBRARY.UPDATE_MODEL_SUCCESS")), D());
743
- } finally {
744
- A.value = !1;
745
- }
746
- }, te = () => {
747
- v.value = !v.value;
748
- }, oe = (o) => {
749
- i.avatarUrl = o.url, i.icon = o.bnid, L.value = [o];
750
- }, se = () => {
751
- i.icon = "0", L.value = [];
752
- }, Q = g(null), ne = () => {
753
- Q.value.showDeleteDialog(x.value);
754
- }, X = () => {
755
- D(), y("success");
756
- };
757
- return r({
758
- showDialog: ee,
759
- hideDialog: D
760
- }), (o, n) => (c(), E(P, null, [
761
- a(e(Le), {
762
- class: "custom-model-dialog",
763
- ref_key: "dialogRef",
764
- ref: p,
765
- title: z.value,
766
- width: "520px",
767
- onClosed: e(m)
768
- }, {
769
- footer: d(() => [
770
- M("div", Tl, [
771
- C.value ? (c(), w(e(V), {
772
- key: 0,
773
- style: { float: "left" },
774
- type: "danger",
775
- onClick: ne
776
- }, {
777
- default: d(() => [
778
- S(R(e(t)("COMMON_BUTTON.DELETE_TEXT")), 1)
779
- ]),
780
- _: 1
781
- })) : h("", !0),
782
- a(e(V), { onClick: e(D) }, {
783
- default: d(() => [
784
- S(R(e(t)("COMMON_BUTTON.CANCEL_TEXT")), 1)
785
- ]),
786
- _: 1
787
- }, 8, ["onClick"]),
788
- a(e(V), {
789
- type: "primary",
790
- loading: A.value,
791
- onClick: j,
792
- disabled: A.value
793
- }, {
794
- default: d(() => [
795
- S(R(A.value ? e(t)("COMMON_MODEL_LIBRARY.VALIDATION_LOADING") : e(t)("COMMON_BUTTON.CONFIRM_TEXT")), 1)
796
- ]),
797
- _: 1
798
- }, 8, ["loading", "disabled"])
799
- ])
800
- ]),
801
- default: d(() => [
802
- a(e(Ie), {
803
- ref_key: "formRef",
804
- ref: _,
805
- model: i,
806
- rules: T,
807
- "label-width": "auto",
808
- class: "vertical-form"
809
- }, {
810
- default: d(() => [
811
- a(e(b), {
812
- label: e(t)("COMMON_MODEL_LIBRARY.MODEL_NAME"),
813
- prop: "name"
814
- }, {
815
- default: d(() => [
816
- a(e(B), {
817
- modelValue: i.name,
818
- "onUpdate:modelValue": n[0] || (n[0] = (s) => i.name = s),
819
- placeholder: e(t)("COMMON_MODEL_LIBRARY.MODEL_NAME_PLACEHOLDER"),
820
- maxlength: 64
821
- }, null, 8, ["modelValue", "placeholder"])
822
- ]),
823
- _: 1
824
- }, 8, ["label"]),
825
- a(e(b), {
826
- label: e(t)("COMMON_MODEL_LIBRARY.MODEL_CODE"),
827
- prop: "code"
828
- }, {
829
- default: d(() => [
830
- a(e(B), {
831
- modelValue: i.code,
832
- "onUpdate:modelValue": n[1] || (n[1] = (s) => i.code = s),
833
- placeholder: e(t)("COMMON_MODEL_LIBRARY.MODEL_CODE_PLACEHOLDER"),
834
- maxlength: 64
835
- }, null, 8, ["modelValue", "placeholder"])
836
- ]),
837
- _: 1
838
- }, 8, ["label"]),
839
- a(e(b), {
840
- label: e(t)("COMMON_MODEL_LIBRARY.MODEL_AVATAR_URL"),
841
- prop: "avatarUrl"
842
- }, {
843
- default: d(() => [
844
- a(sl, {
845
- fileList: L.value,
846
- previewType: "Card",
847
- onOnRemove: se
848
- }, {
849
- CardUploader: d(() => [
850
- L.value.length === 0 ? (c(), w(e(xe), {
851
- key: 0,
852
- limitSize: 5,
853
- acceptType: ".jpg,.png",
854
- defaultUploadIcon: "model",
855
- onOnSuccess: oe,
856
- businessType: "model"
857
- })) : h("", !0)
858
- ]),
859
- _: 1
860
- }, 8, ["fileList"])
861
- ]),
862
- _: 1
863
- }, 8, ["label"]),
864
- a(e(b), {
865
- label: e(t)("COMMON_MODEL_LIBRARY.MODEL_TYPE"),
866
- prop: "type"
867
- }, {
868
- default: d(() => [
869
- a(e(we), {
870
- modelValue: i.type,
871
- "onUpdate:modelValue": n[2] || (n[2] = (s) => i.type = s),
872
- placeholder: e(t)("COMMON_MODEL_LIBRARY.MODEL_TYPE_PLACEHOLDER"),
873
- style: { width: "100%" }
874
- }, {
875
- default: d(() => [
876
- (c(), E(P, null, Y(U, (s) => a(e(Te), {
877
- key: s.value,
878
- label: s.label,
879
- value: s.value
880
- }, null, 8, ["label", "value"])), 64))
881
- ]),
882
- _: 1
883
- }, 8, ["modelValue", "placeholder"])
884
- ]),
885
- _: 1
886
- }, 8, ["label"]),
887
- a(e(b), {
888
- label: e(t)("COMMON_MODEL_LIBRARY.MODEL_DESCRIPTION"),
889
- prop: "description"
890
- }, {
891
- default: d(() => [
892
- a(e(B), {
893
- modelValue: i.description,
894
- "onUpdate:modelValue": n[3] || (n[3] = (s) => i.description = s),
895
- type: "textarea",
896
- placeholder: e(t)("COMMON_MODEL_LIBRARY.MODEL_DESCRIPTION_PLACEHOLDER"),
897
- maxlength: 200,
898
- "show-word-limit": ""
899
- }, null, 8, ["modelValue", "placeholder"])
900
- ]),
901
- _: 1
902
- }, 8, ["label"]),
903
- a(e(b), {
904
- label: e(t)("COMMON_MODEL_LIBRARY.MAX_TOKENS"),
905
- prop: "maxTokens"
906
- }, {
907
- default: d(() => [
908
- a(e(B), {
909
- modelValue: i.maxTokens,
910
- "onUpdate:modelValue": n[4] || (n[4] = (s) => i.maxTokens = s),
911
- placeholder: e(t)("COMMON_MODEL_LIBRARY.MAX_TOKENS_PLACEHOLDER"),
912
- onInput: le
913
- }, null, 8, ["modelValue", "placeholder"])
914
- ]),
915
- _: 1
916
- }, 8, ["label"]),
917
- a(e(b), {
918
- label: e(t)("COMMON_MODEL_LIBRARY.CONTEXT_LENGTH"),
919
- prop: "contextLength"
920
- }, {
921
- default: d(() => [
922
- a(e(B), {
923
- modelValue: i.contextLength,
924
- "onUpdate:modelValue": n[5] || (n[5] = (s) => i.contextLength = s),
925
- placeholder: e(t)("COMMON_MODEL_LIBRARY.CONTEXT_LENGTH_PLACEHOLDER"),
926
- onInput: k
927
- }, null, 8, ["modelValue", "placeholder"])
928
- ]),
929
- _: 1
930
- }, 8, ["label"]),
931
- a(e(b), {
932
- label: e(t)("COMMON_MODEL_LIBRARY.API_KEY"),
933
- prop: "apiKey"
934
- }, {
935
- default: d(() => [
936
- a(e(B), {
937
- modelValue: i.apiKey,
938
- "onUpdate:modelValue": n[6] || (n[6] = (s) => i.apiKey = s),
939
- placeholder: e(t)("COMMON_MODEL_LIBRARY.API_KEY_PLACEHOLDER"),
940
- type: v.value ? "text" : "password"
941
- }, {
942
- suffix: d(() => [
943
- a(e(N), {
944
- class: "cursor-pointer",
945
- onClick: te
946
- }, {
947
- default: d(() => [
948
- (c(), w(ue(v.value ? "IconLook" : "IconHide")))
949
- ]),
950
- _: 1
951
- })
952
- ]),
953
- _: 1
954
- }, 8, ["modelValue", "placeholder", "type"])
955
- ]),
956
- _: 1
957
- }, 8, ["label"]),
958
- a(e(b), {
959
- label: e(t)("COMMON_MODEL_LIBRARY.API_URL"),
960
- prop: "apiUrl"
961
- }, {
962
- default: d(() => [
963
- a(e(B), {
964
- modelValue: i.apiUrl,
965
- "onUpdate:modelValue": n[7] || (n[7] = (s) => i.apiUrl = s),
966
- placeholder: e(t)("COMMON_MODEL_LIBRARY.API_URL_PLACEHOLDER"),
967
- disabled: !!K.value
968
- }, null, 8, ["modelValue", "placeholder", "disabled"])
969
- ]),
970
- _: 1
971
- }, 8, ["label"])
972
- ]),
973
- _: 1
974
- }, 8, ["model"])
975
- ]),
976
- _: 1
977
- }, 8, ["title", "onClosed"]),
978
- a(wl, {
979
- ref_key: "deleteResourceDialog",
980
- ref: Q,
981
- deleteType: "model",
982
- onSuccess: X
983
- }, null, 512)
984
- ], 64));
985
- }
986
- }, Nl = /* @__PURE__ */ Z(yl, [["__scopeId", "data-v-36a3918c"]]), Fl = ge(Nl);
987
- export {
988
- Fl as A,
989
- wl as D,
990
- sl as F,
991
- _l as a,
992
- Se as b,
993
- Ke as c,
994
- Ee as d,
995
- q as e,
996
- He as f,
997
- de as g,
998
- Fe as h,
999
- Ye as i,
1000
- ke as j,
1001
- Ue as k,
1002
- Pe as l,
1003
- Ve as m,
1004
- Be as n,
1005
- $e as o,
1006
- Ge as p,
1007
- Xe as u
1008
- };