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