yc-component 0.1.8 → 0.1.9

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.
Files changed (65) hide show
  1. package/dist/image-selector/api/images.d.ts +6 -0
  2. package/dist/image-selector/api/images.d.ts.map +1 -0
  3. package/dist/image-selector/components/YcImageSelectorDialog.d.ts +28 -0
  4. package/dist/image-selector/components/YcImageSelectorDialog.d.ts.map +1 -0
  5. package/dist/image-selector/components/YcImageSelectorProvider.d.ts +42 -0
  6. package/dist/image-selector/components/YcImageSelectorProvider.d.ts.map +1 -0
  7. package/dist/image-selector/composables/useImageSelector.d.ts +10 -0
  8. package/dist/image-selector/composables/useImageSelector.d.ts.map +1 -0
  9. package/dist/image-selector/config.d.ts +12 -0
  10. package/dist/image-selector/config.d.ts.map +1 -0
  11. package/dist/image-selector/context.d.ts +60 -0
  12. package/dist/image-selector/context.d.ts.map +1 -0
  13. package/dist/image-selector/dialog-state.d.ts +39 -0
  14. package/dist/image-selector/dialog-state.d.ts.map +1 -0
  15. package/dist/image-selector/index.d.ts +15 -0
  16. package/dist/image-selector/index.d.ts.map +1 -0
  17. package/dist/image-selector/inject.d.ts +59 -0
  18. package/dist/image-selector/inject.d.ts.map +1 -0
  19. package/dist/image-selector/types/index.d.ts +84 -0
  20. package/dist/image-selector/types/index.d.ts.map +1 -0
  21. package/dist/index.css +1 -0
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/plugin.d.ts +2 -0
  25. package/dist/plugin.d.ts.map +1 -1
  26. package/dist/yc-component.cjs.full.js +50 -0
  27. package/dist/yc-component.cjs.js +5 -0
  28. package/dist/yc-component.esm.full.js +12216 -0
  29. package/dist/yc-component.esm.js +1931 -0
  30. package/dist/yc-component.umd.full.js +112 -0
  31. package/dist/yc-component.umd.full.min.js +1 -0
  32. package/dist/yc-component.umd.js +6 -0
  33. package/dist/yc-component.umd.min.js +1 -0
  34. package/package.json +32 -6
  35. package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
  36. package/dist/ai-task/api/http.js +0 -47
  37. package/dist/ai-task/api/prompt.js +0 -9
  38. package/dist/ai-task/api/workflow.js +0 -15
  39. package/dist/ai-task/components/AiTaskPanel.css +0 -1
  40. package/dist/ai-task/components/AiTaskPanel.vue.js +0 -7
  41. package/dist/ai-task/components/AiTaskPanel.vue2.js +0 -248
  42. package/dist/ai-task/components/AiTaskProvider.vue.js +0 -69
  43. package/dist/ai-task/components/AiTaskProvider.vue2.js +0 -4
  44. package/dist/ai-task/components/AiUseDialog.css +0 -1
  45. package/dist/ai-task/components/AiUseDialog.vue.js +0 -7
  46. package/dist/ai-task/components/AiUseDialog.vue2.js +0 -248
  47. package/dist/ai-task/composables/useAiTask.js +0 -11
  48. package/dist/ai-task/config.js +0 -23
  49. package/dist/ai-task/context.js +0 -42
  50. package/dist/ai-task/dialog-state.js +0 -28
  51. package/dist/ai-task/index.js +0 -24
  52. package/dist/ai-task/inject.js +0 -10
  53. package/dist/ai-task/services/taskRunner.js +0 -60
  54. package/dist/ai-task/store/useAiTaskStore.js +0 -230
  55. package/dist/ai-task/style.css +0 -3
  56. package/dist/ai-task/useScopedStore.js +0 -10
  57. package/dist/ai-task/utils/runClientScript.js +0 -26
  58. package/dist/ai-task/utils/storage.js +0 -45
  59. package/dist/index.js +0 -31
  60. package/dist/page-window/YcPageWindow.css +0 -1
  61. package/dist/page-window/YcPageWindow.vue.js +0 -7
  62. package/dist/page-window/YcPageWindow.vue2.js +0 -230
  63. package/dist/page-window/index.js +0 -5
  64. package/dist/page-window/style.css +0 -1
  65. package/dist/plugin.js +0 -19
