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