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