@@ -1,248 +0,0 @@
1
- import { defineComponent as x, ref as V, resolveComponent as k, openBlock as s, createBlock as r, Teleport as B, createVNode as a, Transition as D, withCtx as o, withDirectives as y, createElementVNode as l, normalizeClass as L, unref as n, toDisplayString as p, createTextVNode as v, createCommentVNode as u, createElementBlock as m, Fragment as M, renderList as N, vShow as C } from "vue";
2
- import { Refresh as w, ArrowDown as R, Close as E, CircleCheck as F, CircleClose as P, Remove as U } from "@element-plus/icons-vue";
3
- import { useScopedAiTaskStore as j } from "../useScopedStore.js";
4
- const q = { class: "ai-task-panel" }, G = { class: "ai-task-panel__header" }, H = { class: "ai-task-panel__header-left" }, J = { class: "ai-task-panel__titles" }, K = { class: "ai-task-panel__subtitle" }, O = { class: "ai-task-panel__title" }, Q = { class: "ai-task-panel__header-actions" }, W = { class: "ai-task-panel__body" }, X = {
5
- key: 1,
6
- class: "ai-task-list"
7
- }, Y = { class: "ai-task-row__icon" }, Z = { class: "ai-task-row__main" }, ee = { class: "ai-task-row__title" }, ne = { class: "ai-task-row__meta" }, te = { key: 0 }, ie = {
8
- key: 0,
9
- class: "ai-task-row__summary"
10
- }, se = { class: "ai-task-row__ops" }, le = {
11
- key: 0,
12
- class: "ai-task-panel__footer"
13
- }, ue = /* @__PURE__ */ x({
14
- __name: "AiTaskPanel",
15
- emits: ["use"],
16
- setup(oe, { emit: h }) {
17
- const T = h, t = j(), f = V(null), b = {
18
- pending: "等待中",
19
- running: "执行中",
20
- succeeded: "已完成",
21
- failed: "失败",
22
- cancelled: "已取消"
23
- };
24
- function I(d) {
25
- return b[d] ?? d;
26
- }
27
- async function z(d) {
28
- f.value = d.id;
29
- try {
30
- const i = d.result ?? await t.loadTaskResult(d.id);
31
- if (!i) return;
32
- T("use", {
33
- taskId: d.id,
34
- runId: d.runId,
35
- title: d.title,
36
- freeText: d.freeText,
37
- promptId: d.promptId,
38
- result: i,
39
- finishedAt: d.finishedAt ?? Date.now()
40
- });
41
- } finally {
42
- f.value = null;
43
- }
44
- }
45
- return (d, i) => {
46
- const _ = k("el-icon"), c = k("el-button"), A = k("el-empty"), S = k("el-progress"), $ = k("el-badge");
47
- return s(), r(B, { to: "body" }, [
48
- a(D, { name: "ai-panel-slide" }, {
49
- default: o(() => [
50
- y(l("div", q, [
51
- l("div", G, [
52
- l("div", H, [
53
- l("div", {
54
- class: L(["ai-task-panel__icon", { spinning: n(t).activeCount > 0 }])
55
- }, [
56
- a(_, null, {
57
- default: o(() => [
58
- a(n(w))
59
- ]),
60
- _: 1
61
- })
62
- ], 2),
63
- l("div", J, [
64
- l("div", K, p(n(t).panelSubtitle), 1),
65
- l("div", O, p(n(t).panelTitle), 1)
66
- ])
67
- ]),
68
- l("div", Q, [
69
- n(t).runningCount > 0 ? (s(), r(c, {
70
- key: 0,
71
- link: "",
72
- type: "primary",
73
- onClick: i[0] || (i[0] = (e) => n(t).cancelAll())
74
- }, {
75
- default: o(() => [...i[5] || (i[5] = [
76
- v(" 取消全部 ", -1)
77
- ])]),
78
- _: 1
79
- })) : u("", !0),
80
- a(c, {
81
- link: "",
82
- onClick: i[1] || (i[1] = (e) => n(t).toggleMinimize())
83
- }, {
84
- default: o(() => [
85
- a(_, null, {
86
- default: o(() => [
87
- a(n(R))
88
- ]),
89
- _: 1
90
- })
91
- ]),
92
- _: 1
93
- }),
94
- a(c, {
95
- link: "",
96
- onClick: i[2] || (i[2] = (e) => n(t).hidePanel())
97
- }, {
98
- default: o(() => [
99
- a(_, null, {
100
- default: o(() => [
101
- a(n(E))
102
- ]),
103
- _: 1
104
- })
105
- ]),
106
- _: 1
107
- })
108
- ])
109
- ]),
110
- l("div", W, [
111
- n(t).tasks.length ? (s(), m("div", X, [
112
- (s(!0), m(M, null, N(n(t).tasks, (e) => (s(), m("div", {
113
- key: e.id,
114
- class: "ai-task-row"
115
- }, [
116
- l("div", Y, [
117
- e.status === "succeeded" ? (s(), r(_, {
118
- key: 0,
119
- class: "ok"
120
- }, {
121
- default: o(() => [
122
- a(n(F))
123
- ]),
124
- _: 1
125
- })) : e.status === "failed" ? (s(), r(_, {
126
- key: 1,
127
- class: "err"
128
- }, {
129
- default: o(() => [
130
- a(n(P))
131
- ]),
132
- _: 1
133
- })) : e.status === "running" || e.status === "pending" ? (s(), r(S, {
134
- key: 2,
135
- type: "circle",
136
- percentage: e.progress,
137
- width: 36,
138
- "stroke-width": 3
139
- }, null, 8, ["percentage"])) : (s(), r(_, {
140
- key: 3,
141
- class: "muted"
142
- }, {
143
- default: o(() => [
144
- a(n(U))
145
- ]),
146
- _: 1
147
- }))
148
- ]),
149
- l("div", Z, [
150
- l("div", ee, p(e.title), 1),
151
- l("div", ne, [
152
- l("span", null, p(I(e.status)), 1),
153
- e.runId ? (s(), m("span", te, " · #" + p(e.runId), 1)) : u("", !0)
154
- ]),
155
- e.summary ? (s(), m("div", ie, p(e.summary), 1)) : u("", !0)
156
- ]),
157
- l("div", se, [
158
- e.status === "running" || e.status === "pending" ? (s(), r(c, {
159
- key: 0,
160
- link: "",
161
- type: "danger",
162
- size: "small",
163
- onClick: (g) => n(t).cancelTask(e.id)
164
- }, {
165
- default: o(() => [...i[6] || (i[6] = [
166
- v(" 取消 ", -1)
167
- ])]),
168
- _: 1
169
- }, 8, ["onClick"])) : u("", !0),
170
- e.status === "succeeded" && e.runId ? (s(), r(c, {
171
- key: 1,
172
- link: "",
173
- type: "primary",
174
- size: "small",
175
- loading: f.value === e.id,
176
- onClick: (g) => z(e)
177
- }, {
178
- default: o(() => [...i[7] || (i[7] = [
179
- v(" 使用 ", -1)
180
- ])]),
181
- _: 1
182
- }, 8, ["loading", "onClick"])) : u("", !0),
183
- e.status !== "running" && e.status !== "pending" ? (s(), r(c, {
184
- key: 2,
185
- link: "",
186
- size: "small",
187
- onClick: (g) => n(t).removeTask(e.id)
188
- }, {
189
- default: o(() => [...i[8] || (i[8] = [
190
- v(" 移除 ", -1)
191
- ])]),
192
- _: 1
193
- }, 8, ["onClick"])) : u("", !0)
194
- ])
195
- ]))), 128))
196
- ])) : (s(), r(A, {
197
- key: 0,
198
- description: "暂无 AI 任务",
199
- "image-size": 64
200
- }))
201
- ]),
202
- n(t).tasks.some((e) => e.status !== "running" && e.status !== "pending") ? (s(), m("div", le, [
203
- a(c, {
204
- link: "",
205
- type: "info",
206
- onClick: i[3] || (i[3] = (e) => n(t).clearFinished())
207
- }, {
208
- default: o(() => [...i[9] || (i[9] = [
209
- v("清除已完成", -1)
210
- ])]),
211
- _: 1
212
- })
213
- ])) : u("", !0)
214
- ], 512), [
215
- [C, n(t).panelVisible && !n(t).panelMinimized]
216
- ])
217
- ]),
218
- _: 1
219
- }),
220
- y(l("div", {
221
- class: "ai-task-panel-mini",
222
- onClick: i[4] || (i[4] = (e) => n(t).toggleMinimize())
223
- }, [
224
- n(t).activeCount > 0 ? (s(), r(_, {
225
- key: 0,
226
- class: "spinning"
227
- }, {
228
- default: o(() => [
229
- a(n(w))
230
- ]),
231
- _: 1
232
- })) : u("", !0),
233
- l("span", null, p(n(t).panelSubtitle), 1),
234
- n(t).runningCount > 0 ? (s(), r($, {
235
- key: 1,
236
- value: n(t).runningCount,
237
- class: "m-l-8"
238
- }, null, 8, ["value"])) : u("", !0)
239
- ], 512), [
240
- [C, n(t).panelVisible && n(t).panelMinimized]
241
- ])
242
- ]);
243
- };
244
- }
245
- });
246
- export {
247
- ue as default
248
- };
@@ -1,69 +0,0 @@
1
- import { defineComponent as u, provide as l, computed as c, onMounted as h, onUnmounted as d, openBlock as i, createElementBlock as T, Fragment as f, createBlock as k, normalizeProps as x, mergeProps as B, createCommentVNode as L, createVNode as w, renderSlot as b } from "vue";
2
- import { createAiTaskApi as A } from "../context.js";
3
- import { AI_TASK_STORE_KEY as P, AI_TASK_INJECT_KEY as M } from "../inject.js";
4
- import { useAiTaskStore as _ } from "../store/useAiTaskStore.js";
5
- import y from "./AiUseDialog.vue.js";
6
- import S from "./AiTaskPanel.vue.js";
7
- const C = /* @__PURE__ */ u({
8
- __name: "AiTaskProvider",
9
- props: {
10
- title: {},
11
- freeText: {},
12
- promptId: {},
13
- autoMatch: { type: Boolean },
14
- prompts: {},
15
- showAutoMatch: { type: Boolean },
16
- showPromptSelect: { type: Boolean },
17
- autoMatchLabel: {},
18
- promptLabel: {},
19
- freeTextLabel: {},
20
- freeTextPlaceholder: {},
21
- submitText: {},
22
- showTaskListButton: { type: Boolean },
23
- taskListButtonText: {},
24
- width: {},
25
- modelValue: { type: Boolean },
26
- showDialog: { type: Boolean, default: !0 }
27
- },
28
- emits: ["finish", "use"],
29
- setup(r, { emit: n }) {
30
- const e = r, s = n, o = _();
31
- l(P, o), l(M, A(o));
32
- const m = c(() => {
33
- const t = {
34
- title: e.title,
35
- freeText: e.freeText,
36
- promptId: e.promptId,
37
- autoMatch: e.autoMatch,
38
- prompts: e.prompts,
39
- showAutoMatch: e.showAutoMatch,
40
- showPromptSelect: e.showPromptSelect,
41
- autoMatchLabel: e.autoMatchLabel,
42
- promptLabel: e.promptLabel,
43
- freeTextLabel: e.freeTextLabel,
44
- freeTextPlaceholder: e.freeTextPlaceholder,
45
- submitText: e.submitText,
46
- showTaskListButton: e.showTaskListButton,
47
- taskListButtonText: e.taskListButtonText,
48
- width: e.width
49
- };
50
- return e.modelValue !== void 0 && (t.modelValue = e.modelValue), t;
51
- });
52
- let a;
53
- function p(t) {
54
- s("use", t);
55
- }
56
- return h(() => {
57
- o.hydrate(), a = o.onTaskFinish((t) => s("finish", t));
58
- }), d(() => {
59
- a == null || a();
60
- }), (t, g) => (i(), T(f, null, [
61
- r.showDialog !== !1 ? (i(), k(y, x(B({ key: 0 }, m.value)), null, 16)) : L("", !0),
62
- w(S, { onUse: p }),
63
- b(t.$slots, "default")
64
- ], 64));
65
- }
66
- });
67
- export {
68
- C as default
69
- };
@@ -1,4 +0,0 @@
1
- import f from "./AiTaskProvider.vue.js";
2
- export {
3
- f as default
4
- };
@@ -1 +0,0 @@
1
- .ai-use-dialog[data-v-9aa82e83] .el-overlay{z-index:4000}.ai-use-dialog[data-v-9aa82e83] .el-dialog{z-index:4001}.ai-use-dialog[data-v-9aa82e83] .el-dialog__body{padding-top:8px}.ai-use-dialog__footer[data-v-9aa82e83]{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%}.ai-use-dialog__footer-actions[data-v-9aa82e83]{display:flex;align-items:center;gap:8px;margin-left:auto}
@@ -1,7 +0,0 @@
1
- import o from "./AiUseDialog.vue2.js";
2
- /* empty css */
3
- import a from "../../_virtual/_plugin-vue_export-helper.js";
4
- const i = /* @__PURE__ */ a(o, [["__scopeId", "data-v-9aa82e83"]]);
5
- export {
6
- i as default
7
- };
@@ -1,248 +0,0 @@
1
- import { defineComponent as K, computed as O, ref as v, watch as g, onMounted as Q, onUnmounted as R, resolveComponent as d, openBlock as h, createBlock as b, withCtx as i, createVNode as m, createCommentVNode as _, createElementBlock as W, Fragment as X, renderList as Y, createElementVNode as S, createTextVNode as L, toDisplayString as E } from "vue";
2
- import { ElMessage as M } from "element-plus";
3
- import { aiDialogState as p, hideAiDialog as Z, AI_DIALOG_OPEN_EVENT as D } from "../dialog-state.js";
4
- import { listPrompts as ee } from "../api/prompt.js";
5
- import { getAiTaskConfig as te } from "../config.js";
6
- import { useScopedAiTaskStore as oe } from "../useScopedStore.js";
7
- const le = { class: "ai-use-dialog__footer" }, ae = { class: "ai-use-dialog__footer-actions" }, me = /* @__PURE__ */ K({
8
- __name: "AiUseDialog",
9
- props: {
10
- title: { default: "AI 生成" },
11
- freeText: { default: "" },
12
- promptId: {},
13
- autoMatch: { type: Boolean, default: !1 },
14
- prompts: {},
15
- showAutoMatch: { type: Boolean, default: !1 },
16
- showPromptSelect: { type: Boolean, default: !1 },
17
- autoMatchLabel: { default: "自动匹配提示词" },
18
- promptLabel: { default: "提示词" },
19
- freeTextLabel: { default: "需求描述" },
20
- freeTextPlaceholder: { default: "描述要生成的页面或项目 JSON" },
21
- submitText: { default: "发送" },
22
- showTaskListButton: { type: Boolean, default: !0 },
23
- taskListButtonText: { default: "查看 AI 任务" },
24
- width: { default: "520px" },
25
- modelValue: { type: Boolean },
26
- showDialog: { type: Boolean }
27
- },
28
- emits: ["update:modelValue", "submitted"],
29
- setup(u, { emit: N }) {
30
- const o = u, A = N, P = oe(), r = O(() => o.modelValue !== void 0), n = v(!1);
31
- g(
32
- () => o.modelValue,
33
- (e) => {
34
- r.value && (n.value = !!e);
35
- },
36
- { immediate: !0 }
37
- ), g(n, (e) => {
38
- if (r.value) {
39
- A("update:modelValue", e);
40
- return;
41
- }
42
- p.visible = e, e || Z();
43
- }), g(
44
- () => p.visible,
45
- (e) => {
46
- r.value || (n.value = e);
47
- },
48
- { immediate: !0 }
49
- );
50
- function B(e) {
51
- if (r.value) return;
52
- const t = e.detail ?? {};
53
- V(t), n.value = !0;
54
- }
55
- Q(() => {
56
- globalThis.addEventListener(D, B), r.value || (n.value = p.visible);
57
- }), R(() => {
58
- globalThis.removeEventListener(D, B);
59
- });
60
- const U = O(
61
- () => (r.value ? void 0 : p.options.title) ?? o.title ?? "AI 生成"
62
- ), l = v({
63
- freeText: o.freeText,
64
- promptId: o.promptId,
65
- autoMatch: o.autoMatch
66
- }), f = v(o.prompts ? [...o.prompts] : []), y = v(!1), T = v(!1), C = v();
67
- function V(e) {
68
- var t, s;
69
- l.value.freeText = e.freeText ?? o.freeText ?? "", l.value.promptId = e.promptId ?? o.promptId, l.value.autoMatch = e.autoMatch ?? o.autoMatch ?? !1, C.value = e.onFinish, (t = e.prompts) != null && t.length ? f.value = [...e.prompts] : (s = o.prompts) != null && s.length && (f.value = [...o.prompts]);
70
- }
71
- async function F() {
72
- if (!(f.value.length > 0)) {
73
- y.value = !0;
74
- try {
75
- const e = te().listPrompts;
76
- f.value = e ? await e() : await ee();
77
- } catch {
78
- M.warning("加载提示词失败");
79
- } finally {
80
- y.value = !1;
81
- }
82
- }
83
- }
84
- function q() {
85
- r.value ? V({}) : V(p.options), o.showPromptSelect && F();
86
- }
87
- g(
88
- () => o.prompts,
89
- (e) => {
90
- e != null && e.length && (f.value = [...e]);
91
- },
92
- { deep: !0 }
93
- ), g(
94
- () => [o.freeText, o.promptId, o.autoMatch],
95
- ([e, t, s]) => {
96
- n.value || (l.value.freeText = e ?? "", l.value.promptId = t, l.value.autoMatch = s ?? !1);
97
- }
98
- );
99
- function G() {
100
- l.value.autoMatch && (l.value.promptId = void 0);
101
- }
102
- function J() {
103
- T.value = !1;
104
- }
105
- function $() {
106
- P.showPanel();
107
- }
108
- async function j() {
109
- var x, w;
110
- if (!l.value.freeText.trim()) {
111
- M.warning("请填写需求描述");
112
- return;
113
- }
114
- const e = l.value.autoMatch, t = e ? void 0 : l.value.promptId;
115
- if (!e && t == null) {
116
- const I = o.showPromptSelect || o.showAutoMatch ? "请选择提示词或开启自动匹配" : "请通过 promptId 传入提示词,或设置 autoMatch 为 true";
117
- M.warning(I);
118
- return;
119
- }
120
- T.value = !0;
121
- const s = r.value ? C.value : p.options.onFinish, c = P.enqueue({
122
- freeText: l.value.freeText.trim(),
123
- promptId: t,
124
- autoMatch: e && t == null ? !0 : void 0,
125
- showPanel: !0,
126
- onFinish: s
127
- });
128
- r.value ? A("submitted", c) : (w = (x = p.options).onSubmitted) == null || w.call(x, c), n.value = !1, T.value = !1, M.success("已加入任务队列,可在任务面板查看进度");
129
- }
130
- return (e, t) => {
131
- const s = d("el-switch"), c = d("el-form-item"), x = d("el-option"), w = d("el-select"), I = d("el-input"), z = d("el-form"), k = d("el-button"), H = d("el-dialog");
132
- return h(), b(H, {
133
- modelValue: n.value,
134
- "onUpdate:modelValue": t[4] || (t[4] = (a) => n.value = a),
135
- title: U.value,
136
- width: u.width,
137
- "append-to-body": "",
138
- class: "ai-use-dialog",
139
- onClosed: J,
140
- onOpen: q
141
- }, {
142
- footer: i(() => [
143
- S("div", le, [
144
- u.showTaskListButton ? (h(), b(k, {
145
- key: 0,
146
- link: "",
147
- type: "primary",
148
- onClick: $
149
- }, {
150
- default: i(() => [
151
- L(E(u.taskListButtonText), 1)
152
- ]),
153
- _: 1
154
- })) : _("", !0),
155
- S("div", ae, [
156
- m(k, {
157
- onClick: t[3] || (t[3] = (a) => n.value = !1)
158
- }, {
159
- default: i(() => [...t[5] || (t[5] = [
160
- L("取消", -1)
161
- ])]),
162
- _: 1
163
- }),
164
- m(k, {
165
- type: "primary",
166
- loading: T.value,
167
- onClick: j
168
- }, {
169
- default: i(() => [
170
- L(E(u.submitText), 1)
171
- ]),
172
- _: 1
173
- }, 8, ["loading"])
174
- ])
175
- ])
176
- ]),
177
- default: i(() => [
178
- m(z, { "label-position": "top" }, {
179
- default: i(() => [
180
- u.showAutoMatch ? (h(), b(c, {
181
- key: 0,
182
- label: u.autoMatchLabel
183
- }, {
184
- default: i(() => [
185
- m(s, {
186
- modelValue: l.value.autoMatch,
187
- "onUpdate:modelValue": t[0] || (t[0] = (a) => l.value.autoMatch = a),
188
- "active-text": "按需求自动选",
189
- "inactive-text": "手动指定",
190
- onChange: G
191
- }, null, 8, ["modelValue"])
192
- ]),
193
- _: 1
194
- }, 8, ["label"])) : _("", !0),
195
- u.showPromptSelect ? (h(), b(c, {
196
- key: 1,
197
- label: u.promptLabel,
198
- required: !l.value.autoMatch
199
- }, {
200
- default: i(() => [
201
- m(w, {
202
- modelValue: l.value.promptId,
203
- "onUpdate:modelValue": t[1] || (t[1] = (a) => l.value.promptId = a),
204
- filterable: "",
205
- clearable: "",
206
- placeholder: l.value.autoMatch ? "留空则自动匹配" : "请选择提示词",
207
- style: { width: "100%" },
208
- loading: y.value
209
- }, {
210
- default: i(() => [
211
- (h(!0), W(X, null, Y(f.value, (a) => (h(), b(x, {
212
- key: a.id,
213
- label: a.name,
214
- value: a.id
215
- }, null, 8, ["label", "value"]))), 128))
216
- ]),
217
- _: 1
218
- }, 8, ["modelValue", "placeholder", "loading"])
219
- ]),
220
- _: 1
221
- }, 8, ["label", "required"])) : _("", !0),
222
- m(c, {
223
- label: u.freeTextLabel,
224
- required: ""
225
- }, {
226
- default: i(() => [
227
- m(I, {
228
- modelValue: l.value.freeText,
229
- "onUpdate:modelValue": t[2] || (t[2] = (a) => l.value.freeText = a),
230
- type: "textarea",
231
- rows: 4,
232
- placeholder: u.freeTextPlaceholder
233
- }, null, 8, ["modelValue", "placeholder"])
234
- ]),
235
- _: 1
236
- }, 8, ["label"])
237
- ]),
238
- _: 1
239
- })
240
- ]),
241
- _: 1
242
- }, 8, ["modelValue", "title", "width"]);
243
- };
244
- }
245
- });
246
- export {
247
- me as default
248
- };
@@ -1,11 +0,0 @@
1
- import { inject as o } from "vue";
2
- import { createAiTaskApi as t } from "../context.js";
3
- import { AI_TASK_INJECT_KEY as e } from "../inject.js";
4
- import { useScopedAiTaskStore as i } from "../useScopedStore.js";
5
- function f() {
6
- const r = o(e, null);
7
- return r || t(i());
8
- }
9
- export {
10
- f as useAiTask
11
- };
@@ -1,23 +0,0 @@
1
- const t = {
2
- projectId: "default-project",
3
- storageKey: "yc-ai-task-queue-v1"
4
- };
5
- let e = { ...t };
6
- function n(o) {
7
- e = { ...e, ...o };
8
- }
9
- function r() {
10
- return e;
11
- }
12
- function c() {
13
- return e.projectId ?? t.projectId;
14
- }
15
- function g() {
16
- return e.storageKey ?? t.storageKey;
17
- }
18
- export {
19
- r as getAiTaskConfig,
20
- c as getProjectId,
21
- g as getStorageKey,
22
- n as setAiTaskConfig
23
- };
@@ -1,42 +0,0 @@
1
- import { storeToRefs as g } from "pinia";
2
- import { showAiDialog as u } from "./dialog-state.js";
3
- function p(e) {
4
- const {
5
- tasks: i,
6
- panelVisible: l,
7
- panelMinimized: n,
8
- dialogVisible: s,
9
- runningCount: c,
10
- activeCount: o,
11
- panelTitle: T,
12
- panelSubtitle: k
13
- } = g(e);
14
- return {
15
- tasks: i,
16
- panelVisible: l,
17
- panelMinimized: n,
18
- dialogVisible: s,
19
- runningCount: c,
20
- activeCount: o,
21
- panelTitle: T,
22
- panelSubtitle: k,
23
- openUseDialog: (a) => {
24
- u(a ?? {}), e.openDialog(a ?? {});
25
- },
26
- closeUseDialog: () => e.closeDialog(),
27
- openTaskPanel: () => e.showPanel(),
28
- hideTaskPanel: () => e.hidePanel(),
29
- togglePanelMinimize: () => e.toggleMinimize(),
30
- submitTask: (a) => e.enqueue(a),
31
- cancelTask: (a) => e.cancelTask(a),
32
- cancelAll: () => e.cancelAll(),
33
- clearFinished: () => e.clearFinished(),
34
- removeTask: (a) => e.removeTask(a),
35
- loadTaskResult: (a) => e.loadTaskResult(a),
36
- refreshTasks: () => e.refreshActiveTasks(),
37
- onTaskFinish: (a) => e.onTaskFinish(a)
38
- };
39
- }
40
- export {
41
- p as createAiTaskApi
42
- };
@@ -1,28 +0,0 @@
1
- import { reactive as e } from "vue";
2
- const o = "__YC_COMPONENT_AI_DIALOG__", n = "yc-component:ai-dialog-open";
3
- function a() {
4
- const i = globalThis;
5
- return i[o] || (i[o] = e({
6
- visible: !1,
7
- options: {}
8
- })), i[o];
9
- }
10
- const t = a();
11
- function s(i = {}) {
12
- t.options = { ...i }, t.visible = !0, globalThis.dispatchEvent(
13
- new CustomEvent(n, { detail: { ...i } })
14
- );
15
- }
16
- function c() {
17
- t.visible = !1;
18
- }
19
- function _(i = {}) {
20
- s(i);
21
- }
22
- export {
23
- n as AI_DIALOG_OPEN_EVENT,
24
- t as aiDialogState,
25
- c as hideAiDialog,
26
- _ as openAiUseDialog,
27
- s as showAiDialog
28
- };