yc-component 0.1.14 → 0.1.15
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/ai-task/style.css +1 -1
- package/dist/image-selector/components/YcImageSelectorDialog.d.ts +21 -2
- package/dist/image-selector/components/YcImageSelectorDialog.d.ts.map +1 -1
- package/dist/image-selector/components/YcImageSelectorProvider.d.ts.map +1 -1
- package/dist/image-selector/errors.d.ts +6 -0
- package/dist/image-selector/errors.d.ts.map +1 -1
- package/dist/image-selector/index.d.ts +3 -2
- package/dist/image-selector/index.d.ts.map +1 -1
- package/dist/image-selector/style.css +1 -1
- package/dist/image-selector/types/index.d.ts +15 -0
- package/dist/image-selector/types/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/page-window/style.css +1 -1
- package/dist/yc-component.cjs.full.js +22 -22
- package/dist/yc-component.cjs.js +2 -2
- package/dist/yc-component.esm.full.js +4779 -4716
- package/dist/yc-component.esm.js +1066 -1003
- package/dist/yc-component.umd.full.js +39 -39
- package/dist/yc-component.umd.full.min.js +1 -1
- package/dist/yc-component.umd.js +3 -3
- package/dist/yc-component.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/yc-component.esm.js
CHANGED
|
@@ -1,56 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
var Yt = Object.defineProperty;
|
|
2
|
+
var jt = (e, n, t) => n in e ? Yt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
+
var tt = (e, n, t) => jt(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import ut from "axios";
|
|
5
|
+
import { reactive as ct, defineComponent as de, computed as P, ref as b, watch as ne, onMounted as Ke, onUnmounted as Ne, resolveComponent as B, resolveDirective as dt, openBlock as u, createBlock as M, withCtx as g, createElementVNode as T, createVNode as m, withKeys as Gt, unref as w, createCommentVNode as $, createTextVNode as G, createElementBlock as E, normalizeClass as fe, toDisplayString as D, Fragment as re, renderList as he, withDirectives as _e, renderSlot as ye, normalizeProps as ft, mergeProps as ze, withModifiers as Wt, nextTick as nt, render as qt, onBeforeUnmount as Ht, Transition as pt, normalizeStyle as ot, vShow as De, inject as Ye, Teleport as Jt, provide as Be, isRef as Xt } from "vue";
|
|
6
|
+
import { ElMessage as Q } from "element-plus";
|
|
7
|
+
import { Search as Qt, Upload as Zt, Check as mt, ArrowLeft as en, ArrowUpBold as tn, ArrowDownBold as nn, Switch as on, Close as gt, Refresh as lt, ArrowDown as ln, CircleCheck as an, CircleClose as sn, Remove as rn } from "@element-plus/icons-vue";
|
|
8
|
+
import { storeToRefs as un, defineStore as cn } from "pinia";
|
|
9
|
+
const je = {
|
|
7
10
|
projectId: "default-project",
|
|
8
11
|
storageKey: "yc-ai-task-queue-v1"
|
|
9
12
|
};
|
|
10
|
-
let
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
+
let we = { ...je };
|
|
14
|
+
function dn(e) {
|
|
15
|
+
we = { ...we, ...e };
|
|
13
16
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
17
|
+
function vt() {
|
|
18
|
+
return we;
|
|
16
19
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
20
|
+
function fn() {
|
|
21
|
+
return we.projectId ?? je.projectId;
|
|
19
22
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
23
|
+
function ht() {
|
|
24
|
+
return we.storageKey ?? je.storageKey;
|
|
22
25
|
}
|
|
23
|
-
let
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
+
let ce = null;
|
|
27
|
+
function pn() {
|
|
28
|
+
ce = null;
|
|
26
29
|
}
|
|
27
|
-
function
|
|
28
|
-
if (
|
|
29
|
-
const { baseURL: e, getToken: n, onUnauthorized: t } =
|
|
30
|
-
return
|
|
30
|
+
function pe() {
|
|
31
|
+
if (ce) return ce;
|
|
32
|
+
const { baseURL: e, getToken: n, onUnauthorized: t } = vt();
|
|
33
|
+
return ce = ut.create({
|
|
31
34
|
baseURL: e ?? "",
|
|
32
35
|
timeout: 6e4,
|
|
33
36
|
headers: { "Content-Type": "application/json" }
|
|
34
|
-
}),
|
|
35
|
-
const
|
|
36
|
-
return
|
|
37
|
-
}),
|
|
37
|
+
}), ce.interceptors.request.use((o) => {
|
|
38
|
+
const s = n == null ? void 0 : n();
|
|
39
|
+
return s && (o.headers.Authorization = `Bearer ${s}`), o;
|
|
40
|
+
}), ce.interceptors.response.use(
|
|
38
41
|
(o) => {
|
|
39
|
-
const
|
|
40
|
-
return (
|
|
42
|
+
const s = o.data;
|
|
43
|
+
return (s == null ? void 0 : s.code) != null && s.code !== 200 ? Promise.reject(new Error(s.message || "请求失败")) : (o.data = (s == null ? void 0 : s.data) ?? s, o);
|
|
41
44
|
},
|
|
42
45
|
(o) => {
|
|
43
|
-
var
|
|
44
|
-
((
|
|
45
|
-
const
|
|
46
|
-
return Promise.reject(new Error(
|
|
46
|
+
var d, v, _;
|
|
47
|
+
((d = o.response) == null ? void 0 : d.status) === 401 && (t == null || t());
|
|
48
|
+
const s = (_ = (v = o.response) == null ? void 0 : v.data) == null ? void 0 : _.message;
|
|
49
|
+
return Promise.reject(new Error(s || o.message || "请求失败"));
|
|
47
50
|
}
|
|
48
|
-
),
|
|
51
|
+
), ce;
|
|
49
52
|
}
|
|
50
|
-
async function
|
|
51
|
-
const o = (await
|
|
53
|
+
async function mn(e, n) {
|
|
54
|
+
const o = (await pe().get(
|
|
52
55
|
`/yc-ai/workflows/runs/${e}/artifacts/${n}`,
|
|
53
|
-
{ transformResponse: [(
|
|
56
|
+
{ transformResponse: [(s) => s] }
|
|
54
57
|
)).data;
|
|
55
58
|
if (typeof o == "string")
|
|
56
59
|
try {
|
|
@@ -60,79 +63,91 @@ async function an(e, n) {
|
|
|
60
63
|
}
|
|
61
64
|
return o;
|
|
62
65
|
}
|
|
63
|
-
let
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
+
let Ve = {};
|
|
67
|
+
function gn(e) {
|
|
68
|
+
Ve = { ...Ve, ...e };
|
|
66
69
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
70
|
+
function Ae() {
|
|
71
|
+
return Ve;
|
|
69
72
|
}
|
|
70
|
-
class
|
|
73
|
+
class be extends Error {
|
|
71
74
|
constructor(n = "Image selector cancelled") {
|
|
72
75
|
super(n), this.name = "ImageSelectorCancelledError";
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
class at extends Error {
|
|
79
|
+
constructor(t, o) {
|
|
80
|
+
super(o || {
|
|
81
|
+
missing_token: "请先填写并保存云盘 Access Token",
|
|
82
|
+
unauthorized: "云盘 Access Token 无效或已过期",
|
|
83
|
+
valid_site: "请先在云盘配置有效站点",
|
|
84
|
+
unknown: "云盘鉴权失败"
|
|
85
|
+
}[t]);
|
|
86
|
+
tt(this, "reason");
|
|
87
|
+
this.name = "ImageSelectorAuthError", this.reason = t;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
let Z = null;
|
|
91
|
+
function vn() {
|
|
92
|
+
return Z && (Z.reject(new be()), Z = null), new Promise((e, n) => {
|
|
93
|
+
Z = { resolve: e, reject: n };
|
|
79
94
|
});
|
|
80
95
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
96
|
+
function hn(e) {
|
|
97
|
+
Z == null || Z.resolve(e), Z = null;
|
|
83
98
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
99
|
+
function it() {
|
|
100
|
+
Z == null || Z.reject(new be()), Z = null;
|
|
86
101
|
}
|
|
87
|
-
const
|
|
88
|
-
function
|
|
102
|
+
const $e = "__YC_COMPONENT_IMAGE_SELECTOR__", Oe = "yc-component:image-selector-open";
|
|
103
|
+
function _n() {
|
|
89
104
|
const e = globalThis;
|
|
90
|
-
return e[
|
|
105
|
+
return e[$e] || (e[$e] = ct({
|
|
91
106
|
visible: !1,
|
|
92
107
|
options: {}
|
|
93
|
-
})), e[
|
|
108
|
+
})), e[$e];
|
|
94
109
|
}
|
|
95
|
-
const
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
new CustomEvent(
|
|
110
|
+
const q = _n();
|
|
111
|
+
function yn(e = {}) {
|
|
112
|
+
q.options = { ...e }, q.visible = !0, globalThis.dispatchEvent(
|
|
113
|
+
new CustomEvent(Oe, { detail: { ...e } })
|
|
99
114
|
);
|
|
100
115
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
116
|
+
function _t() {
|
|
117
|
+
q.visible = !1;
|
|
103
118
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
119
|
+
function yt() {
|
|
120
|
+
_t();
|
|
106
121
|
}
|
|
107
|
-
function
|
|
108
|
-
const n =
|
|
109
|
-
return
|
|
122
|
+
function wt(e = {}) {
|
|
123
|
+
const n = vn();
|
|
124
|
+
return yn(e), n;
|
|
110
125
|
}
|
|
111
|
-
const
|
|
126
|
+
const wn = { class: "yc-image-selector" }, Tn = { class: "yc-image-selector__toolbar" }, In = { class: "yc-image-selector__body" }, Cn = {
|
|
112
127
|
key: 0,
|
|
113
128
|
class: "yc-image-selector__aside"
|
|
114
|
-
},
|
|
129
|
+
}, Sn = ["onClick"], kn = {
|
|
115
130
|
key: 0,
|
|
116
131
|
class: "yc-image-selector__category-count"
|
|
117
|
-
},
|
|
132
|
+
}, xn = { class: "yc-image-selector__main" }, bn = {
|
|
118
133
|
key: 1,
|
|
119
134
|
class: "yc-image-selector__grid"
|
|
120
|
-
},
|
|
135
|
+
}, An = ["onClick"], En = { class: "yc-image-selector__thumb" }, Mn = ["src", "alt", "onLoad"], Pn = {
|
|
121
136
|
key: 0,
|
|
122
137
|
class: "yc-image-selector__order"
|
|
123
|
-
},
|
|
138
|
+
}, $n = ["title"], Ln = {
|
|
124
139
|
key: 0,
|
|
125
140
|
class: "yc-image-selector__selected-bar"
|
|
126
|
-
},
|
|
141
|
+
}, Dn = { class: "yc-image-selector__selected-bar-label" }, Bn = { class: "yc-image-selector__selected-bar-list" }, Vn = ["onClick"], On = ["src", "alt"], Un = {
|
|
127
142
|
key: 1,
|
|
128
143
|
class: "yc-image-selector__pagination"
|
|
129
|
-
},
|
|
144
|
+
}, Fn = {
|
|
130
145
|
key: 0,
|
|
131
146
|
class: "yc-image-selector__footer"
|
|
132
|
-
},
|
|
147
|
+
}, Rn = { class: "yc-image-selector__selected-tip" }, Kn = { class: "yc-image-selector__footer-actions" }, Nn = {
|
|
133
148
|
key: 1,
|
|
134
149
|
class: "yc-image-selector__footer yc-image-selector__footer--quick"
|
|
135
|
-
},
|
|
150
|
+
}, zn = { class: "yc-image-selector__selected-tip" }, Yn = /* @__PURE__ */ de({
|
|
136
151
|
__name: "YcImageSelectorDialog",
|
|
137
152
|
props: {
|
|
138
153
|
modelValue: { type: [Boolean, null], default: null },
|
|
@@ -152,337 +167,373 @@ const fn = { class: "yc-image-selector" }, pn = { class: "yc-image-selector__too
|
|
|
152
167
|
confirmText: { default: "确定" },
|
|
153
168
|
cancelText: { default: "取消" },
|
|
154
169
|
emptyText: { default: "暂无图片资源" },
|
|
170
|
+
renderEmpty: {},
|
|
155
171
|
getImages: {},
|
|
156
172
|
upload: {},
|
|
157
173
|
urlField: { default: "url" }
|
|
158
174
|
},
|
|
159
175
|
emits: ["update:modelValue", "confirm", "cancel"],
|
|
160
176
|
setup(e, { emit: n }) {
|
|
161
|
-
const t =
|
|
177
|
+
const t = de({
|
|
178
|
+
name: "YcImageSelectorRenderEmpty",
|
|
179
|
+
props: {
|
|
180
|
+
render: {
|
|
181
|
+
type: Function,
|
|
182
|
+
required: !0
|
|
183
|
+
},
|
|
184
|
+
ctx: {
|
|
185
|
+
type: Object,
|
|
186
|
+
required: !0
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
setup(a) {
|
|
190
|
+
return () => a.render(a.ctx);
|
|
191
|
+
}
|
|
192
|
+
}), o = e, s = n, d = P(() => o.modelValue != null), v = b(!1), _ = b(null);
|
|
162
193
|
ne(
|
|
163
|
-
() =>
|
|
164
|
-
(
|
|
165
|
-
|
|
194
|
+
() => o.modelValue,
|
|
195
|
+
(a) => {
|
|
196
|
+
d.value && (v.value = !!a);
|
|
166
197
|
},
|
|
167
198
|
{ immediate: !0 }
|
|
168
|
-
), ne(
|
|
169
|
-
if (
|
|
170
|
-
|
|
199
|
+
), ne(v, (a) => {
|
|
200
|
+
if (d.value) {
|
|
201
|
+
s("update:modelValue", a);
|
|
171
202
|
return;
|
|
172
203
|
}
|
|
173
|
-
|
|
204
|
+
q.visible = a, a || _t();
|
|
174
205
|
}), ne(
|
|
175
|
-
() =>
|
|
176
|
-
(
|
|
177
|
-
|
|
206
|
+
() => q.visible,
|
|
207
|
+
(a) => {
|
|
208
|
+
d.value || (v.value = a);
|
|
178
209
|
},
|
|
179
210
|
{ immediate: !0 }
|
|
180
211
|
);
|
|
181
|
-
const y =
|
|
182
|
-
() => (
|
|
183
|
-
),
|
|
184
|
-
() => (
|
|
185
|
-
),
|
|
186
|
-
() => (
|
|
187
|
-
),
|
|
188
|
-
() => (
|
|
189
|
-
),
|
|
190
|
-
() => (
|
|
191
|
-
),
|
|
192
|
-
var
|
|
193
|
-
if ((
|
|
194
|
-
if (!
|
|
195
|
-
return
|
|
196
|
-
}),
|
|
197
|
-
() => (
|
|
198
|
-
), L = b("single"),
|
|
212
|
+
const y = P(
|
|
213
|
+
() => (d.value ? void 0 : q.options.title) ?? o.title ?? "选择图片"
|
|
214
|
+
), r = P(
|
|
215
|
+
() => (d.value ? void 0 : q.options.multiple) ?? o.multiple
|
|
216
|
+
), C = P(
|
|
217
|
+
() => (d.value ? void 0 : q.options.maxCount) ?? o.maxCount
|
|
218
|
+
), V = P(
|
|
219
|
+
() => (d.value ? void 0 : q.options.showModeSwitch) ?? o.showModeSwitch
|
|
220
|
+
), F = P(
|
|
221
|
+
() => (d.value ? void 0 : q.options.showCategories) ?? o.showCategories
|
|
222
|
+
), X = P(() => {
|
|
223
|
+
var a, l;
|
|
224
|
+
if ((a = o.categories) != null && a.length) return o.categories;
|
|
225
|
+
if (!d.value && ((l = q.options.categories) != null && l.length))
|
|
226
|
+
return q.options.categories;
|
|
227
|
+
}), O = P(() => F.value ? X.value ?? ee.value : []), f = P(
|
|
228
|
+
() => (d.value ? void 0 : q.options.confirmOnSelect) ?? o.confirmOnSelect
|
|
229
|
+
), L = b("single"), H = [
|
|
199
230
|
{ label: "单选", value: "single" },
|
|
200
231
|
{ label: "多选", value: "multiple" }
|
|
201
|
-
],
|
|
202
|
-
() =>
|
|
203
|
-
),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
232
|
+
], S = P(
|
|
233
|
+
() => V.value ? L.value === "multiple" : r.value
|
|
234
|
+
), U = b(""), N = b(""), h = b(1), k = b(0), Y = b(!1), j = b(!1), W = b([]), ee = b([]), A = b(/* @__PURE__ */ new Map()), oe = b(/* @__PURE__ */ new Map()), le = b(), te = b(), R = b(!1), z = P(() => [...A.value.values()]), Te = P(() => !!_.value || W.value.length === 0), Ie = P(() => ({
|
|
235
|
+
authState: _.value,
|
|
236
|
+
isEmpty: W.value.length === 0,
|
|
237
|
+
reload: me
|
|
238
|
+
})), Ce = P(() => {
|
|
239
|
+
var l, x;
|
|
240
|
+
const a = z.value.length;
|
|
241
|
+
return f.value ? a ? `已选:${((l = z.value[0]) == null ? void 0 : l.name) || "1 张图片"}` : "单击图片即可完成选择" : a ? S.value ? `已选 ${a} / ${C.value} 张` : `已选:${((x = z.value[0]) == null ? void 0 : x.name) || "1 张图片"}` : S.value ? `多选模式:最多 ${C.value} 张` : "单选模式:请选择一张图片";
|
|
207
242
|
});
|
|
208
|
-
function
|
|
209
|
-
const
|
|
210
|
-
return
|
|
243
|
+
function i(a) {
|
|
244
|
+
const l = z.value.findIndex((x) => J(x) === J(a));
|
|
245
|
+
return l >= 0 ? l + 1 : "";
|
|
211
246
|
}
|
|
212
|
-
function
|
|
213
|
-
if (
|
|
214
|
-
const
|
|
215
|
-
A.value = /* @__PURE__ */ new Map([[
|
|
247
|
+
function p(a) {
|
|
248
|
+
if (a === "single" && z.value.length > 1) {
|
|
249
|
+
const l = z.value[0];
|
|
250
|
+
A.value = /* @__PURE__ */ new Map([[J(l), l]]), Q.info("已切换为单选,仅保留第一张");
|
|
216
251
|
}
|
|
217
252
|
}
|
|
218
|
-
function
|
|
219
|
-
L.value =
|
|
253
|
+
function c() {
|
|
254
|
+
L.value = r.value ? "multiple" : "single";
|
|
220
255
|
}
|
|
221
|
-
function
|
|
256
|
+
function K() {
|
|
222
257
|
A.value = /* @__PURE__ */ new Map();
|
|
223
258
|
}
|
|
224
|
-
function a
|
|
225
|
-
return
|
|
259
|
+
function ue(a) {
|
|
260
|
+
return a[o.urlField];
|
|
226
261
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
262
|
+
function J(a) {
|
|
263
|
+
return a.id ?? a.url;
|
|
229
264
|
}
|
|
230
|
-
function
|
|
231
|
-
return A.value.has(
|
|
265
|
+
function Se(a) {
|
|
266
|
+
return A.value.has(J(a));
|
|
232
267
|
}
|
|
233
|
-
function
|
|
234
|
-
return
|
|
268
|
+
function qe(a, l) {
|
|
269
|
+
return a < l ? "portrait" : a > l ? "landscape" : "square";
|
|
235
270
|
}
|
|
236
|
-
function
|
|
237
|
-
const
|
|
238
|
-
|
|
271
|
+
function He(a, l) {
|
|
272
|
+
const x = J(a);
|
|
273
|
+
oe.value.get(x) !== l && (oe.value.set(x, l), oe.value = new Map(oe.value));
|
|
239
274
|
}
|
|
240
|
-
function
|
|
241
|
-
const
|
|
242
|
-
return
|
|
275
|
+
function $t(a) {
|
|
276
|
+
const l = oe.value.get(J(a));
|
|
277
|
+
return l ? `yc-image-selector__img--${l}` : "";
|
|
243
278
|
}
|
|
244
|
-
function
|
|
245
|
-
const
|
|
246
|
-
!(
|
|
279
|
+
function Lt(a, l) {
|
|
280
|
+
const x = a.target;
|
|
281
|
+
!(x != null && x.naturalWidth) || !(x != null && x.naturalHeight) || He(l, qe(x.naturalWidth, x.naturalHeight));
|
|
247
282
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
283
|
+
function Dt(a) {
|
|
284
|
+
a.width && a.height && He(a, qe(a.width, a.height));
|
|
250
285
|
}
|
|
251
|
-
function
|
|
252
|
-
const
|
|
253
|
-
if (!(
|
|
254
|
-
A.value =
|
|
286
|
+
function Je(a) {
|
|
287
|
+
const l = /* @__PURE__ */ new Map();
|
|
288
|
+
if (!(a != null && a.length)) {
|
|
289
|
+
A.value = l;
|
|
255
290
|
return;
|
|
256
291
|
}
|
|
257
|
-
if (typeof
|
|
258
|
-
for (const
|
|
259
|
-
|
|
292
|
+
if (typeof a[0] == "string")
|
|
293
|
+
for (const ie of a)
|
|
294
|
+
l.set(ie, { id: ie, url: ie, name: ie.split("/").pop() });
|
|
260
295
|
else
|
|
261
|
-
for (const
|
|
262
|
-
|
|
263
|
-
A.value =
|
|
296
|
+
for (const ie of a)
|
|
297
|
+
l.set(J(ie), ie);
|
|
298
|
+
A.value = l;
|
|
264
299
|
}
|
|
265
|
-
function Me(
|
|
266
|
-
|
|
300
|
+
function Me(a) {
|
|
301
|
+
le.value = a.onConfirm, te.value = a.onCancel, Je(a.selected ?? o.selected);
|
|
267
302
|
}
|
|
268
|
-
function
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
Me(
|
|
303
|
+
function Xe(a) {
|
|
304
|
+
if (d.value) return;
|
|
305
|
+
const l = a.detail ?? {};
|
|
306
|
+
Me(l), v.value = !0;
|
|
272
307
|
}
|
|
273
|
-
|
|
274
|
-
globalThis.addEventListener(
|
|
275
|
-
}),
|
|
276
|
-
globalThis.removeEventListener(
|
|
308
|
+
Ke(() => {
|
|
309
|
+
globalThis.addEventListener(Oe, Xe), d.value || (v.value = q.visible);
|
|
310
|
+
}), Ne(() => {
|
|
311
|
+
globalThis.removeEventListener(Oe, Xe);
|
|
277
312
|
});
|
|
278
|
-
async function
|
|
279
|
-
var
|
|
280
|
-
if (!
|
|
281
|
-
|
|
313
|
+
async function Pe() {
|
|
314
|
+
var a;
|
|
315
|
+
if (!o.getImages) {
|
|
316
|
+
Q.error("请通过 props.getImages 传入图片列表请求方法");
|
|
282
317
|
return;
|
|
283
318
|
}
|
|
284
|
-
|
|
319
|
+
Y.value = !0, _.value = null;
|
|
285
320
|
try {
|
|
286
|
-
const
|
|
287
|
-
keyword:
|
|
288
|
-
category:
|
|
289
|
-
page:
|
|
290
|
-
pageSize:
|
|
321
|
+
const l = await o.getImages({
|
|
322
|
+
keyword: U.value.trim() || void 0,
|
|
323
|
+
category: F.value && N.value || void 0,
|
|
324
|
+
page: h.value,
|
|
325
|
+
pageSize: o.pageSize
|
|
291
326
|
});
|
|
292
|
-
|
|
293
|
-
for (const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
} catch (
|
|
297
|
-
|
|
327
|
+
W.value = l.list, k.value = l.total;
|
|
328
|
+
for (const x of l.list)
|
|
329
|
+
Dt(x);
|
|
330
|
+
F.value && !X.value && ((a = l.categories) != null && a.length) && (ee.value = l.categories);
|
|
331
|
+
} catch (l) {
|
|
332
|
+
if (W.value = [], k.value = 0, l instanceof at || (l == null ? void 0 : l.name) === "ImageSelectorAuthError") {
|
|
333
|
+
const x = l;
|
|
334
|
+
_.value = {
|
|
335
|
+
reason: x.reason || "unknown",
|
|
336
|
+
message: x.message
|
|
337
|
+
};
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
Q.error(l instanceof Error ? l.message : "加载图片失败");
|
|
298
341
|
} finally {
|
|
299
|
-
|
|
342
|
+
Y.value = !1;
|
|
300
343
|
}
|
|
301
344
|
}
|
|
302
|
-
function
|
|
303
|
-
|
|
345
|
+
function me() {
|
|
346
|
+
h.value = 1, Pe();
|
|
304
347
|
}
|
|
305
|
-
function
|
|
306
|
-
|
|
348
|
+
function Qe(a) {
|
|
349
|
+
N.value !== a && (N.value = a, me());
|
|
307
350
|
}
|
|
308
|
-
function
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
311
|
-
if (A.value.has(
|
|
312
|
-
A.value.delete(
|
|
351
|
+
function Ze(a) {
|
|
352
|
+
const l = J(a);
|
|
353
|
+
if (S.value) {
|
|
354
|
+
if (A.value.has(l)) {
|
|
355
|
+
A.value.delete(l), A.value = new Map(A.value);
|
|
313
356
|
return;
|
|
314
357
|
}
|
|
315
|
-
if (
|
|
316
|
-
|
|
358
|
+
if (z.value.length >= C.value) {
|
|
359
|
+
Q.warning(`最多选择 ${C.value} 张图片`);
|
|
317
360
|
return;
|
|
318
361
|
}
|
|
319
|
-
A.value.set(
|
|
362
|
+
A.value.set(l, a), A.value = new Map(A.value);
|
|
320
363
|
return;
|
|
321
364
|
}
|
|
322
|
-
if (A.value.has(
|
|
323
|
-
if (
|
|
324
|
-
|
|
365
|
+
if (A.value.has(l)) {
|
|
366
|
+
if (f.value) {
|
|
367
|
+
nt(() => ke());
|
|
325
368
|
return;
|
|
326
369
|
}
|
|
327
370
|
A.value = /* @__PURE__ */ new Map();
|
|
328
371
|
return;
|
|
329
372
|
}
|
|
330
|
-
A.value = /* @__PURE__ */ new Map([[
|
|
373
|
+
A.value = /* @__PURE__ */ new Map([[l, a]]), f.value && nt(() => ke());
|
|
331
374
|
}
|
|
332
|
-
async function
|
|
333
|
-
if (!
|
|
334
|
-
|
|
375
|
+
async function Bt(a) {
|
|
376
|
+
if (!o.upload) {
|
|
377
|
+
Q.error("请通过 props.upload 传入图片上传方法");
|
|
335
378
|
return;
|
|
336
379
|
}
|
|
337
|
-
|
|
380
|
+
j.value = !0;
|
|
338
381
|
try {
|
|
339
|
-
const { resource:
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
else if (A.value = /* @__PURE__ */ new Map([[
|
|
343
|
-
|
|
382
|
+
const { resource: l } = await o.upload(a.file);
|
|
383
|
+
if (Q.success("上传成功"), _.value = null, S.value)
|
|
384
|
+
z.value.length < C.value && (A.value.set(J(l), l), A.value = new Map(A.value));
|
|
385
|
+
else if (A.value = /* @__PURE__ */ new Map([[J(l), l]]), f.value) {
|
|
386
|
+
ke();
|
|
344
387
|
return;
|
|
345
388
|
}
|
|
346
|
-
|
|
347
|
-
} catch (
|
|
348
|
-
|
|
389
|
+
me();
|
|
390
|
+
} catch (l) {
|
|
391
|
+
if (l instanceof at || (l == null ? void 0 : l.name) === "ImageSelectorAuthError") {
|
|
392
|
+
const x = l;
|
|
393
|
+
_.value = {
|
|
394
|
+
reason: x.reason || "unknown",
|
|
395
|
+
message: x.message
|
|
396
|
+
}, W.value = [], k.value = 0;
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
Q.error(l instanceof Error ? l.message : "上传失败");
|
|
349
400
|
} finally {
|
|
350
|
-
|
|
401
|
+
j.value = !1;
|
|
351
402
|
}
|
|
352
403
|
}
|
|
353
|
-
function
|
|
354
|
-
|
|
404
|
+
function Vt() {
|
|
405
|
+
R.value = !1, U.value = "", N.value = "", h.value = 1, ee.value = [], oe.value = /* @__PURE__ */ new Map(), _.value = null, c(), d.value ? Me({}) : Me(q.options), c(), Pe();
|
|
355
406
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
407
|
+
function Ot() {
|
|
408
|
+
j.value = !1;
|
|
358
409
|
}
|
|
359
|
-
function
|
|
360
|
-
var
|
|
361
|
-
|
|
410
|
+
function et() {
|
|
411
|
+
var a;
|
|
412
|
+
R.value || (R.value = !0, (a = te.value) == null || a.call(te), d.value || it(), s("cancel"), v.value = !1);
|
|
362
413
|
}
|
|
363
|
-
function
|
|
364
|
-
var
|
|
365
|
-
if (!
|
|
366
|
-
|
|
414
|
+
function ke() {
|
|
415
|
+
var l;
|
|
416
|
+
if (!z.value.length) {
|
|
417
|
+
Q.warning("请选择图片");
|
|
367
418
|
return;
|
|
368
419
|
}
|
|
369
|
-
if (
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
if (
|
|
373
|
-
|
|
420
|
+
if (R.value) return;
|
|
421
|
+
R.value = !0;
|
|
422
|
+
const a = [...z.value];
|
|
423
|
+
if (d.value) {
|
|
424
|
+
s("confirm", a), v.value = !1;
|
|
374
425
|
return;
|
|
375
426
|
}
|
|
376
|
-
(
|
|
427
|
+
(l = le.value) == null || l.call(le, a), d.value || hn(a), s("confirm", a), v.value = !1;
|
|
377
428
|
}
|
|
378
|
-
return ne(
|
|
379
|
-
var
|
|
380
|
-
|
|
429
|
+
return ne(v, (a, l) => {
|
|
430
|
+
var x;
|
|
431
|
+
l && !a && !R.value && ((x = te.value) == null || x.call(te), d.value || it(), s("cancel"));
|
|
381
432
|
}), ne(
|
|
382
|
-
() =>
|
|
383
|
-
(
|
|
384
|
-
|
|
433
|
+
() => o.selected,
|
|
434
|
+
(a) => {
|
|
435
|
+
v.value || Je(a);
|
|
385
436
|
},
|
|
386
437
|
{ deep: !0 }
|
|
387
|
-
), (
|
|
388
|
-
const
|
|
389
|
-
return
|
|
390
|
-
modelValue:
|
|
391
|
-
"onUpdate:modelValue":
|
|
438
|
+
), (a, l) => {
|
|
439
|
+
const x = B("el-icon"), ie = B("el-input"), Ut = B("el-segmented"), ge = B("el-button"), Ft = B("el-upload"), Rt = B("el-empty"), Kt = B("el-pagination"), Nt = B("el-dialog"), zt = dt("loading");
|
|
440
|
+
return u(), M(Nt, {
|
|
441
|
+
modelValue: v.value,
|
|
442
|
+
"onUpdate:modelValue": l[4] || (l[4] = (I) => v.value = I),
|
|
392
443
|
title: y.value,
|
|
393
444
|
width: e.width,
|
|
394
445
|
"append-to-body": "",
|
|
395
446
|
"destroy-on-close": "",
|
|
396
447
|
class: "yc-image-selector-dialog",
|
|
397
|
-
onClosed:
|
|
398
|
-
onOpen:
|
|
448
|
+
onClosed: Ot,
|
|
449
|
+
onOpen: Vt
|
|
399
450
|
}, {
|
|
400
|
-
footer:
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
451
|
+
footer: g(() => [
|
|
452
|
+
f.value ? (u(), E("div", Nn, [
|
|
453
|
+
T("span", zn, D(Ce.value), 1),
|
|
454
|
+
m(ge, {
|
|
404
455
|
link: "",
|
|
405
456
|
type: "primary",
|
|
406
|
-
onClick:
|
|
457
|
+
onClick: et
|
|
407
458
|
}, {
|
|
408
|
-
default:
|
|
409
|
-
|
|
459
|
+
default: g(() => [
|
|
460
|
+
G(D(e.cancelText), 1)
|
|
410
461
|
]),
|
|
411
462
|
_: 1
|
|
412
463
|
})
|
|
413
|
-
])) : (
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
default:
|
|
418
|
-
|
|
464
|
+
])) : (u(), E("div", Fn, [
|
|
465
|
+
T("span", Rn, D(Ce.value), 1),
|
|
466
|
+
T("div", Kn, [
|
|
467
|
+
m(ge, { onClick: et }, {
|
|
468
|
+
default: g(() => [
|
|
469
|
+
G(D(e.cancelText), 1)
|
|
419
470
|
]),
|
|
420
471
|
_: 1
|
|
421
472
|
}),
|
|
422
|
-
|
|
473
|
+
m(ge, {
|
|
423
474
|
type: "primary",
|
|
424
|
-
disabled: !
|
|
425
|
-
onClick:
|
|
475
|
+
disabled: !z.value.length,
|
|
476
|
+
onClick: ke
|
|
426
477
|
}, {
|
|
427
|
-
default:
|
|
428
|
-
|
|
478
|
+
default: g(() => [
|
|
479
|
+
G(D(e.confirmText), 1)
|
|
429
480
|
]),
|
|
430
481
|
_: 1
|
|
431
482
|
}, 8, ["disabled"])
|
|
432
483
|
])
|
|
433
484
|
]))
|
|
434
485
|
]),
|
|
435
|
-
default:
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
modelValue:
|
|
440
|
-
"onUpdate:modelValue":
|
|
486
|
+
default: g(() => [
|
|
487
|
+
T("div", wn, [
|
|
488
|
+
T("div", Tn, [
|
|
489
|
+
m(ie, {
|
|
490
|
+
modelValue: U.value,
|
|
491
|
+
"onUpdate:modelValue": l[0] || (l[0] = (I) => U.value = I),
|
|
441
492
|
clearable: "",
|
|
442
493
|
placeholder: "搜索图片名称",
|
|
443
494
|
class: "yc-image-selector__search",
|
|
444
|
-
onKeyup:
|
|
445
|
-
onClear:
|
|
495
|
+
onKeyup: Gt(me, ["enter"]),
|
|
496
|
+
onClear: me
|
|
446
497
|
}, {
|
|
447
|
-
prefix:
|
|
448
|
-
|
|
449
|
-
default:
|
|
450
|
-
|
|
498
|
+
prefix: g(() => [
|
|
499
|
+
m(x, null, {
|
|
500
|
+
default: g(() => [
|
|
501
|
+
m(w(Qt))
|
|
451
502
|
]),
|
|
452
503
|
_: 1
|
|
453
504
|
})
|
|
454
505
|
]),
|
|
455
506
|
_: 1
|
|
456
507
|
}, 8, ["modelValue"]),
|
|
457
|
-
|
|
508
|
+
V.value ? (u(), M(Ut, {
|
|
458
509
|
key: 0,
|
|
459
510
|
modelValue: L.value,
|
|
460
|
-
"onUpdate:modelValue":
|
|
461
|
-
options:
|
|
511
|
+
"onUpdate:modelValue": l[1] || (l[1] = (I) => L.value = I),
|
|
512
|
+
options: H,
|
|
462
513
|
class: "yc-image-selector__mode",
|
|
463
|
-
onChange:
|
|
514
|
+
onChange: p
|
|
464
515
|
}, null, 8, ["modelValue"])) : $("", !0),
|
|
465
|
-
e.showUpload && e.upload ? (
|
|
516
|
+
e.showUpload && e.upload ? (u(), M(Ft, {
|
|
466
517
|
key: 1,
|
|
467
518
|
"show-file-list": !1,
|
|
468
519
|
accept: e.accept,
|
|
469
|
-
"http-request":
|
|
470
|
-
disabled:
|
|
520
|
+
"http-request": Bt,
|
|
521
|
+
disabled: j.value
|
|
471
522
|
}, {
|
|
472
|
-
default:
|
|
473
|
-
|
|
523
|
+
default: g(() => [
|
|
524
|
+
m(ge, {
|
|
474
525
|
type: "primary",
|
|
475
526
|
plain: "",
|
|
476
|
-
loading:
|
|
527
|
+
loading: j.value
|
|
477
528
|
}, {
|
|
478
|
-
default:
|
|
479
|
-
|
|
480
|
-
default:
|
|
481
|
-
|
|
529
|
+
default: g(() => [
|
|
530
|
+
m(x, { class: "m-r-4" }, {
|
|
531
|
+
default: g(() => [
|
|
532
|
+
m(w(Zt))
|
|
482
533
|
]),
|
|
483
534
|
_: 1
|
|
484
535
|
}),
|
|
485
|
-
|
|
536
|
+
l[5] || (l[5] = G(" 上传图片 ", -1))
|
|
486
537
|
]),
|
|
487
538
|
_: 1
|
|
488
539
|
}, 8, ["loading"])
|
|
@@ -490,125 +541,134 @@ const fn = { class: "yc-image-selector" }, pn = { class: "yc-image-selector__too
|
|
|
490
541
|
_: 1
|
|
491
542
|
}, 8, ["accept", "disabled"])) : $("", !0)
|
|
492
543
|
]),
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
class:
|
|
497
|
-
onClick:
|
|
498
|
-
},
|
|
499
|
-
(
|
|
500
|
-
key:
|
|
501
|
-
class:
|
|
502
|
-
onClick: (
|
|
544
|
+
T("div", In, [
|
|
545
|
+
F.value ? (u(), E("aside", Cn, [
|
|
546
|
+
T("div", {
|
|
547
|
+
class: fe(["yc-image-selector__category", { "is-active": N.value === "" }]),
|
|
548
|
+
onClick: l[2] || (l[2] = (I) => Qe(""))
|
|
549
|
+
}, D(e.categoryAllLabel), 3),
|
|
550
|
+
(u(!0), E(re, null, he(O.value, (I) => (u(), E("div", {
|
|
551
|
+
key: I.id,
|
|
552
|
+
class: fe(["yc-image-selector__category", { "is-active": N.value === I.id }]),
|
|
553
|
+
onClick: (xe) => Qe(I.id)
|
|
503
554
|
}, [
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
], 10,
|
|
555
|
+
T("span", null, D(I.name), 1),
|
|
556
|
+
I.count != null ? (u(), E("span", kn, D(I.count), 1)) : $("", !0)
|
|
557
|
+
], 10, Sn))), 128))
|
|
507
558
|
])) : $("", !0),
|
|
508
|
-
_e((
|
|
509
|
-
!
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
559
|
+
_e((u(), E("div", xn, [
|
|
560
|
+
!Y.value && Te.value ? ye(a.$slots, "empty", ft(ze({ key: 0 }, Ie.value)), () => {
|
|
561
|
+
var I;
|
|
562
|
+
return [
|
|
563
|
+
o.renderEmpty ? (u(), M(w(t), {
|
|
564
|
+
key: 0,
|
|
565
|
+
render: o.renderEmpty,
|
|
566
|
+
ctx: Ie.value
|
|
567
|
+
}, null, 8, ["render", "ctx"])) : (u(), M(Rt, {
|
|
568
|
+
key: 1,
|
|
569
|
+
description: ((I = _.value) == null ? void 0 : I.message) || e.emptyText
|
|
570
|
+
}, null, 8, ["description"]))
|
|
571
|
+
];
|
|
572
|
+
}, !0) : Te.value ? $("", !0) : (u(), E("div", bn, [
|
|
573
|
+
(u(!0), E(re, null, he(W.value, (I) => (u(), E("div", {
|
|
574
|
+
key: String(I.id),
|
|
575
|
+
class: fe(["yc-image-selector__item", {
|
|
576
|
+
"is-selected": Se(I),
|
|
577
|
+
"is-single-mode": !S.value,
|
|
578
|
+
"is-multi-mode": S.value
|
|
519
579
|
}]),
|
|
520
|
-
onClick: (
|
|
580
|
+
onClick: (xe) => Ze(I)
|
|
521
581
|
}, [
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
src:
|
|
525
|
-
alt:
|
|
582
|
+
T("div", En, [
|
|
583
|
+
T("img", {
|
|
584
|
+
src: ue(I),
|
|
585
|
+
alt: I.name || "image",
|
|
526
586
|
loading: "lazy",
|
|
527
|
-
class:
|
|
528
|
-
onLoad: (
|
|
529
|
-
}, null, 42,
|
|
530
|
-
|
|
531
|
-
class:
|
|
532
|
-
"is-checked":
|
|
533
|
-
"is-radio": !
|
|
534
|
-
"is-checkbox":
|
|
587
|
+
class: fe($t(I)),
|
|
588
|
+
onLoad: (xe) => Lt(xe, I)
|
|
589
|
+
}, null, 42, Mn),
|
|
590
|
+
T("div", {
|
|
591
|
+
class: fe(["yc-image-selector__indicator", {
|
|
592
|
+
"is-checked": Se(I),
|
|
593
|
+
"is-radio": !S.value,
|
|
594
|
+
"is-checkbox": S.value
|
|
535
595
|
}])
|
|
536
596
|
}, [
|
|
537
|
-
|
|
538
|
-
default:
|
|
539
|
-
|
|
597
|
+
Se(I) && S.value ? (u(), E("span", Pn, D(i(I)), 1)) : Se(I) ? (u(), M(x, { key: 1 }, {
|
|
598
|
+
default: g(() => [
|
|
599
|
+
m(w(mt))
|
|
540
600
|
]),
|
|
541
601
|
_: 1
|
|
542
602
|
})) : $("", !0)
|
|
543
603
|
], 2)
|
|
544
604
|
]),
|
|
545
|
-
|
|
605
|
+
T("div", {
|
|
546
606
|
class: "yc-image-selector__meta",
|
|
547
|
-
title:
|
|
548
|
-
},
|
|
549
|
-
], 10,
|
|
607
|
+
title: I.name
|
|
608
|
+
}, D(I.name || "未命名"), 9, $n)
|
|
609
|
+
], 10, An))), 128))
|
|
550
610
|
]))
|
|
551
611
|
])), [
|
|
552
|
-
[
|
|
612
|
+
[zt, Y.value]
|
|
553
613
|
])
|
|
554
614
|
]),
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
(
|
|
559
|
-
key: String(
|
|
615
|
+
S.value && z.value.length ? (u(), E("div", Ln, [
|
|
616
|
+
T("span", Dn, "已选 " + D(z.value.length) + " 张", 1),
|
|
617
|
+
T("div", Bn, [
|
|
618
|
+
(u(!0), E(re, null, he(z.value, (I) => (u(), E("div", {
|
|
619
|
+
key: String(I.id),
|
|
560
620
|
class: "yc-image-selector__selected-chip",
|
|
561
|
-
onClick:
|
|
621
|
+
onClick: Wt((xe) => Ze(I), ["stop"])
|
|
562
622
|
}, [
|
|
563
|
-
|
|
564
|
-
src:
|
|
565
|
-
alt:
|
|
566
|
-
}, null, 8,
|
|
567
|
-
|
|
568
|
-
], 8,
|
|
623
|
+
T("img", {
|
|
624
|
+
src: ue(I),
|
|
625
|
+
alt: I.name
|
|
626
|
+
}, null, 8, On),
|
|
627
|
+
l[6] || (l[6] = T("span", { class: "yc-image-selector__selected-chip-remove" }, "×", -1))
|
|
628
|
+
], 8, Vn))), 128))
|
|
569
629
|
]),
|
|
570
|
-
|
|
630
|
+
m(ge, {
|
|
571
631
|
link: "",
|
|
572
632
|
type: "primary",
|
|
573
|
-
onClick:
|
|
633
|
+
onClick: K
|
|
574
634
|
}, {
|
|
575
|
-
default:
|
|
576
|
-
|
|
635
|
+
default: g(() => [...l[7] || (l[7] = [
|
|
636
|
+
G("清空", -1)
|
|
577
637
|
])]),
|
|
578
638
|
_: 1
|
|
579
639
|
})
|
|
580
640
|
])) : $("", !0),
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
"current-page":
|
|
584
|
-
"onUpdate:currentPage":
|
|
641
|
+
k.value > 0 ? (u(), E("div", Un, [
|
|
642
|
+
m(Kt, {
|
|
643
|
+
"current-page": h.value,
|
|
644
|
+
"onUpdate:currentPage": l[3] || (l[3] = (I) => h.value = I),
|
|
585
645
|
background: "",
|
|
586
646
|
layout: "total, prev, pager, next, jumper",
|
|
587
647
|
"page-size": e.pageSize,
|
|
588
|
-
total:
|
|
589
|
-
onCurrentChange:
|
|
648
|
+
total: k.value,
|
|
649
|
+
onCurrentChange: Pe
|
|
590
650
|
}, null, 8, ["current-page", "page-size", "total"])
|
|
591
651
|
])) : $("", !0)
|
|
592
652
|
])
|
|
593
653
|
]),
|
|
594
|
-
_:
|
|
654
|
+
_: 3
|
|
595
655
|
}, 8, ["modelValue", "title", "width"]);
|
|
596
656
|
};
|
|
597
657
|
}
|
|
598
|
-
}),
|
|
658
|
+
}), Ee = (e, n) => {
|
|
599
659
|
const t = e.__vccOpts || e;
|
|
600
|
-
for (const [o,
|
|
601
|
-
t[o] =
|
|
660
|
+
for (const [o, s] of n)
|
|
661
|
+
t[o] = s;
|
|
602
662
|
return t;
|
|
603
|
-
},
|
|
604
|
-
function
|
|
605
|
-
const { baseURL: e = "" } =
|
|
606
|
-
return
|
|
663
|
+
}, Tt = /* @__PURE__ */ Ee(Yn, [["__scopeId", "data-v-30690802"]]);
|
|
664
|
+
function It() {
|
|
665
|
+
const { baseURL: e = "" } = Ae();
|
|
666
|
+
return ut.create({ baseURL: e, timeout: 3e4 });
|
|
607
667
|
}
|
|
608
|
-
async function
|
|
609
|
-
const n =
|
|
668
|
+
async function jn(e) {
|
|
669
|
+
const n = Ae().fetchImages;
|
|
610
670
|
if (n) return n(e);
|
|
611
|
-
const t =
|
|
671
|
+
const t = It(), { data: o } = await t.get(
|
|
612
672
|
"/yc-media/images",
|
|
613
673
|
{ params: e }
|
|
614
674
|
);
|
|
@@ -616,44 +676,44 @@ async function On(e) {
|
|
|
616
676
|
throw new Error("加载图片资源失败");
|
|
617
677
|
return o.data;
|
|
618
678
|
}
|
|
619
|
-
async function
|
|
620
|
-
const n =
|
|
679
|
+
async function Gn(e) {
|
|
680
|
+
const n = Ae().uploadImage;
|
|
621
681
|
if (n) return n(e);
|
|
622
|
-
const t =
|
|
682
|
+
const t = It(), o = new FormData();
|
|
623
683
|
o.append("file", e);
|
|
624
|
-
const { data:
|
|
684
|
+
const { data: s } = await t.post(
|
|
625
685
|
"/yc-media/images/upload",
|
|
626
686
|
o,
|
|
627
687
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
628
688
|
);
|
|
629
|
-
if (
|
|
689
|
+
if (s.code !== 200)
|
|
630
690
|
throw new Error("上传图片失败");
|
|
631
|
-
return
|
|
691
|
+
return s.data;
|
|
632
692
|
}
|
|
633
|
-
const
|
|
634
|
-
function
|
|
693
|
+
const st = "__YC_IMAGE_SELECTOR_MOUNT__";
|
|
694
|
+
function Wn(e) {
|
|
635
695
|
const n = globalThis;
|
|
636
|
-
if (n[
|
|
696
|
+
if (n[st] || typeof document > "u") return;
|
|
637
697
|
const t = document.createElement("div");
|
|
638
698
|
t.setAttribute("data-yc-image-selector-host", ""), document.body.appendChild(t);
|
|
639
|
-
const o =
|
|
640
|
-
getImages:
|
|
641
|
-
upload:
|
|
699
|
+
const o = Ae().dialog ?? {}, s = m(Tt, {
|
|
700
|
+
getImages: jn,
|
|
701
|
+
upload: Gn,
|
|
642
702
|
showUpload: o.showUpload ?? !0,
|
|
643
703
|
...o
|
|
644
704
|
});
|
|
645
|
-
|
|
705
|
+
s.appContext = e._context, qt(s, t), n[st] = !0;
|
|
646
706
|
}
|
|
647
|
-
function
|
|
648
|
-
e.config.globalProperties.openImageSelector =
|
|
707
|
+
function qn(e) {
|
|
708
|
+
e.config.globalProperties.openImageSelector = wt, e.config.globalProperties.closeImageSelector = yt;
|
|
649
709
|
}
|
|
650
|
-
function
|
|
651
|
-
|
|
710
|
+
function Hn(e) {
|
|
711
|
+
Wn(e), qn(e);
|
|
652
712
|
}
|
|
653
|
-
const
|
|
713
|
+
const Jn = { class: "yc-page-window__header" }, Xn = { class: "yc-page-window__title" }, Qn = {
|
|
654
714
|
key: 0,
|
|
655
715
|
class: "yc-page-window__nav"
|
|
656
|
-
},
|
|
716
|
+
}, Zn = { class: "yc-page-window__opera" }, eo = { class: "yc-page-window__content" }, to = /* @__PURE__ */ de({
|
|
657
717
|
__name: "YcPageWindow",
|
|
658
718
|
props: {
|
|
659
719
|
visible: { type: Boolean },
|
|
@@ -673,90 +733,90 @@ const Nn = { class: "yc-page-window__header" }, zn = { class: "yc-page-window__t
|
|
|
673
733
|
},
|
|
674
734
|
emits: ["update:visible", "update:type", "confirm", "close", "opened", "changeType", "prev", "next", "checkRow"],
|
|
675
735
|
setup(e, { expose: n, emit: t }) {
|
|
676
|
-
const o = e,
|
|
736
|
+
const o = e, s = t, d = b(!1), v = P(() => o.loading || d.value), _ = P(() => o.type === "detail" ? "详情" : o.type === "edit" ? "编辑" : o.type === "add" ? "新增" : ""), y = P(
|
|
677
737
|
() => o.list.length > 0 && o.row != null
|
|
678
|
-
), r =
|
|
738
|
+
), r = P(
|
|
679
739
|
() => ["detail", "edit"].includes(o.type)
|
|
680
|
-
),
|
|
681
|
-
function
|
|
740
|
+
), C = P(() => o.type !== "detail");
|
|
741
|
+
function V() {
|
|
682
742
|
if (!o.row) return -1;
|
|
683
|
-
const
|
|
684
|
-
return o.list.findIndex((
|
|
743
|
+
const S = o.rowKey, U = o.row[S];
|
|
744
|
+
return o.list.findIndex((N) => N[S] === U);
|
|
685
745
|
}
|
|
686
|
-
function
|
|
687
|
-
const
|
|
688
|
-
return
|
|
746
|
+
function F(S) {
|
|
747
|
+
const U = V();
|
|
748
|
+
return U < 0 ? !0 : S === "prev" ? U <= 0 : U >= o.list.length - 1;
|
|
689
749
|
}
|
|
690
|
-
function
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
const
|
|
694
|
-
|
|
750
|
+
function X() {
|
|
751
|
+
const S = V();
|
|
752
|
+
if (S <= 0) return;
|
|
753
|
+
const U = o.list[S - 1];
|
|
754
|
+
s("checkRow", U), s("prev", U);
|
|
695
755
|
}
|
|
696
|
-
function
|
|
697
|
-
const
|
|
698
|
-
if (
|
|
699
|
-
const
|
|
700
|
-
|
|
756
|
+
function O() {
|
|
757
|
+
const S = V();
|
|
758
|
+
if (S < 0 || S >= o.list.length - 1) return;
|
|
759
|
+
const U = o.list[S + 1];
|
|
760
|
+
s("checkRow", U), s("next", U);
|
|
701
761
|
}
|
|
702
|
-
function
|
|
703
|
-
const
|
|
704
|
-
|
|
762
|
+
function f() {
|
|
763
|
+
const S = o.type === "detail" ? "edit" : "detail";
|
|
764
|
+
s("update:type", S), s("changeType");
|
|
705
765
|
}
|
|
706
|
-
function
|
|
707
|
-
|
|
766
|
+
function L() {
|
|
767
|
+
s("update:visible", !1), s("close");
|
|
708
768
|
}
|
|
709
|
-
function
|
|
710
|
-
|
|
711
|
-
|
|
769
|
+
function H() {
|
|
770
|
+
d.value = !0, s("confirm", (S) => {
|
|
771
|
+
d.value = !1, S && L();
|
|
712
772
|
});
|
|
713
773
|
}
|
|
714
774
|
return ne(
|
|
715
775
|
() => o.visible,
|
|
716
|
-
(
|
|
717
|
-
|
|
776
|
+
(S) => {
|
|
777
|
+
S && s("opened");
|
|
718
778
|
}
|
|
719
|
-
),
|
|
720
|
-
o.visible &&
|
|
721
|
-
}), n({ closeWindow:
|
|
722
|
-
const
|
|
723
|
-
return
|
|
779
|
+
), Ht(() => {
|
|
780
|
+
o.visible && L();
|
|
781
|
+
}), n({ closeWindow: L }), (S, U) => {
|
|
782
|
+
const N = B("el-icon"), h = B("el-button"), k = B("el-tooltip"), Y = B("el-scrollbar"), j = dt("loading");
|
|
783
|
+
return u(), M(pt, {
|
|
724
784
|
name: "yc-page-window-fade",
|
|
725
785
|
mode: "out-in"
|
|
726
786
|
}, {
|
|
727
|
-
default:
|
|
728
|
-
_e(
|
|
787
|
+
default: g(() => [
|
|
788
|
+
_e(T("div", {
|
|
729
789
|
class: "yc-page-window",
|
|
730
|
-
style:
|
|
790
|
+
style: ot({ zIndex: e.zIndex })
|
|
731
791
|
}, [
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
792
|
+
T("div", Jn, [
|
|
793
|
+
T("div", Xn, [
|
|
794
|
+
m(N, {
|
|
735
795
|
class: "yc-page-window__back",
|
|
736
|
-
onClick:
|
|
796
|
+
onClick: L
|
|
737
797
|
}, {
|
|
738
|
-
default:
|
|
739
|
-
|
|
798
|
+
default: g(() => [
|
|
799
|
+
m(w(en))
|
|
740
800
|
]),
|
|
741
801
|
_: 1
|
|
742
802
|
}),
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
803
|
+
T("span", null, D(e.title) + D(_.value), 1),
|
|
804
|
+
y.value ? (u(), E("div", Qn, [
|
|
805
|
+
m(k, {
|
|
746
806
|
content: "上一条",
|
|
747
807
|
placement: "top"
|
|
748
808
|
}, {
|
|
749
|
-
default:
|
|
750
|
-
|
|
809
|
+
default: g(() => [
|
|
810
|
+
m(h, {
|
|
751
811
|
round: "",
|
|
752
812
|
text: "",
|
|
753
|
-
disabled:
|
|
754
|
-
onClick:
|
|
813
|
+
disabled: F("prev"),
|
|
814
|
+
onClick: X
|
|
755
815
|
}, {
|
|
756
|
-
default:
|
|
757
|
-
|
|
758
|
-
default:
|
|
759
|
-
|
|
816
|
+
default: g(() => [
|
|
817
|
+
m(N, null, {
|
|
818
|
+
default: g(() => [
|
|
819
|
+
m(w(tn))
|
|
760
820
|
]),
|
|
761
821
|
_: 1
|
|
762
822
|
})
|
|
@@ -766,21 +826,21 @@ const Nn = { class: "yc-page-window__header" }, zn = { class: "yc-page-window__t
|
|
|
766
826
|
]),
|
|
767
827
|
_: 1
|
|
768
828
|
}),
|
|
769
|
-
|
|
829
|
+
m(k, {
|
|
770
830
|
content: "下一条",
|
|
771
831
|
placement: "top"
|
|
772
832
|
}, {
|
|
773
|
-
default:
|
|
774
|
-
|
|
833
|
+
default: g(() => [
|
|
834
|
+
m(h, {
|
|
775
835
|
round: "",
|
|
776
836
|
text: "",
|
|
777
|
-
disabled:
|
|
778
|
-
onClick:
|
|
837
|
+
disabled: F("next"),
|
|
838
|
+
onClick: O
|
|
779
839
|
}, {
|
|
780
|
-
default:
|
|
781
|
-
|
|
782
|
-
default:
|
|
783
|
-
|
|
840
|
+
default: g(() => [
|
|
841
|
+
m(N, null, {
|
|
842
|
+
default: g(() => [
|
|
843
|
+
m(w(nn))
|
|
784
844
|
]),
|
|
785
845
|
_: 1
|
|
786
846
|
})
|
|
@@ -791,145 +851,145 @@ const Nn = { class: "yc-page-window__header" }, zn = { class: "yc-page-window__t
|
|
|
791
851
|
_: 1
|
|
792
852
|
})
|
|
793
853
|
])) : $("", !0),
|
|
794
|
-
r.value ? (
|
|
854
|
+
r.value ? (u(), M(h, {
|
|
795
855
|
key: 1,
|
|
796
856
|
text: "",
|
|
797
857
|
class: "yc-page-window__type-switch",
|
|
798
858
|
type: e.type === "detail" ? "primary" : "success",
|
|
799
|
-
onClick:
|
|
859
|
+
onClick: f
|
|
800
860
|
}, {
|
|
801
|
-
default:
|
|
802
|
-
|
|
803
|
-
default:
|
|
804
|
-
|
|
861
|
+
default: g(() => [
|
|
862
|
+
m(N, { class: "m-r-4" }, {
|
|
863
|
+
default: g(() => [
|
|
864
|
+
m(w(on))
|
|
805
865
|
]),
|
|
806
866
|
_: 1
|
|
807
867
|
}),
|
|
808
|
-
|
|
868
|
+
G(" " + D(e.type === "detail" ? "切换编辑" : "切换详情"), 1)
|
|
809
869
|
]),
|
|
810
870
|
_: 1
|
|
811
871
|
}, 8, ["type"])) : $("", !0)
|
|
812
872
|
]),
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
e.showButtons &&
|
|
816
|
-
|
|
873
|
+
T("div", Zn, [
|
|
874
|
+
ye(S.$slots, "opera", {}, void 0, !0),
|
|
875
|
+
e.showButtons && C.value ? (u(), E(re, { key: 0 }, [
|
|
876
|
+
m(h, {
|
|
817
877
|
text: "",
|
|
818
|
-
disabled:
|
|
819
|
-
onClick:
|
|
878
|
+
disabled: v.value,
|
|
879
|
+
onClick: L
|
|
820
880
|
}, {
|
|
821
|
-
default:
|
|
822
|
-
|
|
823
|
-
default:
|
|
824
|
-
|
|
881
|
+
default: g(() => [
|
|
882
|
+
m(N, { class: "m-r-4" }, {
|
|
883
|
+
default: g(() => [
|
|
884
|
+
m(w(gt))
|
|
825
885
|
]),
|
|
826
886
|
_: 1
|
|
827
887
|
}),
|
|
828
|
-
|
|
888
|
+
G(" " + D(e.cancelText), 1)
|
|
829
889
|
]),
|
|
830
890
|
_: 1
|
|
831
891
|
}, 8, ["disabled"]),
|
|
832
|
-
e.showConfirm ? (
|
|
892
|
+
e.showConfirm ? (u(), M(h, {
|
|
833
893
|
key: 0,
|
|
834
894
|
type: "primary",
|
|
835
|
-
loading:
|
|
895
|
+
loading: v.value,
|
|
836
896
|
disabled: e.disabled,
|
|
837
|
-
onClick:
|
|
897
|
+
onClick: H
|
|
838
898
|
}, {
|
|
839
|
-
default:
|
|
840
|
-
|
|
841
|
-
default:
|
|
842
|
-
|
|
899
|
+
default: g(() => [
|
|
900
|
+
m(N, { class: "m-r-4" }, {
|
|
901
|
+
default: g(() => [
|
|
902
|
+
m(w(mt))
|
|
843
903
|
]),
|
|
844
904
|
_: 1
|
|
845
905
|
}),
|
|
846
|
-
|
|
906
|
+
G(" " + D(e.confirmText), 1)
|
|
847
907
|
]),
|
|
848
908
|
_: 1
|
|
849
909
|
}, 8, ["loading", "disabled"])) : $("", !0)
|
|
850
910
|
], 64)) : $("", !0)
|
|
851
911
|
])
|
|
852
912
|
]),
|
|
853
|
-
_e((
|
|
854
|
-
|
|
855
|
-
default:
|
|
856
|
-
e.visible ? (
|
|
913
|
+
_e((u(), E("div", eo, [
|
|
914
|
+
m(Y, { class: "yc-page-window__scroll" }, {
|
|
915
|
+
default: g(() => [
|
|
916
|
+
e.visible ? (u(), E("div", {
|
|
857
917
|
key: 0,
|
|
858
918
|
class: "yc-page-window__body",
|
|
859
|
-
style:
|
|
919
|
+
style: ot({ minHeight: e.contentMinHeight })
|
|
860
920
|
}, [
|
|
861
|
-
|
|
921
|
+
ye(S.$slots, "default", {}, void 0, !0)
|
|
862
922
|
], 4)) : $("", !0)
|
|
863
923
|
]),
|
|
864
924
|
_: 3
|
|
865
925
|
})
|
|
866
926
|
])), [
|
|
867
|
-
[
|
|
927
|
+
[j, v.value]
|
|
868
928
|
])
|
|
869
929
|
], 4), [
|
|
870
|
-
[
|
|
930
|
+
[De, e.visible]
|
|
871
931
|
])
|
|
872
932
|
]),
|
|
873
933
|
_: 3
|
|
874
934
|
});
|
|
875
935
|
};
|
|
876
936
|
}
|
|
877
|
-
}),
|
|
878
|
-
function
|
|
879
|
-
e != null && e.aiTask && (
|
|
937
|
+
}), rt = /* @__PURE__ */ Ee(to, [["__scopeId", "data-v-b3e784c3"]]);
|
|
938
|
+
function no(e) {
|
|
939
|
+
e != null && e.aiTask && (dn(e.aiTask), pn()), e != null && e.imageSelector && gn(e.imageSelector);
|
|
880
940
|
}
|
|
881
|
-
function
|
|
882
|
-
(n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow",
|
|
941
|
+
function oo(e, n) {
|
|
942
|
+
(n == null ? void 0 : n.registerPageWindow) !== !1 && (e.component("YcPageWindow", rt), e.component("SkyPageWindow", rt));
|
|
883
943
|
}
|
|
884
|
-
function
|
|
885
|
-
(n == null ? void 0 : n.registerImageSelector) !== !1 &&
|
|
944
|
+
function lo(e, n) {
|
|
945
|
+
(n == null ? void 0 : n.registerImageSelector) !== !1 && Hn(e);
|
|
886
946
|
}
|
|
887
|
-
const
|
|
947
|
+
const ll = {
|
|
888
948
|
install(e, n) {
|
|
889
|
-
|
|
949
|
+
no(n), oo(e, n), lo(e, n);
|
|
890
950
|
}
|
|
891
|
-
},
|
|
892
|
-
function
|
|
951
|
+
}, Le = "__YC_COMPONENT_AI_DIALOG__", Ue = "yc-component:ai-dialog-open";
|
|
952
|
+
function ao() {
|
|
893
953
|
const e = globalThis;
|
|
894
|
-
return e[
|
|
954
|
+
return e[Le] || (e[Le] = ct({
|
|
895
955
|
visible: !1,
|
|
896
956
|
options: {}
|
|
897
|
-
})), e[
|
|
957
|
+
})), e[Le];
|
|
898
958
|
}
|
|
899
|
-
const
|
|
900
|
-
function
|
|
901
|
-
|
|
902
|
-
new CustomEvent(
|
|
959
|
+
const ae = ao();
|
|
960
|
+
function Ge(e = {}) {
|
|
961
|
+
ae.options = { ...e }, ae.visible = !0, globalThis.dispatchEvent(
|
|
962
|
+
new CustomEvent(Ue, { detail: { ...e } })
|
|
903
963
|
);
|
|
904
964
|
}
|
|
905
|
-
function
|
|
906
|
-
|
|
965
|
+
function Ct() {
|
|
966
|
+
ae.visible = !1;
|
|
907
967
|
}
|
|
908
|
-
function
|
|
909
|
-
|
|
968
|
+
function al(e = {}) {
|
|
969
|
+
Ge(e);
|
|
910
970
|
}
|
|
911
|
-
function
|
|
971
|
+
function St(e) {
|
|
912
972
|
const {
|
|
913
973
|
tasks: n,
|
|
914
974
|
panelVisible: t,
|
|
915
975
|
panelMinimized: o,
|
|
916
|
-
dialogVisible:
|
|
917
|
-
runningCount:
|
|
918
|
-
activeCount:
|
|
919
|
-
panelTitle:
|
|
920
|
-
panelSubtitle:
|
|
921
|
-
} =
|
|
976
|
+
dialogVisible: s,
|
|
977
|
+
runningCount: d,
|
|
978
|
+
activeCount: v,
|
|
979
|
+
panelTitle: _,
|
|
980
|
+
panelSubtitle: y
|
|
981
|
+
} = un(e);
|
|
922
982
|
return {
|
|
923
983
|
tasks: n,
|
|
924
984
|
panelVisible: t,
|
|
925
985
|
panelMinimized: o,
|
|
926
|
-
dialogVisible:
|
|
927
|
-
runningCount:
|
|
928
|
-
activeCount:
|
|
929
|
-
panelTitle:
|
|
930
|
-
panelSubtitle:
|
|
986
|
+
dialogVisible: s,
|
|
987
|
+
runningCount: d,
|
|
988
|
+
activeCount: v,
|
|
989
|
+
panelTitle: _,
|
|
990
|
+
panelSubtitle: y,
|
|
931
991
|
openUseDialog: (r) => {
|
|
932
|
-
|
|
992
|
+
Ge(r ?? {}), e.openDialog(r ?? {});
|
|
933
993
|
},
|
|
934
994
|
closeUseDialog: () => e.closeDialog(),
|
|
935
995
|
openTaskPanel: () => e.showPanel(),
|
|
@@ -945,19 +1005,19 @@ function ht(e) {
|
|
|
945
1005
|
onTaskFinish: (r) => e.onTaskFinish(r)
|
|
946
1006
|
};
|
|
947
1007
|
}
|
|
948
|
-
const
|
|
949
|
-
function
|
|
1008
|
+
const io = "__YC_AI_TASK_CTX_KEY__", so = "__YC_AI_TASK_STORE_KEY__";
|
|
1009
|
+
function kt(e) {
|
|
950
1010
|
const n = globalThis;
|
|
951
1011
|
return n[e] || (n[e] = Symbol(e)), n[e];
|
|
952
1012
|
}
|
|
953
|
-
const
|
|
1013
|
+
const xt = kt(io), bt = kt(so), ro = async (e) => (await pe().post(
|
|
954
1014
|
"/yc-ai/workflows/runs",
|
|
955
1015
|
e
|
|
956
|
-
)).data,
|
|
957
|
-
async function
|
|
958
|
-
return
|
|
1016
|
+
)).data, At = async (e) => (await pe().get(`/yc-ai/workflows/runs/${e}`)).data, uo = (e) => pe().post(`/yc-ai/workflows/runs/${e}/cancel`), co = (e, n) => pe().post(`/yc-ai/workflows/runs/${e}/client-continue`, n);
|
|
1017
|
+
async function Fe(e, n) {
|
|
1018
|
+
return mn(e, n);
|
|
959
1019
|
}
|
|
960
|
-
function
|
|
1020
|
+
function fo(e, n) {
|
|
961
1021
|
const t = e.trim();
|
|
962
1022
|
if (!t)
|
|
963
1023
|
return n;
|
|
@@ -971,79 +1031,79 @@ function oo(e, n) {
|
|
|
971
1031
|
throw new Error('请定义 function handler(result) { ... }');
|
|
972
1032
|
`
|
|
973
1033
|
) : o = new Function("result", `return (${t})(result);`);
|
|
974
|
-
} catch (
|
|
975
|
-
throw new Error(`自定义脚本语法错误: ${
|
|
1034
|
+
} catch (s) {
|
|
1035
|
+
throw new Error(`自定义脚本语法错误: ${s instanceof Error ? s.message : String(s)}`);
|
|
976
1036
|
}
|
|
977
1037
|
try {
|
|
978
1038
|
return o(n);
|
|
979
|
-
} catch (
|
|
980
|
-
throw new Error(`自定义脚本执行失败: ${
|
|
1039
|
+
} catch (s) {
|
|
1040
|
+
throw new Error(`自定义脚本执行失败: ${s instanceof Error ? s.message : String(s)}`);
|
|
981
1041
|
}
|
|
982
1042
|
}
|
|
983
|
-
async function
|
|
984
|
-
return (await
|
|
985
|
-
projectId:
|
|
1043
|
+
async function po(e) {
|
|
1044
|
+
return (await ro({
|
|
1045
|
+
projectId: fn(),
|
|
986
1046
|
freeText: e.freeText,
|
|
987
1047
|
promptId: e.promptId,
|
|
988
1048
|
autoMatch: e.autoMatch
|
|
989
1049
|
})).runId;
|
|
990
1050
|
}
|
|
991
|
-
async function
|
|
992
|
-
var o,
|
|
993
|
-
const t = await
|
|
1051
|
+
async function mo(e, n) {
|
|
1052
|
+
var o, s, d, v;
|
|
1053
|
+
const t = await At(e);
|
|
994
1054
|
if (t.status === "WAITING_CLIENT" && t.waitingStepKey && t.waitingClientScript) {
|
|
995
1055
|
(o = n == null ? void 0 : n.onProgress) == null || o.call(n, 60, `执行脚本:${t.waitingStepKey}`);
|
|
996
|
-
let
|
|
997
|
-
t.waitingArtifactId && (
|
|
998
|
-
const
|
|
999
|
-
return await
|
|
1056
|
+
let _ = {};
|
|
1057
|
+
t.waitingArtifactId && (_ = await Fe(e, t.waitingArtifactId));
|
|
1058
|
+
const y = fo(t.waitingClientScript, _);
|
|
1059
|
+
return await co(e, {
|
|
1000
1060
|
stepKey: t.waitingStepKey,
|
|
1001
|
-
output:
|
|
1061
|
+
output: y ?? {}
|
|
1002
1062
|
}), null;
|
|
1003
1063
|
}
|
|
1004
1064
|
if (t.status === "SUCCEEDED") {
|
|
1005
1065
|
if (t.finalArtifactId) {
|
|
1006
|
-
(
|
|
1007
|
-
const
|
|
1008
|
-
return (
|
|
1066
|
+
(s = n == null ? void 0 : n.onProgress) == null || s.call(n, 95, "加载结果…");
|
|
1067
|
+
const _ = await Fe(e, t.finalArtifactId);
|
|
1068
|
+
return (d = n == null ? void 0 : n.onProgress) == null || d.call(n, 100, "已完成"), { phase: "SUCCEEDED", runId: e, result: _ };
|
|
1009
1069
|
}
|
|
1010
1070
|
return { phase: "SUCCEEDED", runId: e, result: {} };
|
|
1011
1071
|
}
|
|
1012
|
-
return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((
|
|
1072
|
+
return t.status === "FAILED" ? { phase: "FAILED", runId: e, errorMessage: t.errorMessage || "工作流失败" } : t.status === "CANCELLED" ? { phase: "FAILED", runId: e, errorMessage: "已取消" } : ((v = n == null ? void 0 : n.onProgress) == null || v.call(n, ho(t), _o(t)), null);
|
|
1013
1073
|
}
|
|
1014
|
-
async function
|
|
1015
|
-
const n = await
|
|
1016
|
-
return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await
|
|
1074
|
+
async function go(e) {
|
|
1075
|
+
const n = await At(e);
|
|
1076
|
+
return n.status !== "SUCCEEDED" || !n.finalArtifactId ? null : await Fe(e, n.finalArtifactId);
|
|
1017
1077
|
}
|
|
1018
|
-
async function
|
|
1019
|
-
await
|
|
1078
|
+
async function vo(e) {
|
|
1079
|
+
await uo(e);
|
|
1020
1080
|
}
|
|
1021
|
-
function
|
|
1081
|
+
function ho(e) {
|
|
1022
1082
|
if (e.status === "PENDING") return 8;
|
|
1023
1083
|
const n = e.steps ?? [];
|
|
1024
1084
|
if (!n.length) return 35;
|
|
1025
1085
|
const t = n.filter((o) => o.status === "SUCCEEDED" || o.status === "SKIPPED").length;
|
|
1026
1086
|
return Math.min(90, Math.round(20 + t / n.length * 70));
|
|
1027
1087
|
}
|
|
1028
|
-
function
|
|
1088
|
+
function _o(e) {
|
|
1029
1089
|
var t;
|
|
1030
1090
|
if (e.status === "PENDING") return "排队中…";
|
|
1031
1091
|
const n = (t = e.steps) == null ? void 0 : t.find((o) => o.status === "RUNNING");
|
|
1032
1092
|
return n ? `执行中:${n.stepKey}` : "后端处理中…";
|
|
1033
1093
|
}
|
|
1034
|
-
const
|
|
1035
|
-
function
|
|
1094
|
+
const Et = 80;
|
|
1095
|
+
function yo() {
|
|
1036
1096
|
try {
|
|
1037
|
-
const e = localStorage.getItem(
|
|
1097
|
+
const e = localStorage.getItem(ht());
|
|
1038
1098
|
if (!e) return [];
|
|
1039
1099
|
const n = JSON.parse(e);
|
|
1040
|
-
return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t, o) => o.createdAt - t.createdAt).slice(0,
|
|
1100
|
+
return Array.isArray(n) ? n.filter((t) => t && t.id && t.createdAt).sort((t, o) => o.createdAt - t.createdAt).slice(0, Et) : [];
|
|
1041
1101
|
} catch {
|
|
1042
1102
|
return [];
|
|
1043
1103
|
}
|
|
1044
1104
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const n = e.slice(0,
|
|
1105
|
+
function wo(e) {
|
|
1106
|
+
const n = e.slice(0, Et).map((t) => ({
|
|
1047
1107
|
id: t.id,
|
|
1048
1108
|
title: t.title,
|
|
1049
1109
|
freeText: t.freeText,
|
|
@@ -1057,120 +1117,120 @@ function fo(e) {
|
|
|
1057
1117
|
createdAt: t.createdAt,
|
|
1058
1118
|
finishedAt: t.finishedAt
|
|
1059
1119
|
}));
|
|
1060
|
-
localStorage.setItem(
|
|
1120
|
+
localStorage.setItem(ht(), JSON.stringify(n));
|
|
1061
1121
|
}
|
|
1062
|
-
function
|
|
1122
|
+
function To(e) {
|
|
1063
1123
|
return {
|
|
1064
1124
|
...e,
|
|
1065
1125
|
logs: e.runId ? [`ℹ 已从本地恢复,runId=${e.runId}`] : [],
|
|
1066
1126
|
result: void 0
|
|
1067
1127
|
};
|
|
1068
1128
|
}
|
|
1069
|
-
function
|
|
1129
|
+
function se(e) {
|
|
1070
1130
|
return e === "pending" || e === "running";
|
|
1071
1131
|
}
|
|
1072
|
-
let
|
|
1073
|
-
const
|
|
1074
|
-
function
|
|
1075
|
-
return
|
|
1132
|
+
let Re = 0, ve = null;
|
|
1133
|
+
const Io = 5e3;
|
|
1134
|
+
function Co() {
|
|
1135
|
+
return Re += 1, `ai_task_${Date.now()}_${Re}`;
|
|
1076
1136
|
}
|
|
1077
|
-
function
|
|
1137
|
+
function So(e, n = 28) {
|
|
1078
1138
|
const t = e.trim();
|
|
1079
1139
|
return t.length <= n ? t : `${t.slice(0, n)}…`;
|
|
1080
1140
|
}
|
|
1081
|
-
const
|
|
1082
|
-
const e = b([]), n = b(!1), t = b(!1), o = b(!1),
|
|
1083
|
-
function r(
|
|
1141
|
+
const Mt = cn("ycAiTask", () => {
|
|
1142
|
+
const e = b([]), n = b(!1), t = b(!1), o = b(!1), s = b({}), d = b(!1), v = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Set();
|
|
1143
|
+
function r(i, p) {
|
|
1084
1144
|
return {
|
|
1085
|
-
taskId:
|
|
1086
|
-
runId:
|
|
1087
|
-
title:
|
|
1088
|
-
freeText:
|
|
1089
|
-
promptId:
|
|
1090
|
-
result:
|
|
1091
|
-
finishedAt:
|
|
1145
|
+
taskId: i.id,
|
|
1146
|
+
runId: i.runId,
|
|
1147
|
+
title: i.title,
|
|
1148
|
+
freeText: i.freeText,
|
|
1149
|
+
promptId: i.promptId,
|
|
1150
|
+
result: p,
|
|
1151
|
+
finishedAt: i.finishedAt ?? Date.now()
|
|
1092
1152
|
};
|
|
1093
1153
|
}
|
|
1094
|
-
function
|
|
1095
|
-
var
|
|
1096
|
-
const c = e.value.find((
|
|
1154
|
+
function C(i, p) {
|
|
1155
|
+
var ue;
|
|
1156
|
+
const c = e.value.find((J) => J.id === i);
|
|
1097
1157
|
if (!(c != null && c.runId)) return;
|
|
1098
|
-
const
|
|
1099
|
-
(
|
|
1158
|
+
const K = r(c, p);
|
|
1159
|
+
(ue = _.get(i)) == null || ue(K), _.delete(i), y.forEach((J) => J(K));
|
|
1100
1160
|
}
|
|
1101
|
-
function
|
|
1102
|
-
return
|
|
1161
|
+
function V(i) {
|
|
1162
|
+
return y.add(i), () => y.delete(i);
|
|
1103
1163
|
}
|
|
1104
|
-
const
|
|
1105
|
-
() => e.value.filter((
|
|
1106
|
-
),
|
|
1107
|
-
const
|
|
1108
|
-
return
|
|
1164
|
+
const F = P(
|
|
1165
|
+
() => e.value.filter((i) => se(i.status)).length
|
|
1166
|
+
), X = P(() => e.value.filter((i) => i.status === "running").length), O = P(() => F.value > 0 ? "AI 处理中" : e.value.some((i) => i.status === "failed") ? "部分任务失败" : "AI 任务"), f = P(() => {
|
|
1167
|
+
const i = e.value.length, p = F.value;
|
|
1168
|
+
return i === 0 ? "暂无任务" : p > 0 ? `${p}/${i} 项任务进行中` : `${i} 项任务已完成`;
|
|
1109
1169
|
});
|
|
1110
|
-
function
|
|
1111
|
-
|
|
1170
|
+
function L() {
|
|
1171
|
+
wo(e.value);
|
|
1112
1172
|
}
|
|
1113
|
-
function
|
|
1114
|
-
const c = e.value.findIndex((
|
|
1115
|
-
c >= 0 && (e.value[c] = { ...e.value[c], ...
|
|
1173
|
+
function H(i, p) {
|
|
1174
|
+
const c = e.value.findIndex((K) => K.id === i);
|
|
1175
|
+
c >= 0 && (e.value[c] = { ...e.value[c], ...p }, L());
|
|
1116
1176
|
}
|
|
1117
|
-
function
|
|
1118
|
-
const c = e.value.find((
|
|
1119
|
-
c && (c.logs.unshift(
|
|
1177
|
+
function S(i, p) {
|
|
1178
|
+
const c = e.value.find((K) => K.id === i);
|
|
1179
|
+
c && (c.logs.unshift(p), c.logs.length > 20 && c.logs.pop());
|
|
1120
1180
|
}
|
|
1121
|
-
function
|
|
1181
|
+
function U() {
|
|
1122
1182
|
n.value = !0, t.value = !1;
|
|
1123
1183
|
}
|
|
1124
|
-
function
|
|
1184
|
+
function N() {
|
|
1125
1185
|
n.value = !1;
|
|
1126
1186
|
}
|
|
1127
|
-
function
|
|
1187
|
+
function h() {
|
|
1128
1188
|
t.value = !t.value;
|
|
1129
1189
|
}
|
|
1130
|
-
function
|
|
1131
|
-
|
|
1190
|
+
function k(i = {}) {
|
|
1191
|
+
s.value = { ...i }, o.value = !0, Ge(i);
|
|
1132
1192
|
}
|
|
1133
|
-
function
|
|
1134
|
-
o.value = !1,
|
|
1193
|
+
function Y() {
|
|
1194
|
+
o.value = !1, Ct();
|
|
1135
1195
|
}
|
|
1136
|
-
function
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
},
|
|
1196
|
+
function j() {
|
|
1197
|
+
ve || (ve = setInterval(() => {
|
|
1198
|
+
ee();
|
|
1199
|
+
}, Io));
|
|
1140
1200
|
}
|
|
1141
|
-
function
|
|
1142
|
-
|
|
1201
|
+
function W() {
|
|
1202
|
+
F.value > 0 || ve && (clearInterval(ve), ve = null);
|
|
1143
1203
|
}
|
|
1144
|
-
async function
|
|
1145
|
-
const
|
|
1146
|
-
if (!
|
|
1147
|
-
|
|
1204
|
+
async function ee() {
|
|
1205
|
+
const i = e.value.filter((p) => p.runId && se(p.status));
|
|
1206
|
+
if (!i.length) {
|
|
1207
|
+
W();
|
|
1148
1208
|
return;
|
|
1149
1209
|
}
|
|
1150
|
-
await Promise.all(
|
|
1210
|
+
await Promise.all(i.map((p) => A(p.id)));
|
|
1151
1211
|
}
|
|
1152
|
-
async function
|
|
1153
|
-
if (
|
|
1154
|
-
const
|
|
1155
|
-
if (!(!(
|
|
1156
|
-
|
|
1212
|
+
async function A(i) {
|
|
1213
|
+
if (v.has(i)) return;
|
|
1214
|
+
const p = e.value.find((c) => c.id === i);
|
|
1215
|
+
if (!(!(p != null && p.runId) || !se(p.status))) {
|
|
1216
|
+
v.add(i);
|
|
1157
1217
|
try {
|
|
1158
|
-
const c = await
|
|
1159
|
-
onProgress: (
|
|
1218
|
+
const c = await mo(p.runId, {
|
|
1219
|
+
onProgress: (K, ue) => H(i, { progress: K, summary: ue, status: "running" })
|
|
1160
1220
|
});
|
|
1161
1221
|
if (!c) return;
|
|
1162
1222
|
if (c.phase === "SUCCEEDED") {
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1223
|
+
const K = c.result ?? {};
|
|
1224
|
+
H(i, {
|
|
1165
1225
|
status: "succeeded",
|
|
1166
1226
|
progress: 100,
|
|
1167
1227
|
summary: "已完成",
|
|
1168
|
-
result:
|
|
1228
|
+
result: K,
|
|
1169
1229
|
runId: c.runId,
|
|
1170
1230
|
finishedAt: Date.now()
|
|
1171
|
-
}),
|
|
1231
|
+
}), C(i, K);
|
|
1172
1232
|
} else
|
|
1173
|
-
|
|
1233
|
+
H(i, {
|
|
1174
1234
|
status: c.errorMessage === "已取消" ? "cancelled" : "failed",
|
|
1175
1235
|
progress: 100,
|
|
1176
1236
|
summary: c.errorMessage || "失败",
|
|
@@ -1178,129 +1238,129 @@ const St = tn("ycAiTask", () => {
|
|
|
1178
1238
|
runId: c.runId,
|
|
1179
1239
|
finishedAt: Date.now()
|
|
1180
1240
|
});
|
|
1181
|
-
|
|
1241
|
+
W();
|
|
1182
1242
|
} catch (c) {
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1243
|
+
const K = c instanceof Error ? c.message : "同步失败";
|
|
1244
|
+
S(i, `✗ ${K}`);
|
|
1185
1245
|
} finally {
|
|
1186
|
-
|
|
1246
|
+
v.delete(i);
|
|
1187
1247
|
}
|
|
1188
1248
|
}
|
|
1189
1249
|
}
|
|
1190
|
-
async function
|
|
1191
|
-
if (
|
|
1192
|
-
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1250
|
+
async function oe() {
|
|
1251
|
+
if (d.value) return;
|
|
1252
|
+
d.value = !0;
|
|
1253
|
+
const i = yo();
|
|
1254
|
+
i.length && (e.value = i.map(To), Re = i.length);
|
|
1255
|
+
const p = e.value.filter((c) => c.runId && se(c.status));
|
|
1256
|
+
p.length && (await Promise.all(p.map((c) => A(c.id))), j());
|
|
1197
1257
|
for (const c of e.value)
|
|
1198
|
-
c.status === "pending" && !c.runId &&
|
|
1258
|
+
c.status === "pending" && !c.runId && H(c.id, { status: "failed", summary: "页面刷新前未提交成功", finishedAt: Date.now() });
|
|
1199
1259
|
}
|
|
1200
|
-
function
|
|
1201
|
-
const
|
|
1202
|
-
id:
|
|
1203
|
-
title:
|
|
1204
|
-
freeText:
|
|
1205
|
-
promptId:
|
|
1206
|
-
autoMatch:
|
|
1260
|
+
function le(i) {
|
|
1261
|
+
const p = Co(), c = {
|
|
1262
|
+
id: p,
|
|
1263
|
+
title: i.title ?? So(i.freeText),
|
|
1264
|
+
freeText: i.freeText.trim(),
|
|
1265
|
+
promptId: i.promptId,
|
|
1266
|
+
autoMatch: i.autoMatch,
|
|
1207
1267
|
status: "pending",
|
|
1208
1268
|
progress: 0,
|
|
1209
1269
|
summary: "正在提交…",
|
|
1210
1270
|
createdAt: Date.now(),
|
|
1211
1271
|
logs: []
|
|
1212
1272
|
};
|
|
1213
|
-
return e.value.unshift(c),
|
|
1273
|
+
return e.value.unshift(c), L(), i.onFinish && _.set(p, i.onFinish), i.showPanel !== !1 && U(), te(p), p;
|
|
1214
1274
|
}
|
|
1215
|
-
async function
|
|
1216
|
-
const
|
|
1217
|
-
if (
|
|
1275
|
+
async function te(i) {
|
|
1276
|
+
const p = e.value.find((c) => c.id === i);
|
|
1277
|
+
if (p)
|
|
1218
1278
|
try {
|
|
1219
|
-
const c = await
|
|
1220
|
-
freeText:
|
|
1221
|
-
promptId:
|
|
1222
|
-
autoMatch:
|
|
1279
|
+
const c = await po({
|
|
1280
|
+
freeText: p.freeText,
|
|
1281
|
+
promptId: p.promptId,
|
|
1282
|
+
autoMatch: p.autoMatch
|
|
1223
1283
|
});
|
|
1224
|
-
|
|
1284
|
+
H(i, {
|
|
1225
1285
|
runId: c,
|
|
1226
1286
|
status: "running",
|
|
1227
1287
|
progress: 10,
|
|
1228
1288
|
summary: "后端异步处理中…"
|
|
1229
|
-
}),
|
|
1289
|
+
}), S(i, `▶ 已提交 runId=${c}`), j(), A(i);
|
|
1230
1290
|
} catch (c) {
|
|
1231
|
-
const
|
|
1232
|
-
|
|
1291
|
+
const K = c instanceof Error ? c.message : "提交失败";
|
|
1292
|
+
H(i, {
|
|
1233
1293
|
status: "failed",
|
|
1234
1294
|
progress: 100,
|
|
1235
|
-
summary:
|
|
1236
|
-
errorMessage:
|
|
1295
|
+
summary: K,
|
|
1296
|
+
errorMessage: K,
|
|
1237
1297
|
finishedAt: Date.now()
|
|
1238
1298
|
});
|
|
1239
1299
|
}
|
|
1240
1300
|
}
|
|
1241
|
-
async function
|
|
1242
|
-
const
|
|
1243
|
-
if (!(
|
|
1244
|
-
if (
|
|
1245
|
-
const c = await
|
|
1246
|
-
return c &&
|
|
1301
|
+
async function R(i) {
|
|
1302
|
+
const p = e.value.find((K) => K.id === i);
|
|
1303
|
+
if (!(p != null && p.runId)) return null;
|
|
1304
|
+
if (p.result) return p.result;
|
|
1305
|
+
const c = await go(p.runId);
|
|
1306
|
+
return c && H(i, { result: c }), c;
|
|
1247
1307
|
}
|
|
1248
|
-
async function
|
|
1249
|
-
const
|
|
1250
|
-
if (
|
|
1308
|
+
async function z(i) {
|
|
1309
|
+
const p = e.value.find((c) => c.id === i);
|
|
1310
|
+
if (p != null && p.runId && se(p.status))
|
|
1251
1311
|
try {
|
|
1252
|
-
await
|
|
1312
|
+
await vo(p.runId);
|
|
1253
1313
|
} catch {
|
|
1254
1314
|
}
|
|
1255
|
-
|
|
1315
|
+
p && se(p.status) && H(i, { status: "cancelled", summary: "已取消", finishedAt: Date.now() }), _.delete(i), W();
|
|
1256
1316
|
}
|
|
1257
|
-
function
|
|
1258
|
-
for (const
|
|
1259
|
-
|
|
1317
|
+
function Te() {
|
|
1318
|
+
for (const i of e.value)
|
|
1319
|
+
se(i.status) && z(i.id);
|
|
1260
1320
|
}
|
|
1261
|
-
function
|
|
1262
|
-
e.value = e.value.filter((
|
|
1321
|
+
function Ie() {
|
|
1322
|
+
e.value = e.value.filter((i) => se(i.status)), L();
|
|
1263
1323
|
}
|
|
1264
|
-
function
|
|
1265
|
-
|
|
1324
|
+
function Ce(i) {
|
|
1325
|
+
z(i), _.delete(i), e.value = e.value.filter((p) => p.id !== i), L();
|
|
1266
1326
|
}
|
|
1267
1327
|
return {
|
|
1268
1328
|
tasks: e,
|
|
1269
1329
|
panelVisible: n,
|
|
1270
1330
|
panelMinimized: t,
|
|
1271
1331
|
dialogVisible: o,
|
|
1272
|
-
dialogOptions:
|
|
1273
|
-
hydrated:
|
|
1274
|
-
runningCount:
|
|
1275
|
-
activeCount:
|
|
1276
|
-
panelTitle:
|
|
1277
|
-
panelSubtitle:
|
|
1278
|
-
hydrate:
|
|
1279
|
-
showPanel:
|
|
1280
|
-
hidePanel:
|
|
1281
|
-
toggleMinimize:
|
|
1282
|
-
openDialog:
|
|
1283
|
-
closeDialog:
|
|
1284
|
-
enqueue:
|
|
1285
|
-
onTaskFinish:
|
|
1286
|
-
refreshActiveTasks:
|
|
1287
|
-
loadTaskResult:
|
|
1288
|
-
cancelTask:
|
|
1289
|
-
cancelAll:
|
|
1290
|
-
clearFinished:
|
|
1291
|
-
removeTask:
|
|
1332
|
+
dialogOptions: s,
|
|
1333
|
+
hydrated: d,
|
|
1334
|
+
runningCount: F,
|
|
1335
|
+
activeCount: X,
|
|
1336
|
+
panelTitle: O,
|
|
1337
|
+
panelSubtitle: f,
|
|
1338
|
+
hydrate: oe,
|
|
1339
|
+
showPanel: U,
|
|
1340
|
+
hidePanel: N,
|
|
1341
|
+
toggleMinimize: h,
|
|
1342
|
+
openDialog: k,
|
|
1343
|
+
closeDialog: Y,
|
|
1344
|
+
enqueue: le,
|
|
1345
|
+
onTaskFinish: V,
|
|
1346
|
+
refreshActiveTasks: ee,
|
|
1347
|
+
loadTaskResult: R,
|
|
1348
|
+
cancelTask: z,
|
|
1349
|
+
cancelAll: Te,
|
|
1350
|
+
clearFinished: Ie,
|
|
1351
|
+
removeTask: Ce
|
|
1292
1352
|
};
|
|
1293
1353
|
});
|
|
1294
|
-
async function
|
|
1295
|
-
return (await
|
|
1354
|
+
async function ko(e) {
|
|
1355
|
+
return (await pe().get("/yc-ai/ai/prompts", {
|
|
1296
1356
|
params: e ? { category: e } : {}
|
|
1297
1357
|
})).data;
|
|
1298
1358
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const e =
|
|
1301
|
-
return e ||
|
|
1359
|
+
function We() {
|
|
1360
|
+
const e = Ye(bt, null);
|
|
1361
|
+
return e || Mt();
|
|
1302
1362
|
}
|
|
1303
|
-
const
|
|
1363
|
+
const xo = { class: "ai-use-dialog__footer" }, bo = { class: "ai-use-dialog__footer-actions" }, Ao = /* @__PURE__ */ de({
|
|
1304
1364
|
__name: "AiUseDialog",
|
|
1305
1365
|
props: {
|
|
1306
1366
|
title: { default: "AI 生成" },
|
|
@@ -1323,191 +1383,191 @@ const ho = { class: "ai-use-dialog__footer" }, yo = { class: "ai-use-dialog__foo
|
|
|
1323
1383
|
},
|
|
1324
1384
|
emits: ["update:modelValue", "submitted"],
|
|
1325
1385
|
setup(e, { emit: n }) {
|
|
1326
|
-
const t = e, o = n,
|
|
1386
|
+
const t = e, o = n, s = We(), d = P(() => t.modelValue !== void 0), v = b(!1);
|
|
1327
1387
|
ne(
|
|
1328
1388
|
() => t.modelValue,
|
|
1329
|
-
(
|
|
1330
|
-
|
|
1389
|
+
(h) => {
|
|
1390
|
+
d.value && (v.value = !!h);
|
|
1331
1391
|
},
|
|
1332
1392
|
{ immediate: !0 }
|
|
1333
|
-
), ne(
|
|
1334
|
-
if (
|
|
1335
|
-
o("update:modelValue",
|
|
1393
|
+
), ne(v, (h) => {
|
|
1394
|
+
if (d.value) {
|
|
1395
|
+
o("update:modelValue", h);
|
|
1336
1396
|
return;
|
|
1337
1397
|
}
|
|
1338
|
-
|
|
1398
|
+
ae.visible = h, h || Ct();
|
|
1339
1399
|
}), ne(
|
|
1340
|
-
() =>
|
|
1341
|
-
(
|
|
1342
|
-
|
|
1400
|
+
() => ae.visible,
|
|
1401
|
+
(h) => {
|
|
1402
|
+
d.value || (v.value = h);
|
|
1343
1403
|
},
|
|
1344
1404
|
{ immediate: !0 }
|
|
1345
1405
|
);
|
|
1346
|
-
function
|
|
1347
|
-
if (
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1406
|
+
function _(h) {
|
|
1407
|
+
if (d.value) return;
|
|
1408
|
+
const k = h.detail ?? {};
|
|
1409
|
+
O(k), v.value = !0;
|
|
1350
1410
|
}
|
|
1351
|
-
|
|
1352
|
-
globalThis.addEventListener(
|
|
1353
|
-
}),
|
|
1354
|
-
globalThis.removeEventListener(
|
|
1411
|
+
Ke(() => {
|
|
1412
|
+
globalThis.addEventListener(Ue, _), d.value || (v.value = ae.visible);
|
|
1413
|
+
}), Ne(() => {
|
|
1414
|
+
globalThis.removeEventListener(Ue, _);
|
|
1355
1415
|
});
|
|
1356
|
-
const
|
|
1357
|
-
() => (
|
|
1416
|
+
const y = P(
|
|
1417
|
+
() => (d.value ? void 0 : ae.options.title) ?? t.title ?? "AI 生成"
|
|
1358
1418
|
), r = b({
|
|
1359
1419
|
freeText: t.freeText,
|
|
1360
1420
|
promptId: t.promptId,
|
|
1361
1421
|
autoMatch: t.autoMatch
|
|
1362
|
-
}),
|
|
1363
|
-
function
|
|
1364
|
-
var
|
|
1365
|
-
r.value.freeText =
|
|
1422
|
+
}), C = b(t.prompts ? [...t.prompts] : []), V = b(!1), F = b(!1), X = b();
|
|
1423
|
+
function O(h) {
|
|
1424
|
+
var k, Y;
|
|
1425
|
+
r.value.freeText = h.freeText ?? t.freeText ?? "", r.value.promptId = h.promptId ?? t.promptId, r.value.autoMatch = h.autoMatch ?? t.autoMatch ?? !1, X.value = h.onFinish, (k = h.prompts) != null && k.length ? C.value = [...h.prompts] : (Y = t.prompts) != null && Y.length && (C.value = [...t.prompts]);
|
|
1366
1426
|
}
|
|
1367
|
-
async function
|
|
1368
|
-
if (!(
|
|
1369
|
-
|
|
1427
|
+
async function f() {
|
|
1428
|
+
if (!(C.value.length > 0)) {
|
|
1429
|
+
V.value = !0;
|
|
1370
1430
|
try {
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1431
|
+
const h = vt().listPrompts;
|
|
1432
|
+
C.value = h ? await h() : await ko();
|
|
1373
1433
|
} catch {
|
|
1374
|
-
|
|
1434
|
+
Q.warning("加载提示词失败");
|
|
1375
1435
|
} finally {
|
|
1376
|
-
|
|
1436
|
+
V.value = !1;
|
|
1377
1437
|
}
|
|
1378
1438
|
}
|
|
1379
1439
|
}
|
|
1380
|
-
function
|
|
1381
|
-
|
|
1440
|
+
function L() {
|
|
1441
|
+
d.value ? O({}) : O(ae.options), t.showPromptSelect && f();
|
|
1382
1442
|
}
|
|
1383
1443
|
ne(
|
|
1384
1444
|
() => t.prompts,
|
|
1385
|
-
(
|
|
1386
|
-
|
|
1445
|
+
(h) => {
|
|
1446
|
+
h != null && h.length && (C.value = [...h]);
|
|
1387
1447
|
},
|
|
1388
1448
|
{ deep: !0 }
|
|
1389
1449
|
), ne(
|
|
1390
1450
|
() => [t.freeText, t.promptId, t.autoMatch],
|
|
1391
|
-
([
|
|
1392
|
-
|
|
1451
|
+
([h, k, Y]) => {
|
|
1452
|
+
v.value || (r.value.freeText = h ?? "", r.value.promptId = k, r.value.autoMatch = Y ?? !1);
|
|
1393
1453
|
}
|
|
1394
1454
|
);
|
|
1395
|
-
function
|
|
1455
|
+
function H() {
|
|
1396
1456
|
r.value.autoMatch && (r.value.promptId = void 0);
|
|
1397
1457
|
}
|
|
1398
|
-
function
|
|
1399
|
-
|
|
1458
|
+
function S() {
|
|
1459
|
+
F.value = !1;
|
|
1400
1460
|
}
|
|
1401
|
-
function
|
|
1402
|
-
|
|
1461
|
+
function U() {
|
|
1462
|
+
s.showPanel();
|
|
1403
1463
|
}
|
|
1404
|
-
async function
|
|
1405
|
-
var
|
|
1464
|
+
async function N() {
|
|
1465
|
+
var W, ee;
|
|
1406
1466
|
if (!r.value.freeText.trim()) {
|
|
1407
|
-
|
|
1467
|
+
Q.warning("请填写需求描述");
|
|
1408
1468
|
return;
|
|
1409
1469
|
}
|
|
1410
|
-
const
|
|
1411
|
-
if (!
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1470
|
+
const h = r.value.autoMatch, k = h ? void 0 : r.value.promptId;
|
|
1471
|
+
if (!h && k == null) {
|
|
1472
|
+
const A = t.showPromptSelect || t.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
|
|
1473
|
+
Q.warning(A);
|
|
1414
1474
|
return;
|
|
1415
1475
|
}
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1476
|
+
F.value = !0;
|
|
1477
|
+
const Y = d.value ? X.value : ae.options.onFinish, j = s.enqueue({
|
|
1418
1478
|
freeText: r.value.freeText.trim(),
|
|
1419
|
-
promptId:
|
|
1420
|
-
autoMatch:
|
|
1479
|
+
promptId: k,
|
|
1480
|
+
autoMatch: h && k == null ? !0 : void 0,
|
|
1421
1481
|
showPanel: !0,
|
|
1422
|
-
onFinish:
|
|
1482
|
+
onFinish: Y
|
|
1423
1483
|
});
|
|
1424
|
-
|
|
1484
|
+
d.value ? o("submitted", j) : (ee = (W = ae.options).onSubmitted) == null || ee.call(W, j), v.value = !1, F.value = !1, Q.success("已加入任务队列,可在任务面板查看进度");
|
|
1425
1485
|
}
|
|
1426
|
-
return (
|
|
1427
|
-
const
|
|
1428
|
-
return
|
|
1429
|
-
modelValue:
|
|
1430
|
-
"onUpdate:modelValue":
|
|
1431
|
-
title:
|
|
1486
|
+
return (h, k) => {
|
|
1487
|
+
const Y = B("el-switch"), j = B("el-form-item"), W = B("el-option"), ee = B("el-select"), A = B("el-input"), oe = B("el-form"), le = B("el-button"), te = B("el-dialog");
|
|
1488
|
+
return u(), M(te, {
|
|
1489
|
+
modelValue: v.value,
|
|
1490
|
+
"onUpdate:modelValue": k[4] || (k[4] = (R) => v.value = R),
|
|
1491
|
+
title: y.value,
|
|
1432
1492
|
width: e.width,
|
|
1433
1493
|
"append-to-body": "",
|
|
1434
1494
|
class: "ai-use-dialog",
|
|
1435
|
-
onClosed:
|
|
1436
|
-
onOpen:
|
|
1495
|
+
onClosed: S,
|
|
1496
|
+
onOpen: L
|
|
1437
1497
|
}, {
|
|
1438
|
-
footer:
|
|
1439
|
-
|
|
1440
|
-
e.showTaskListButton ? (
|
|
1498
|
+
footer: g(() => [
|
|
1499
|
+
T("div", xo, [
|
|
1500
|
+
e.showTaskListButton ? (u(), M(le, {
|
|
1441
1501
|
key: 0,
|
|
1442
1502
|
link: "",
|
|
1443
1503
|
type: "primary",
|
|
1444
|
-
onClick:
|
|
1504
|
+
onClick: U
|
|
1445
1505
|
}, {
|
|
1446
|
-
default:
|
|
1447
|
-
|
|
1506
|
+
default: g(() => [
|
|
1507
|
+
G(D(e.taskListButtonText), 1)
|
|
1448
1508
|
]),
|
|
1449
1509
|
_: 1
|
|
1450
1510
|
})) : $("", !0),
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
onClick:
|
|
1511
|
+
T("div", bo, [
|
|
1512
|
+
m(le, {
|
|
1513
|
+
onClick: k[3] || (k[3] = (R) => v.value = !1)
|
|
1454
1514
|
}, {
|
|
1455
|
-
default:
|
|
1456
|
-
|
|
1515
|
+
default: g(() => [...k[5] || (k[5] = [
|
|
1516
|
+
G("取消", -1)
|
|
1457
1517
|
])]),
|
|
1458
1518
|
_: 1
|
|
1459
1519
|
}),
|
|
1460
|
-
|
|
1520
|
+
m(le, {
|
|
1461
1521
|
type: "primary",
|
|
1462
|
-
loading:
|
|
1463
|
-
onClick:
|
|
1522
|
+
loading: F.value,
|
|
1523
|
+
onClick: N
|
|
1464
1524
|
}, {
|
|
1465
|
-
default:
|
|
1466
|
-
|
|
1525
|
+
default: g(() => [
|
|
1526
|
+
G(D(e.submitText), 1)
|
|
1467
1527
|
]),
|
|
1468
1528
|
_: 1
|
|
1469
1529
|
}, 8, ["loading"])
|
|
1470
1530
|
])
|
|
1471
1531
|
])
|
|
1472
1532
|
]),
|
|
1473
|
-
default:
|
|
1474
|
-
|
|
1475
|
-
default:
|
|
1476
|
-
e.showAutoMatch ? (
|
|
1533
|
+
default: g(() => [
|
|
1534
|
+
m(oe, { "label-position": "top" }, {
|
|
1535
|
+
default: g(() => [
|
|
1536
|
+
e.showAutoMatch ? (u(), M(j, {
|
|
1477
1537
|
key: 0,
|
|
1478
1538
|
label: e.autoMatchLabel
|
|
1479
1539
|
}, {
|
|
1480
|
-
default:
|
|
1481
|
-
|
|
1540
|
+
default: g(() => [
|
|
1541
|
+
m(Y, {
|
|
1482
1542
|
modelValue: r.value.autoMatch,
|
|
1483
|
-
"onUpdate:modelValue":
|
|
1543
|
+
"onUpdate:modelValue": k[0] || (k[0] = (R) => r.value.autoMatch = R),
|
|
1484
1544
|
"active-text": "按需求自动选",
|
|
1485
1545
|
"inactive-text": "手动指定",
|
|
1486
|
-
onChange:
|
|
1546
|
+
onChange: H
|
|
1487
1547
|
}, null, 8, ["modelValue"])
|
|
1488
1548
|
]),
|
|
1489
1549
|
_: 1
|
|
1490
1550
|
}, 8, ["label"])) : $("", !0),
|
|
1491
|
-
e.showPromptSelect ? (
|
|
1551
|
+
e.showPromptSelect ? (u(), M(j, {
|
|
1492
1552
|
key: 1,
|
|
1493
1553
|
label: e.promptLabel,
|
|
1494
1554
|
required: !r.value.autoMatch
|
|
1495
1555
|
}, {
|
|
1496
|
-
default:
|
|
1497
|
-
|
|
1556
|
+
default: g(() => [
|
|
1557
|
+
m(ee, {
|
|
1498
1558
|
modelValue: r.value.promptId,
|
|
1499
|
-
"onUpdate:modelValue":
|
|
1559
|
+
"onUpdate:modelValue": k[1] || (k[1] = (R) => r.value.promptId = R),
|
|
1500
1560
|
filterable: "",
|
|
1501
1561
|
clearable: "",
|
|
1502
1562
|
placeholder: r.value.autoMatch ? "留空则自动匹配" : "请选择提示词",
|
|
1503
1563
|
style: { width: "100%" },
|
|
1504
|
-
loading:
|
|
1564
|
+
loading: V.value
|
|
1505
1565
|
}, {
|
|
1506
|
-
default:
|
|
1507
|
-
(
|
|
1508
|
-
key:
|
|
1509
|
-
label:
|
|
1510
|
-
value:
|
|
1566
|
+
default: g(() => [
|
|
1567
|
+
(u(!0), E(re, null, he(C.value, (R) => (u(), M(W, {
|
|
1568
|
+
key: R.id,
|
|
1569
|
+
label: R.name,
|
|
1570
|
+
value: R.id
|
|
1511
1571
|
}, null, 8, ["label", "value"]))), 128))
|
|
1512
1572
|
]),
|
|
1513
1573
|
_: 1
|
|
@@ -1515,14 +1575,14 @@ const ho = { class: "ai-use-dialog__footer" }, yo = { class: "ai-use-dialog__foo
|
|
|
1515
1575
|
]),
|
|
1516
1576
|
_: 1
|
|
1517
1577
|
}, 8, ["label", "required"])) : $("", !0),
|
|
1518
|
-
|
|
1578
|
+
m(j, {
|
|
1519
1579
|
label: e.freeTextLabel,
|
|
1520
1580
|
required: ""
|
|
1521
1581
|
}, {
|
|
1522
|
-
default:
|
|
1523
|
-
|
|
1582
|
+
default: g(() => [
|
|
1583
|
+
m(A, {
|
|
1524
1584
|
modelValue: r.value.freeText,
|
|
1525
|
-
"onUpdate:modelValue":
|
|
1585
|
+
"onUpdate:modelValue": k[2] || (k[2] = (R) => r.value.freeText = R),
|
|
1526
1586
|
type: "textarea",
|
|
1527
1587
|
rows: 4,
|
|
1528
1588
|
placeholder: e.freeTextPlaceholder
|
|
@@ -1538,104 +1598,104 @@ const ho = { class: "ai-use-dialog__footer" }, yo = { class: "ai-use-dialog__foo
|
|
|
1538
1598
|
}, 8, ["modelValue", "title", "width"]);
|
|
1539
1599
|
};
|
|
1540
1600
|
}
|
|
1541
|
-
}),
|
|
1601
|
+
}), Eo = /* @__PURE__ */ Ee(Ao, [["__scopeId", "data-v-9aa82e83"]]), Mo = { class: "ai-task-panel" }, Po = { class: "ai-task-panel__header" }, $o = { class: "ai-task-panel__header-left" }, Lo = { class: "ai-task-panel__titles" }, Do = { class: "ai-task-panel__subtitle" }, Bo = { class: "ai-task-panel__title" }, Vo = { class: "ai-task-panel__header-actions" }, Oo = { class: "ai-task-panel__body" }, Uo = {
|
|
1542
1602
|
key: 1,
|
|
1543
1603
|
class: "ai-task-list"
|
|
1544
|
-
},
|
|
1604
|
+
}, Fo = { class: "ai-task-row__icon" }, Ro = { class: "ai-task-row__main" }, Ko = { class: "ai-task-row__title" }, No = { class: "ai-task-row__meta" }, zo = { key: 0 }, Yo = {
|
|
1545
1605
|
key: 0,
|
|
1546
1606
|
class: "ai-task-row__summary"
|
|
1547
|
-
},
|
|
1607
|
+
}, jo = { class: "ai-task-row__ops" }, Go = {
|
|
1548
1608
|
key: 0,
|
|
1549
1609
|
class: "ai-task-panel__footer"
|
|
1550
|
-
},
|
|
1610
|
+
}, Wo = /* @__PURE__ */ de({
|
|
1551
1611
|
__name: "AiTaskPanel",
|
|
1552
1612
|
emits: ["use"],
|
|
1553
1613
|
setup(e, { emit: n }) {
|
|
1554
|
-
const t = n, o =
|
|
1614
|
+
const t = n, o = We(), s = b(null), d = {
|
|
1555
1615
|
pending: "等待中",
|
|
1556
1616
|
running: "执行中",
|
|
1557
1617
|
succeeded: "已完成",
|
|
1558
1618
|
failed: "失败",
|
|
1559
1619
|
cancelled: "已取消"
|
|
1560
1620
|
};
|
|
1561
|
-
function y
|
|
1562
|
-
return
|
|
1621
|
+
function v(y) {
|
|
1622
|
+
return d[y] ?? y;
|
|
1563
1623
|
}
|
|
1564
|
-
async function
|
|
1565
|
-
|
|
1624
|
+
async function _(y) {
|
|
1625
|
+
s.value = y.id;
|
|
1566
1626
|
try {
|
|
1567
|
-
const r =
|
|
1627
|
+
const r = y.result ?? await o.loadTaskResult(y.id);
|
|
1568
1628
|
if (!r) return;
|
|
1569
1629
|
t("use", {
|
|
1570
|
-
taskId:
|
|
1571
|
-
runId:
|
|
1572
|
-
title:
|
|
1573
|
-
freeText:
|
|
1574
|
-
promptId:
|
|
1630
|
+
taskId: y.id,
|
|
1631
|
+
runId: y.runId,
|
|
1632
|
+
title: y.title,
|
|
1633
|
+
freeText: y.freeText,
|
|
1634
|
+
promptId: y.promptId,
|
|
1575
1635
|
result: r,
|
|
1576
|
-
finishedAt:
|
|
1636
|
+
finishedAt: y.finishedAt ?? Date.now()
|
|
1577
1637
|
});
|
|
1578
1638
|
} finally {
|
|
1579
|
-
|
|
1639
|
+
s.value = null;
|
|
1580
1640
|
}
|
|
1581
1641
|
}
|
|
1582
|
-
return (
|
|
1583
|
-
const
|
|
1584
|
-
return
|
|
1585
|
-
|
|
1586
|
-
default:
|
|
1587
|
-
_e(
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
class:
|
|
1642
|
+
return (y, r) => {
|
|
1643
|
+
const C = B("el-icon"), V = B("el-button"), F = B("el-empty"), X = B("el-progress"), O = B("el-badge");
|
|
1644
|
+
return u(), M(Jt, { to: "body" }, [
|
|
1645
|
+
m(pt, { name: "ai-panel-slide" }, {
|
|
1646
|
+
default: g(() => [
|
|
1647
|
+
_e(T("div", Mo, [
|
|
1648
|
+
T("div", Po, [
|
|
1649
|
+
T("div", $o, [
|
|
1650
|
+
T("div", {
|
|
1651
|
+
class: fe(["ai-task-panel__icon", { spinning: w(o).activeCount > 0 }])
|
|
1592
1652
|
}, [
|
|
1593
|
-
|
|
1594
|
-
default:
|
|
1595
|
-
|
|
1653
|
+
m(C, null, {
|
|
1654
|
+
default: g(() => [
|
|
1655
|
+
m(w(lt))
|
|
1596
1656
|
]),
|
|
1597
1657
|
_: 1
|
|
1598
1658
|
})
|
|
1599
1659
|
], 2),
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1660
|
+
T("div", Lo, [
|
|
1661
|
+
T("div", Do, D(w(o).panelSubtitle), 1),
|
|
1662
|
+
T("div", Bo, D(w(o).panelTitle), 1)
|
|
1603
1663
|
])
|
|
1604
1664
|
]),
|
|
1605
|
-
|
|
1606
|
-
w(o).runningCount > 0 ? (
|
|
1665
|
+
T("div", Vo, [
|
|
1666
|
+
w(o).runningCount > 0 ? (u(), M(V, {
|
|
1607
1667
|
key: 0,
|
|
1608
1668
|
link: "",
|
|
1609
1669
|
type: "primary",
|
|
1610
|
-
onClick: r[0] || (r[0] = (
|
|
1670
|
+
onClick: r[0] || (r[0] = (f) => w(o).cancelAll())
|
|
1611
1671
|
}, {
|
|
1612
|
-
default:
|
|
1613
|
-
|
|
1672
|
+
default: g(() => [...r[5] || (r[5] = [
|
|
1673
|
+
G(" 取消全部 ", -1)
|
|
1614
1674
|
])]),
|
|
1615
1675
|
_: 1
|
|
1616
1676
|
})) : $("", !0),
|
|
1617
|
-
|
|
1677
|
+
m(V, {
|
|
1618
1678
|
link: "",
|
|
1619
|
-
onClick: r[1] || (r[1] = (
|
|
1679
|
+
onClick: r[1] || (r[1] = (f) => w(o).toggleMinimize())
|
|
1620
1680
|
}, {
|
|
1621
|
-
default:
|
|
1622
|
-
|
|
1623
|
-
default:
|
|
1624
|
-
|
|
1681
|
+
default: g(() => [
|
|
1682
|
+
m(C, null, {
|
|
1683
|
+
default: g(() => [
|
|
1684
|
+
m(w(ln))
|
|
1625
1685
|
]),
|
|
1626
1686
|
_: 1
|
|
1627
1687
|
})
|
|
1628
1688
|
]),
|
|
1629
1689
|
_: 1
|
|
1630
1690
|
}),
|
|
1631
|
-
|
|
1691
|
+
m(V, {
|
|
1632
1692
|
link: "",
|
|
1633
|
-
onClick: r[2] || (r[2] = (
|
|
1693
|
+
onClick: r[2] || (r[2] = (f) => w(o).hidePanel())
|
|
1634
1694
|
}, {
|
|
1635
|
-
default:
|
|
1636
|
-
|
|
1637
|
-
default:
|
|
1638
|
-
|
|
1695
|
+
default: g(() => [
|
|
1696
|
+
m(C, null, {
|
|
1697
|
+
default: g(() => [
|
|
1698
|
+
m(w(gt))
|
|
1639
1699
|
]),
|
|
1640
1700
|
_: 1
|
|
1641
1701
|
})
|
|
@@ -1644,142 +1704,142 @@ const ho = { class: "ai-use-dialog__footer" }, yo = { class: "ai-use-dialog__foo
|
|
|
1644
1704
|
})
|
|
1645
1705
|
])
|
|
1646
1706
|
]),
|
|
1647
|
-
|
|
1648
|
-
w(o).tasks.length ? (
|
|
1649
|
-
(
|
|
1650
|
-
key:
|
|
1707
|
+
T("div", Oo, [
|
|
1708
|
+
w(o).tasks.length ? (u(), E("div", Uo, [
|
|
1709
|
+
(u(!0), E(re, null, he(w(o).tasks, (f) => (u(), E("div", {
|
|
1710
|
+
key: f.id,
|
|
1651
1711
|
class: "ai-task-row"
|
|
1652
1712
|
}, [
|
|
1653
|
-
|
|
1654
|
-
|
|
1713
|
+
T("div", Fo, [
|
|
1714
|
+
f.status === "succeeded" ? (u(), M(C, {
|
|
1655
1715
|
key: 0,
|
|
1656
1716
|
class: "ok"
|
|
1657
1717
|
}, {
|
|
1658
|
-
default:
|
|
1659
|
-
|
|
1718
|
+
default: g(() => [
|
|
1719
|
+
m(w(an))
|
|
1660
1720
|
]),
|
|
1661
1721
|
_: 1
|
|
1662
|
-
})) :
|
|
1722
|
+
})) : f.status === "failed" ? (u(), M(C, {
|
|
1663
1723
|
key: 1,
|
|
1664
1724
|
class: "err"
|
|
1665
1725
|
}, {
|
|
1666
|
-
default:
|
|
1667
|
-
|
|
1726
|
+
default: g(() => [
|
|
1727
|
+
m(w(sn))
|
|
1668
1728
|
]),
|
|
1669
1729
|
_: 1
|
|
1670
|
-
})) :
|
|
1730
|
+
})) : f.status === "running" || f.status === "pending" ? (u(), M(X, {
|
|
1671
1731
|
key: 2,
|
|
1672
1732
|
type: "circle",
|
|
1673
|
-
percentage:
|
|
1733
|
+
percentage: f.progress,
|
|
1674
1734
|
width: 36,
|
|
1675
1735
|
"stroke-width": 3
|
|
1676
|
-
}, null, 8, ["percentage"])) : (
|
|
1736
|
+
}, null, 8, ["percentage"])) : (u(), M(C, {
|
|
1677
1737
|
key: 3,
|
|
1678
1738
|
class: "muted"
|
|
1679
1739
|
}, {
|
|
1680
|
-
default:
|
|
1681
|
-
|
|
1740
|
+
default: g(() => [
|
|
1741
|
+
m(w(rn))
|
|
1682
1742
|
]),
|
|
1683
1743
|
_: 1
|
|
1684
1744
|
}))
|
|
1685
1745
|
]),
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1746
|
+
T("div", Ro, [
|
|
1747
|
+
T("div", Ko, D(f.title), 1),
|
|
1748
|
+
T("div", No, [
|
|
1749
|
+
T("span", null, D(v(f.status)), 1),
|
|
1750
|
+
f.runId ? (u(), E("span", zo, " · #" + D(f.runId), 1)) : $("", !0)
|
|
1691
1751
|
]),
|
|
1692
|
-
|
|
1752
|
+
f.summary ? (u(), E("div", Yo, D(f.summary), 1)) : $("", !0)
|
|
1693
1753
|
]),
|
|
1694
|
-
|
|
1695
|
-
|
|
1754
|
+
T("div", jo, [
|
|
1755
|
+
f.status === "running" || f.status === "pending" ? (u(), M(V, {
|
|
1696
1756
|
key: 0,
|
|
1697
1757
|
link: "",
|
|
1698
1758
|
type: "danger",
|
|
1699
1759
|
size: "small",
|
|
1700
|
-
onClick: (
|
|
1760
|
+
onClick: (L) => w(o).cancelTask(f.id)
|
|
1701
1761
|
}, {
|
|
1702
|
-
default:
|
|
1703
|
-
|
|
1762
|
+
default: g(() => [...r[6] || (r[6] = [
|
|
1763
|
+
G(" 取消 ", -1)
|
|
1704
1764
|
])]),
|
|
1705
1765
|
_: 1
|
|
1706
1766
|
}, 8, ["onClick"])) : $("", !0),
|
|
1707
|
-
|
|
1767
|
+
f.status === "succeeded" && f.runId ? (u(), M(V, {
|
|
1708
1768
|
key: 1,
|
|
1709
1769
|
link: "",
|
|
1710
1770
|
type: "primary",
|
|
1711
1771
|
size: "small",
|
|
1712
|
-
loading:
|
|
1713
|
-
onClick: (
|
|
1772
|
+
loading: s.value === f.id,
|
|
1773
|
+
onClick: (L) => _(f)
|
|
1714
1774
|
}, {
|
|
1715
|
-
default:
|
|
1716
|
-
|
|
1775
|
+
default: g(() => [...r[7] || (r[7] = [
|
|
1776
|
+
G(" 使用 ", -1)
|
|
1717
1777
|
])]),
|
|
1718
1778
|
_: 1
|
|
1719
1779
|
}, 8, ["loading", "onClick"])) : $("", !0),
|
|
1720
|
-
|
|
1780
|
+
f.status !== "running" && f.status !== "pending" ? (u(), M(V, {
|
|
1721
1781
|
key: 2,
|
|
1722
1782
|
link: "",
|
|
1723
1783
|
size: "small",
|
|
1724
|
-
onClick: (
|
|
1784
|
+
onClick: (L) => w(o).removeTask(f.id)
|
|
1725
1785
|
}, {
|
|
1726
|
-
default:
|
|
1727
|
-
|
|
1786
|
+
default: g(() => [...r[8] || (r[8] = [
|
|
1787
|
+
G(" 移除 ", -1)
|
|
1728
1788
|
])]),
|
|
1729
1789
|
_: 1
|
|
1730
1790
|
}, 8, ["onClick"])) : $("", !0)
|
|
1731
1791
|
])
|
|
1732
1792
|
]))), 128))
|
|
1733
|
-
])) : (
|
|
1793
|
+
])) : (u(), M(F, {
|
|
1734
1794
|
key: 0,
|
|
1735
1795
|
description: "暂无 AI 任务",
|
|
1736
1796
|
"image-size": 64
|
|
1737
1797
|
}))
|
|
1738
1798
|
]),
|
|
1739
|
-
w(o).tasks.some((
|
|
1740
|
-
|
|
1799
|
+
w(o).tasks.some((f) => f.status !== "running" && f.status !== "pending") ? (u(), E("div", Go, [
|
|
1800
|
+
m(V, {
|
|
1741
1801
|
link: "",
|
|
1742
1802
|
type: "info",
|
|
1743
|
-
onClick: r[3] || (r[3] = (
|
|
1803
|
+
onClick: r[3] || (r[3] = (f) => w(o).clearFinished())
|
|
1744
1804
|
}, {
|
|
1745
|
-
default:
|
|
1746
|
-
|
|
1805
|
+
default: g(() => [...r[9] || (r[9] = [
|
|
1806
|
+
G("清除已完成", -1)
|
|
1747
1807
|
])]),
|
|
1748
1808
|
_: 1
|
|
1749
1809
|
})
|
|
1750
1810
|
])) : $("", !0)
|
|
1751
1811
|
], 512), [
|
|
1752
|
-
[
|
|
1812
|
+
[De, w(o).panelVisible && !w(o).panelMinimized]
|
|
1753
1813
|
])
|
|
1754
1814
|
]),
|
|
1755
1815
|
_: 1
|
|
1756
1816
|
}),
|
|
1757
|
-
_e(
|
|
1817
|
+
_e(T("div", {
|
|
1758
1818
|
class: "ai-task-panel-mini",
|
|
1759
|
-
onClick: r[4] || (r[4] = (
|
|
1819
|
+
onClick: r[4] || (r[4] = (f) => w(o).toggleMinimize())
|
|
1760
1820
|
}, [
|
|
1761
|
-
w(o).activeCount > 0 ? (
|
|
1821
|
+
w(o).activeCount > 0 ? (u(), M(C, {
|
|
1762
1822
|
key: 0,
|
|
1763
1823
|
class: "spinning"
|
|
1764
1824
|
}, {
|
|
1765
|
-
default:
|
|
1766
|
-
|
|
1825
|
+
default: g(() => [
|
|
1826
|
+
m(w(lt))
|
|
1767
1827
|
]),
|
|
1768
1828
|
_: 1
|
|
1769
1829
|
})) : $("", !0),
|
|
1770
|
-
|
|
1771
|
-
w(o).runningCount > 0 ? (
|
|
1830
|
+
T("span", null, D(w(o).panelSubtitle), 1),
|
|
1831
|
+
w(o).runningCount > 0 ? (u(), M(O, {
|
|
1772
1832
|
key: 1,
|
|
1773
1833
|
value: w(o).runningCount,
|
|
1774
1834
|
class: "m-l-8"
|
|
1775
1835
|
}, null, 8, ["value"])) : $("", !0)
|
|
1776
1836
|
], 512), [
|
|
1777
|
-
[
|
|
1837
|
+
[De, w(o).panelVisible && w(o).panelMinimized]
|
|
1778
1838
|
])
|
|
1779
1839
|
]);
|
|
1780
1840
|
};
|
|
1781
1841
|
}
|
|
1782
|
-
}),
|
|
1842
|
+
}), qo = /* @__PURE__ */ Ee(Wo, [["__scopeId", "data-v-812b3127"]]), il = /* @__PURE__ */ de({
|
|
1783
1843
|
__name: "AiTaskProvider",
|
|
1784
1844
|
props: {
|
|
1785
1845
|
title: {},
|
|
@@ -1802,10 +1862,10 @@ const ho = { class: "ai-use-dialog__footer" }, yo = { class: "ai-use-dialog__foo
|
|
|
1802
1862
|
},
|
|
1803
1863
|
emits: ["finish", "use"],
|
|
1804
1864
|
setup(e, { emit: n }) {
|
|
1805
|
-
const t = e, o = n,
|
|
1806
|
-
|
|
1807
|
-
const
|
|
1808
|
-
const
|
|
1865
|
+
const t = e, o = n, s = Mt();
|
|
1866
|
+
Be(bt, s), Be(xt, St(s));
|
|
1867
|
+
const d = P(() => {
|
|
1868
|
+
const y = {
|
|
1809
1869
|
title: t.title,
|
|
1810
1870
|
freeText: t.freeText,
|
|
1811
1871
|
promptId: t.promptId,
|
|
@@ -1822,61 +1882,61 @@ const ho = { class: "ai-use-dialog__footer" }, yo = { class: "ai-use-dialog__foo
|
|
|
1822
1882
|
taskListButtonText: t.taskListButtonText,
|
|
1823
1883
|
width: t.width
|
|
1824
1884
|
};
|
|
1825
|
-
return t.modelValue !== void 0 && (
|
|
1885
|
+
return t.modelValue !== void 0 && (y.modelValue = t.modelValue), y;
|
|
1826
1886
|
});
|
|
1827
|
-
let
|
|
1828
|
-
function
|
|
1829
|
-
o("use",
|
|
1887
|
+
let v;
|
|
1888
|
+
function _(y) {
|
|
1889
|
+
o("use", y);
|
|
1830
1890
|
}
|
|
1831
|
-
return
|
|
1832
|
-
|
|
1833
|
-
}),
|
|
1834
|
-
|
|
1835
|
-
}), (
|
|
1836
|
-
e.showDialog !== !1 ? (
|
|
1837
|
-
|
|
1838
|
-
|
|
1891
|
+
return Ke(() => {
|
|
1892
|
+
s.hydrate(), v = s.onTaskFinish((y) => o("finish", y));
|
|
1893
|
+
}), Ne(() => {
|
|
1894
|
+
v == null || v();
|
|
1895
|
+
}), (y, r) => (u(), E(re, null, [
|
|
1896
|
+
e.showDialog !== !1 ? (u(), M(Eo, ft(ze({ key: 0 }, d.value)), null, 16)) : $("", !0),
|
|
1897
|
+
m(qo, { onUse: _ }),
|
|
1898
|
+
ye(y.$slots, "default")
|
|
1839
1899
|
], 64));
|
|
1840
1900
|
}
|
|
1841
1901
|
});
|
|
1842
|
-
function
|
|
1843
|
-
const e =
|
|
1844
|
-
return e ||
|
|
1902
|
+
function sl() {
|
|
1903
|
+
const e = Ye(xt, null);
|
|
1904
|
+
return e || St(We());
|
|
1845
1905
|
}
|
|
1846
|
-
function
|
|
1906
|
+
function Ho() {
|
|
1847
1907
|
const e = b(!1), n = b({});
|
|
1848
1908
|
let t = null;
|
|
1849
|
-
function o(
|
|
1850
|
-
t == null || t.resolve(
|
|
1909
|
+
function o(_) {
|
|
1910
|
+
t == null || t.resolve(_), t = null;
|
|
1851
1911
|
}
|
|
1852
|
-
function
|
|
1853
|
-
t == null || t.reject(new
|
|
1912
|
+
function s() {
|
|
1913
|
+
t == null || t.reject(new be()), t = null;
|
|
1854
1914
|
}
|
|
1855
|
-
function
|
|
1856
|
-
t && (t.reject(new
|
|
1857
|
-
const
|
|
1858
|
-
t = { resolve: r, reject:
|
|
1915
|
+
function d(_ = {}) {
|
|
1916
|
+
t && (t.reject(new be()), t = null);
|
|
1917
|
+
const y = new Promise((r, C) => {
|
|
1918
|
+
t = { resolve: r, reject: C };
|
|
1859
1919
|
});
|
|
1860
|
-
return n.value = { ...
|
|
1920
|
+
return n.value = { ..._ }, e.value = !0, y;
|
|
1861
1921
|
}
|
|
1862
|
-
function
|
|
1922
|
+
function v() {
|
|
1863
1923
|
e.value = !1;
|
|
1864
1924
|
}
|
|
1865
1925
|
return {
|
|
1866
1926
|
dialogVisible: e,
|
|
1867
1927
|
dialogOptions: n,
|
|
1868
|
-
openImageSelector:
|
|
1869
|
-
closeImageSelector:
|
|
1928
|
+
openImageSelector: d,
|
|
1929
|
+
closeImageSelector: v,
|
|
1870
1930
|
settlePendingConfirm: o,
|
|
1871
|
-
settlePendingCancel:
|
|
1931
|
+
settlePendingCancel: s
|
|
1872
1932
|
};
|
|
1873
1933
|
}
|
|
1874
|
-
const
|
|
1875
|
-
function
|
|
1934
|
+
const Jo = "__YC_IMAGE_SELECTOR_CTX_KEY__";
|
|
1935
|
+
function Xo(e) {
|
|
1876
1936
|
const n = globalThis;
|
|
1877
1937
|
return n[e] || (n[e] = Symbol(e)), n[e];
|
|
1878
1938
|
}
|
|
1879
|
-
const
|
|
1939
|
+
const Pt = Xo(Jo), rl = /* @__PURE__ */ de({
|
|
1880
1940
|
__name: "YcImageSelectorProvider",
|
|
1881
1941
|
props: {
|
|
1882
1942
|
modelValue: { type: [Boolean, null] },
|
|
@@ -1896,111 +1956,114 @@ const kt = zo(No), Zo = /* @__PURE__ */ ce({
|
|
|
1896
1956
|
confirmText: { default: "确定" },
|
|
1897
1957
|
cancelText: { default: "取消" },
|
|
1898
1958
|
emptyText: { default: "暂无图片资源" },
|
|
1959
|
+
renderEmpty: {},
|
|
1899
1960
|
getImages: {},
|
|
1900
1961
|
upload: {},
|
|
1901
1962
|
urlField: { default: "url" },
|
|
1902
1963
|
showDialog: { type: Boolean, default: !0 }
|
|
1903
1964
|
},
|
|
1904
1965
|
setup(e, { expose: n }) {
|
|
1905
|
-
const t = e, o =
|
|
1906
|
-
dialogVisible:
|
|
1907
|
-
dialogOptions:
|
|
1908
|
-
openImageSelector:
|
|
1909
|
-
closeImageSelector:
|
|
1910
|
-
settlePendingConfirm:
|
|
1966
|
+
const t = e, o = Ho(), {
|
|
1967
|
+
dialogVisible: s,
|
|
1968
|
+
dialogOptions: d,
|
|
1969
|
+
openImageSelector: v,
|
|
1970
|
+
closeImageSelector: _,
|
|
1971
|
+
settlePendingConfirm: y,
|
|
1911
1972
|
settlePendingCancel: r
|
|
1912
1973
|
} = o;
|
|
1913
|
-
|
|
1914
|
-
function
|
|
1915
|
-
return
|
|
1974
|
+
Be(Pt, o);
|
|
1975
|
+
function C(O, f) {
|
|
1976
|
+
return O in d.value ? d.value[O] : f;
|
|
1916
1977
|
}
|
|
1917
|
-
const
|
|
1918
|
-
title:
|
|
1919
|
-
multiple:
|
|
1920
|
-
maxCount:
|
|
1921
|
-
selected:
|
|
1978
|
+
const V = P(() => ({
|
|
1979
|
+
title: C("title", t.title),
|
|
1980
|
+
multiple: C("multiple", t.multiple),
|
|
1981
|
+
maxCount: C("maxCount", t.maxCount),
|
|
1982
|
+
selected: C("selected", t.selected),
|
|
1922
1983
|
width: t.width,
|
|
1923
1984
|
pageSize: t.pageSize,
|
|
1924
1985
|
showUpload: t.showUpload,
|
|
1925
1986
|
accept: t.accept,
|
|
1926
|
-
showCategories:
|
|
1927
|
-
categories:
|
|
1928
|
-
categoryAllLabel:
|
|
1929
|
-
showModeSwitch:
|
|
1930
|
-
confirmOnSelect:
|
|
1987
|
+
showCategories: C("showCategories", t.showCategories),
|
|
1988
|
+
categories: C("categories", t.categories),
|
|
1989
|
+
categoryAllLabel: C("categoryAllLabel", t.categoryAllLabel),
|
|
1990
|
+
showModeSwitch: C("showModeSwitch", t.showModeSwitch),
|
|
1991
|
+
confirmOnSelect: C("confirmOnSelect", t.confirmOnSelect),
|
|
1931
1992
|
confirmText: t.confirmText,
|
|
1932
1993
|
cancelText: t.cancelText,
|
|
1933
1994
|
emptyText: t.emptyText,
|
|
1995
|
+
renderEmpty: t.renderEmpty,
|
|
1934
1996
|
getImages: t.getImages,
|
|
1935
1997
|
upload: t.upload,
|
|
1936
1998
|
urlField: t.urlField
|
|
1937
1999
|
}));
|
|
1938
|
-
function
|
|
1939
|
-
var
|
|
1940
|
-
(
|
|
2000
|
+
function F(O) {
|
|
2001
|
+
var f, L;
|
|
2002
|
+
(L = (f = d.value).onConfirm) == null || L.call(f, O), y(O), _();
|
|
1941
2003
|
}
|
|
1942
|
-
function
|
|
1943
|
-
var
|
|
1944
|
-
(
|
|
2004
|
+
function X() {
|
|
2005
|
+
var O, f;
|
|
2006
|
+
(f = (O = d.value).onCancel) == null || f.call(O), r(), _();
|
|
1945
2007
|
}
|
|
1946
|
-
return n({ openImageSelector:
|
|
1947
|
-
e.showDialog !== !1 ? (
|
|
2008
|
+
return n({ openImageSelector: v, closeImageSelector: _ }), (O, f) => (u(), E(re, null, [
|
|
2009
|
+
e.showDialog !== !1 ? (u(), M(Tt, ze({
|
|
1948
2010
|
key: 0,
|
|
1949
|
-
modelValue: w(
|
|
1950
|
-
"onUpdate:modelValue":
|
|
1951
|
-
},
|
|
1952
|
-
onConfirm:
|
|
1953
|
-
onCancel:
|
|
2011
|
+
modelValue: w(s),
|
|
2012
|
+
"onUpdate:modelValue": f[0] || (f[0] = (L) => Xt(s) ? s.value = L : null)
|
|
2013
|
+
}, V.value, {
|
|
2014
|
+
onConfirm: F,
|
|
2015
|
+
onCancel: X
|
|
1954
2016
|
}), null, 16, ["modelValue"])) : $("", !0),
|
|
1955
|
-
|
|
2017
|
+
ye(O.$slots, "default")
|
|
1956
2018
|
], 64));
|
|
1957
2019
|
}
|
|
1958
2020
|
});
|
|
1959
|
-
function
|
|
1960
|
-
const e =
|
|
2021
|
+
function ul() {
|
|
2022
|
+
const e = Ye(Pt, null);
|
|
1961
2023
|
return e ? {
|
|
1962
2024
|
openImageSelector: (n = {}) => e.openImageSelector(n),
|
|
1963
2025
|
closeImageSelector: () => e.closeImageSelector()
|
|
1964
2026
|
} : {
|
|
1965
|
-
openImageSelector:
|
|
1966
|
-
closeImageSelector:
|
|
2027
|
+
openImageSelector: wt,
|
|
2028
|
+
closeImageSelector: yt
|
|
1967
2029
|
};
|
|
1968
2030
|
}
|
|
1969
2031
|
export {
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
Ho as
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2032
|
+
qo as AiTaskPanel,
|
|
2033
|
+
il as AiTaskProvider,
|
|
2034
|
+
Eo as AiUseDialog,
|
|
2035
|
+
Pt as IMAGE_SELECTOR_INJECT_KEY,
|
|
2036
|
+
at as ImageSelectorAuthError,
|
|
2037
|
+
be as ImageSelectorCancelledError,
|
|
2038
|
+
Tt as ImageSelectorDialog,
|
|
2039
|
+
rl as ImageSelectorProvider,
|
|
2040
|
+
rt as SkyPageWindow,
|
|
2041
|
+
qo as YcAiTaskPanel,
|
|
2042
|
+
il as YcAiTaskProvider,
|
|
2043
|
+
Eo as YcAiUseDialog,
|
|
2044
|
+
ll as YcComponent,
|
|
2045
|
+
Tt as YcImageSelectorDialog,
|
|
2046
|
+
rl as YcImageSelectorProvider,
|
|
2047
|
+
rt as YcPageWindow,
|
|
2048
|
+
yt as closeImageSelector,
|
|
2049
|
+
Ho as createImageSelectorApi,
|
|
2050
|
+
ll as default,
|
|
2051
|
+
jn as fetchImages,
|
|
2052
|
+
vt as getAiTaskConfig,
|
|
2053
|
+
Ae as getImageSelectorConfig,
|
|
2054
|
+
Ct as hideAiDialog,
|
|
2055
|
+
_t as hideImageSelectorDialog,
|
|
2056
|
+
Hn as installImageSelector,
|
|
2057
|
+
no as installYcComponent,
|
|
2058
|
+
ko as listPrompts,
|
|
2059
|
+
al as openAiUseDialog,
|
|
2060
|
+
wt as openImageSelector,
|
|
2061
|
+
dn as setAiTaskConfig,
|
|
2062
|
+
gn as setImageSelectorConfig,
|
|
2063
|
+
Ge as showAiDialog,
|
|
2064
|
+
yn as showImageSelectorDialog,
|
|
2065
|
+
Gn as uploadImage,
|
|
2066
|
+
sl as useAiTask,
|
|
2067
|
+
Mt as useAiTaskStore,
|
|
2068
|
+
ul as useImageSelector
|
|
2006
2069
|
};
|