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