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