yc-component 0.1.4 → 0.1.5
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/components/AiTaskPanel.css +1 -1
- package/dist/ai-task/components/AiTaskPanel.d.ts +1 -6
- package/dist/ai-task/components/AiTaskPanel.d.ts.map +1 -1
- package/dist/ai-task/components/AiTaskPanel.vue.js +3 -3
- package/dist/ai-task/components/AiTaskPanel.vue2.js +113 -108
- package/dist/ai-task/components/AiTaskProvider.d.ts +0 -2
- package/dist/ai-task/components/AiTaskProvider.d.ts.map +1 -1
- package/dist/ai-task/components/AiTaskProvider.vue.js +19 -22
- package/dist/ai-task/style.css +1 -1
- package/dist/ai-task/utils/extractVueSource.d.ts +10 -0
- package/dist/ai-task/utils/extractVueSource.d.ts.map +1 -0
- package/dist/ai-task/utils/extractVueSource.js +28 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.ai-task-panel[data-v-
|
|
1
|
+
.ai-task-panel[data-v-67ff2ad3]{position:fixed;right:24px;bottom:24px;width:420px;max-height:min(520px,100vh - 48px);display:flex;flex-direction:column;background:var(--el-bg-color);border-radius:12px;box-shadow:0 8px 32px #0000001f;border:1px solid var(--el-border-color-lighter);z-index:3000;overflow:hidden}.ai-task-panel__header[data-v-67ff2ad3]{display:flex;align-items:flex-start;justify-content:space-between;padding:16px 16px 12px;border-bottom:1px solid var(--el-border-color-extra-light)}.ai-task-panel__header-left[data-v-67ff2ad3]{display:flex;gap:12px;align-items:center;min-width:0}.ai-task-panel__icon[data-v-67ff2ad3]{width:44px;height:44px;border-radius:50%;background:var(--el-color-primary-light-9);color:var(--el-color-primary);display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0}.ai-task-panel__subtitle[data-v-67ff2ad3]{font-size:12px;color:var(--el-text-color-secondary)}.ai-task-panel__title[data-v-67ff2ad3]{font-size:18px;font-weight:700;color:var(--el-text-color-primary);line-height:1.3}.ai-task-panel__header-actions[data-v-67ff2ad3]{display:flex;align-items:center;gap:4px;flex-shrink:0}.ai-task-panel__body[data-v-67ff2ad3]{flex:1;overflow:auto;padding:8px 0}.ai-task-list[data-v-67ff2ad3]{display:flex;flex-direction:column}.ai-task-row[data-v-67ff2ad3]{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;border-bottom:1px solid var(--el-border-color-extra-light)}.ai-task-row[data-v-67ff2ad3]:last-child{border-bottom:none}.ai-task-row__icon[data-v-67ff2ad3]{width:40px;flex-shrink:0;display:flex;align-items:center;justify-content:center}.ai-task-row__icon .ok[data-v-67ff2ad3]{color:var(--el-color-success);font-size:28px}.ai-task-row__icon .err[data-v-67ff2ad3]{color:var(--el-color-danger);font-size:28px}.ai-task-row__icon .muted[data-v-67ff2ad3]{color:var(--el-text-color-secondary);font-size:24px}.ai-task-row__main[data-v-67ff2ad3]{flex:1;min-width:0}.ai-task-row__title[data-v-67ff2ad3]{font-size:14px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-task-row__meta[data-v-67ff2ad3]{font-size:12px;color:var(--el-text-color-secondary);margin-top:2px}.ai-task-row__summary[data-v-67ff2ad3]{font-size:12px;color:var(--el-text-color-regular);margin-top:4px;line-height:1.4}.ai-task-row__ops[data-v-67ff2ad3]{flex-shrink:0;display:flex;flex-direction:column;align-items:flex-end;gap:2px}.ai-task-panel__footer[data-v-67ff2ad3]{padding:8px 16px;border-top:1px solid var(--el-border-color-extra-light);text-align:center}.ai-task-panel-mini[data-v-67ff2ad3]{position:fixed;right:24px;bottom:24px;z-index:3000;display:flex;align-items:center;gap:8px;padding:10px 16px;background:var(--el-bg-color);border-radius:24px;box-shadow:0 4px 16px #0000001f;border:1px solid var(--el-border-color-lighter);cursor:pointer;font-size:13px;color:var(--el-text-color-primary)}.ai-task-panel-mini[data-v-67ff2ad3]:hover{border-color:var(--el-color-primary-light-5)}.spinning[data-v-67ff2ad3]{animation:ai-spin-67ff2ad3 1.2s linear infinite}@keyframes ai-spin-67ff2ad3{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ai-panel-slide-enter-active[data-v-67ff2ad3],.ai-panel-slide-leave-active[data-v-67ff2ad3]{transition:all .25s ease}.ai-panel-slide-enter-from[data-v-67ff2ad3],.ai-panel-slide-leave-to[data-v-67ff2ad3]{opacity:0;transform:translateY(16px)}.result-pre[data-v-67ff2ad3]{margin:0;max-height:420px;overflow:auto;font-size:12px;line-height:1.5;background:var(--el-fill-color-light);padding:12px;border-radius:8px;white-space:pre-wrap;word-break:break-all}.m-l-8[data-v-67ff2ad3]{margin-left:8px}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { AiTaskFinishPayload } from '../types';
|
|
2
1
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
-
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
4
|
-
use: (payload: AiTaskFinishPayload) => any;
|
|
5
|
-
}, string, PublicProps, Readonly<{}> & Readonly<{
|
|
6
|
-
onUse?: ((payload: AiTaskFinishPayload) => any) | undefined;
|
|
7
|
-
}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
8
3
|
export default _default;
|
|
9
4
|
//# sourceMappingURL=AiTaskPanel.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiTaskPanel.vue.d.ts","sourceRoot":"","sources":["../../../src/ai-task/components/AiTaskPanel.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AiTaskPanel.vue.d.ts","sourceRoot":"","sources":["../../../src/ai-task/components/AiTaskPanel.vue"],"names":[],"mappings":";AA+GA;;AA28BA,wBAMG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./AiTaskPanel.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import a from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-67ff2ad3"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1,104 +1,96 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Refresh as
|
|
3
|
-
import { useScopedAiTaskStore as
|
|
4
|
-
|
|
1
|
+
import { defineComponent as D, ref as f, computed as L, resolveComponent as m, openBlock as s, createBlock as u, Teleport as M, createVNode as a, Transition as N, withCtx as o, withDirectives as T, createElementVNode as i, normalizeClass as P, unref as t, toDisplayString as c, createTextVNode as k, createCommentVNode as r, createElementBlock as v, Fragment as E, renderList as F, vShow as V } from "vue";
|
|
2
|
+
import { Refresh as h, ArrowDown as U, Close as j, CircleCheck as q, CircleClose as G, Remove as H } from "@element-plus/icons-vue";
|
|
3
|
+
import { useScopedAiTaskStore as J } from "../useScopedStore.js";
|
|
4
|
+
import { formatTaskResultPreview as K, extractVueSourceFromResult as O } from "../utils/extractVueSource.js";
|
|
5
|
+
const Q = { class: "ai-task-panel" }, W = { class: "ai-task-panel__header" }, X = { class: "ai-task-panel__header-left" }, Y = { class: "ai-task-panel__titles" }, Z = { class: "ai-task-panel__subtitle" }, ee = { class: "ai-task-panel__title" }, te = { class: "ai-task-panel__header-actions" }, ne = { class: "ai-task-panel__body" }, le = {
|
|
5
6
|
key: 1,
|
|
6
7
|
class: "ai-task-list"
|
|
7
|
-
},
|
|
8
|
+
}, se = { class: "ai-task-row__icon" }, ie = { class: "ai-task-row__main" }, oe = { class: "ai-task-row__title" }, ae = { class: "ai-task-row__meta" }, ue = { key: 0 }, de = {
|
|
8
9
|
key: 0,
|
|
9
10
|
class: "ai-task-row__summary"
|
|
10
|
-
},
|
|
11
|
+
}, re = { class: "ai-task-row__ops" }, _e = {
|
|
11
12
|
key: 0,
|
|
12
13
|
class: "ai-task-panel__footer"
|
|
13
|
-
},
|
|
14
|
+
}, ce = { class: "result-pre" }, ge = /* @__PURE__ */ D({
|
|
14
15
|
__name: "AiTaskPanel",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const T = h, t = j(), f = V(null), b = {
|
|
16
|
+
setup(pe) {
|
|
17
|
+
const l = J(), g = f(!1), C = f(""), w = f(!1), y = f(null), S = L(() => w.value ? "Vue 源码" : "任务结果"), z = {
|
|
18
18
|
pending: "等待中",
|
|
19
19
|
running: "执行中",
|
|
20
20
|
succeeded: "已完成",
|
|
21
21
|
failed: "失败",
|
|
22
22
|
cancelled: "已取消"
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function $(_) {
|
|
25
|
+
return z[_] ?? _;
|
|
26
26
|
}
|
|
27
|
-
async function
|
|
28
|
-
|
|
27
|
+
async function A(_) {
|
|
28
|
+
var n;
|
|
29
|
+
y.value = _.id;
|
|
29
30
|
try {
|
|
30
|
-
const
|
|
31
|
-
|
|
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
|
-
});
|
|
31
|
+
const d = _.result ?? await l.loadTaskResult(_.id);
|
|
32
|
+
C.value = K(d, _.runId), w.value = !!((n = O(d)) != null && n.source), g.value = !0;
|
|
41
33
|
} finally {
|
|
42
|
-
|
|
34
|
+
y.value = null;
|
|
43
35
|
}
|
|
44
36
|
}
|
|
45
|
-
return (
|
|
46
|
-
const
|
|
47
|
-
return s(),
|
|
48
|
-
a(
|
|
37
|
+
return (_, n) => {
|
|
38
|
+
const d = m("el-icon"), p = m("el-button"), I = m("el-empty"), R = m("el-progress"), x = m("el-badge"), B = m("el-dialog");
|
|
39
|
+
return s(), u(M, { to: "body" }, [
|
|
40
|
+
a(N, { name: "ai-panel-slide" }, {
|
|
49
41
|
default: o(() => [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class:
|
|
42
|
+
T(i("div", Q, [
|
|
43
|
+
i("div", W, [
|
|
44
|
+
i("div", X, [
|
|
45
|
+
i("div", {
|
|
46
|
+
class: P(["ai-task-panel__icon", { spinning: t(l).activeCount > 0 }])
|
|
55
47
|
}, [
|
|
56
|
-
a(
|
|
48
|
+
a(d, null, {
|
|
57
49
|
default: o(() => [
|
|
58
|
-
a(
|
|
50
|
+
a(t(h))
|
|
59
51
|
]),
|
|
60
52
|
_: 1
|
|
61
53
|
})
|
|
62
54
|
], 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
i("div", Y, [
|
|
56
|
+
i("div", Z, c(t(l).panelSubtitle), 1),
|
|
57
|
+
i("div", ee, c(t(l).panelTitle), 1)
|
|
66
58
|
])
|
|
67
59
|
]),
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
i("div", te, [
|
|
61
|
+
t(l).runningCount > 0 ? (s(), u(p, {
|
|
70
62
|
key: 0,
|
|
71
63
|
link: "",
|
|
72
64
|
type: "primary",
|
|
73
|
-
onClick:
|
|
65
|
+
onClick: n[0] || (n[0] = (e) => t(l).cancelAll())
|
|
74
66
|
}, {
|
|
75
|
-
default: o(() => [...
|
|
76
|
-
|
|
67
|
+
default: o(() => [...n[6] || (n[6] = [
|
|
68
|
+
k(" 取消全部 ", -1)
|
|
77
69
|
])]),
|
|
78
70
|
_: 1
|
|
79
|
-
})) :
|
|
80
|
-
a(
|
|
71
|
+
})) : r("", !0),
|
|
72
|
+
a(p, {
|
|
81
73
|
link: "",
|
|
82
|
-
onClick:
|
|
74
|
+
onClick: n[1] || (n[1] = (e) => t(l).toggleMinimize())
|
|
83
75
|
}, {
|
|
84
76
|
default: o(() => [
|
|
85
|
-
a(
|
|
77
|
+
a(d, null, {
|
|
86
78
|
default: o(() => [
|
|
87
|
-
a(
|
|
79
|
+
a(t(U))
|
|
88
80
|
]),
|
|
89
81
|
_: 1
|
|
90
82
|
})
|
|
91
83
|
]),
|
|
92
84
|
_: 1
|
|
93
85
|
}),
|
|
94
|
-
a(
|
|
86
|
+
a(p, {
|
|
95
87
|
link: "",
|
|
96
|
-
onClick:
|
|
88
|
+
onClick: n[2] || (n[2] = (e) => t(l).hidePanel())
|
|
97
89
|
}, {
|
|
98
90
|
default: o(() => [
|
|
99
|
-
a(
|
|
91
|
+
a(d, null, {
|
|
100
92
|
default: o(() => [
|
|
101
|
-
a(
|
|
93
|
+
a(t(j))
|
|
102
94
|
]),
|
|
103
95
|
_: 1
|
|
104
96
|
})
|
|
@@ -107,142 +99,155 @@ const q = { class: "ai-task-panel" }, G = { class: "ai-task-panel__header" }, H
|
|
|
107
99
|
})
|
|
108
100
|
])
|
|
109
101
|
]),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(s(!0),
|
|
102
|
+
i("div", ne, [
|
|
103
|
+
t(l).tasks.length ? (s(), v("div", le, [
|
|
104
|
+
(s(!0), v(E, null, F(t(l).tasks, (e) => (s(), v("div", {
|
|
113
105
|
key: e.id,
|
|
114
106
|
class: "ai-task-row"
|
|
115
107
|
}, [
|
|
116
|
-
|
|
117
|
-
e.status === "succeeded" ? (s(),
|
|
108
|
+
i("div", se, [
|
|
109
|
+
e.status === "succeeded" ? (s(), u(d, {
|
|
118
110
|
key: 0,
|
|
119
111
|
class: "ok"
|
|
120
112
|
}, {
|
|
121
113
|
default: o(() => [
|
|
122
|
-
a(
|
|
114
|
+
a(t(q))
|
|
123
115
|
]),
|
|
124
116
|
_: 1
|
|
125
|
-
})) : e.status === "failed" ? (s(),
|
|
117
|
+
})) : e.status === "failed" ? (s(), u(d, {
|
|
126
118
|
key: 1,
|
|
127
119
|
class: "err"
|
|
128
120
|
}, {
|
|
129
121
|
default: o(() => [
|
|
130
|
-
a(
|
|
122
|
+
a(t(G))
|
|
131
123
|
]),
|
|
132
124
|
_: 1
|
|
133
|
-
})) : e.status === "running" || e.status === "pending" ? (s(),
|
|
125
|
+
})) : e.status === "running" || e.status === "pending" ? (s(), u(R, {
|
|
134
126
|
key: 2,
|
|
135
127
|
type: "circle",
|
|
136
128
|
percentage: e.progress,
|
|
137
129
|
width: 36,
|
|
138
130
|
"stroke-width": 3
|
|
139
|
-
}, null, 8, ["percentage"])) : (s(),
|
|
131
|
+
}, null, 8, ["percentage"])) : (s(), u(d, {
|
|
140
132
|
key: 3,
|
|
141
133
|
class: "muted"
|
|
142
134
|
}, {
|
|
143
135
|
default: o(() => [
|
|
144
|
-
a(
|
|
136
|
+
a(t(H))
|
|
145
137
|
]),
|
|
146
138
|
_: 1
|
|
147
139
|
}))
|
|
148
140
|
]),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
e.runId ? (s(),
|
|
141
|
+
i("div", ie, [
|
|
142
|
+
i("div", oe, c(e.title), 1),
|
|
143
|
+
i("div", ae, [
|
|
144
|
+
i("span", null, c($(e.status)), 1),
|
|
145
|
+
e.runId ? (s(), v("span", ue, " · #" + c(e.runId), 1)) : r("", !0)
|
|
154
146
|
]),
|
|
155
|
-
e.summary ? (s(),
|
|
147
|
+
e.summary ? (s(), v("div", de, c(e.summary), 1)) : r("", !0)
|
|
156
148
|
]),
|
|
157
|
-
|
|
158
|
-
e.status === "running" || e.status === "pending" ? (s(),
|
|
149
|
+
i("div", re, [
|
|
150
|
+
e.status === "running" || e.status === "pending" ? (s(), u(p, {
|
|
159
151
|
key: 0,
|
|
160
152
|
link: "",
|
|
161
153
|
type: "danger",
|
|
162
154
|
size: "small",
|
|
163
|
-
onClick: (
|
|
155
|
+
onClick: (b) => t(l).cancelTask(e.id)
|
|
164
156
|
}, {
|
|
165
|
-
default: o(() => [...
|
|
166
|
-
|
|
157
|
+
default: o(() => [...n[7] || (n[7] = [
|
|
158
|
+
k(" 取消 ", -1)
|
|
167
159
|
])]),
|
|
168
160
|
_: 1
|
|
169
|
-
}, 8, ["onClick"])) :
|
|
170
|
-
e.status === "succeeded" && e.runId ? (s(),
|
|
161
|
+
}, 8, ["onClick"])) : r("", !0),
|
|
162
|
+
e.status === "succeeded" && e.runId ? (s(), u(p, {
|
|
171
163
|
key: 1,
|
|
172
164
|
link: "",
|
|
173
165
|
type: "primary",
|
|
174
166
|
size: "small",
|
|
175
|
-
loading:
|
|
176
|
-
onClick: (
|
|
167
|
+
loading: y.value === e.id,
|
|
168
|
+
onClick: (b) => A(e)
|
|
177
169
|
}, {
|
|
178
|
-
default: o(() => [...
|
|
179
|
-
|
|
170
|
+
default: o(() => [...n[8] || (n[8] = [
|
|
171
|
+
k(" 结果 ", -1)
|
|
180
172
|
])]),
|
|
181
173
|
_: 1
|
|
182
|
-
}, 8, ["loading", "onClick"])) :
|
|
183
|
-
e.status !== "running" && e.status !== "pending" ? (s(),
|
|
174
|
+
}, 8, ["loading", "onClick"])) : r("", !0),
|
|
175
|
+
e.status !== "running" && e.status !== "pending" ? (s(), u(p, {
|
|
184
176
|
key: 2,
|
|
185
177
|
link: "",
|
|
186
178
|
size: "small",
|
|
187
|
-
onClick: (
|
|
179
|
+
onClick: (b) => t(l).removeTask(e.id)
|
|
188
180
|
}, {
|
|
189
|
-
default: o(() => [...
|
|
190
|
-
|
|
181
|
+
default: o(() => [...n[9] || (n[9] = [
|
|
182
|
+
k(" 移除 ", -1)
|
|
191
183
|
])]),
|
|
192
184
|
_: 1
|
|
193
|
-
}, 8, ["onClick"])) :
|
|
185
|
+
}, 8, ["onClick"])) : r("", !0)
|
|
194
186
|
])
|
|
195
187
|
]))), 128))
|
|
196
|
-
])) : (s(),
|
|
188
|
+
])) : (s(), u(I, {
|
|
197
189
|
key: 0,
|
|
198
190
|
description: "暂无 AI 任务",
|
|
199
191
|
"image-size": 64
|
|
200
192
|
}))
|
|
201
193
|
]),
|
|
202
|
-
|
|
203
|
-
a(
|
|
194
|
+
t(l).tasks.some((e) => e.status !== "running" && e.status !== "pending") ? (s(), v("div", _e, [
|
|
195
|
+
a(p, {
|
|
204
196
|
link: "",
|
|
205
197
|
type: "info",
|
|
206
|
-
onClick:
|
|
198
|
+
onClick: n[3] || (n[3] = (e) => t(l).clearFinished())
|
|
207
199
|
}, {
|
|
208
|
-
default: o(() => [...
|
|
209
|
-
|
|
200
|
+
default: o(() => [...n[10] || (n[10] = [
|
|
201
|
+
k("清除已完成", -1)
|
|
210
202
|
])]),
|
|
211
203
|
_: 1
|
|
212
204
|
})
|
|
213
|
-
])) :
|
|
205
|
+
])) : r("", !0)
|
|
214
206
|
], 512), [
|
|
215
|
-
[
|
|
207
|
+
[V, t(l).panelVisible && !t(l).panelMinimized]
|
|
216
208
|
])
|
|
217
209
|
]),
|
|
218
210
|
_: 1
|
|
219
211
|
}),
|
|
220
|
-
|
|
212
|
+
T(i("div", {
|
|
221
213
|
class: "ai-task-panel-mini",
|
|
222
|
-
onClick:
|
|
214
|
+
onClick: n[4] || (n[4] = (e) => t(l).toggleMinimize())
|
|
223
215
|
}, [
|
|
224
|
-
|
|
216
|
+
t(l).activeCount > 0 ? (s(), u(d, {
|
|
225
217
|
key: 0,
|
|
226
218
|
class: "spinning"
|
|
227
219
|
}, {
|
|
228
220
|
default: o(() => [
|
|
229
|
-
a(
|
|
221
|
+
a(t(h))
|
|
230
222
|
]),
|
|
231
223
|
_: 1
|
|
232
|
-
})) :
|
|
233
|
-
|
|
234
|
-
|
|
224
|
+
})) : r("", !0),
|
|
225
|
+
i("span", null, c(t(l).panelSubtitle), 1),
|
|
226
|
+
t(l).runningCount > 0 ? (s(), u(x, {
|
|
235
227
|
key: 1,
|
|
236
|
-
value:
|
|
228
|
+
value: t(l).runningCount,
|
|
237
229
|
class: "m-l-8"
|
|
238
|
-
}, null, 8, ["value"])) :
|
|
230
|
+
}, null, 8, ["value"])) : r("", !0)
|
|
239
231
|
], 512), [
|
|
240
|
-
[
|
|
241
|
-
])
|
|
232
|
+
[V, t(l).panelVisible && t(l).panelMinimized]
|
|
233
|
+
]),
|
|
234
|
+
a(B, {
|
|
235
|
+
modelValue: g.value,
|
|
236
|
+
"onUpdate:modelValue": n[5] || (n[5] = (e) => g.value = e),
|
|
237
|
+
title: S.value,
|
|
238
|
+
width: "720px",
|
|
239
|
+
"append-to-body": "",
|
|
240
|
+
"destroy-on-close": ""
|
|
241
|
+
}, {
|
|
242
|
+
default: o(() => [
|
|
243
|
+
i("pre", ce, c(C.value), 1)
|
|
244
|
+
]),
|
|
245
|
+
_: 1
|
|
246
|
+
}, 8, ["modelValue", "title"])
|
|
242
247
|
]);
|
|
243
248
|
};
|
|
244
249
|
}
|
|
245
250
|
});
|
|
246
251
|
export {
|
|
247
|
-
|
|
252
|
+
ge as default
|
|
248
253
|
};
|
|
@@ -10,10 +10,8 @@ declare function __VLS_template(): {
|
|
|
10
10
|
};
|
|
11
11
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
12
|
declare const __VLS_component: DefineComponent<AiUseDialogProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
13
|
-
use: (data: AiTaskFinishPayload) => any;
|
|
14
13
|
finish: (data: AiTaskFinishPayload) => any;
|
|
15
14
|
}, string, PublicProps, Readonly<AiUseDialogProps> & Readonly<{
|
|
16
|
-
onUse?: ((data: AiTaskFinishPayload) => any) | undefined;
|
|
17
15
|
onFinish?: ((data: AiTaskFinishPayload) => any) | undefined;
|
|
18
16
|
}>, {
|
|
19
17
|
showDialog: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiTaskProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/ai-task/components/AiTaskProvider.vue"],"names":[],"mappings":";AAKA;
|
|
1
|
+
{"version":3,"file":"AiTaskProvider.vue.d.ts","sourceRoot":"","sources":["../../../src/ai-task/components/AiTaskProvider.vue"],"names":[],"mappings":";AAKA;AAoEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA0DrE,iBAAS,cAAc;WAsCT,OAAO,IAA6B;;yBAVpB,GAAG;;;;EAehC;AAaD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;6EAQnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { createAiTaskApi as
|
|
3
|
-
import { AI_TASK_STORE_KEY as
|
|
4
|
-
import { useAiTaskStore as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const C = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as n, provide as l, computed as u, onMounted as c, onUnmounted as h, openBlock as s, createElementBlock as d, Fragment as T, createBlock as f, normalizeProps as x, mergeProps as k, createCommentVNode as B, createVNode as L, renderSlot as w } from "vue";
|
|
2
|
+
import { createAiTaskApi as b } from "../context.js";
|
|
3
|
+
import { AI_TASK_STORE_KEY as A, AI_TASK_INJECT_KEY as P } from "../inject.js";
|
|
4
|
+
import { useAiTaskStore as M } from "../store/useAiTaskStore.js";
|
|
5
|
+
import _ from "./AiUseDialog.vue.js";
|
|
6
|
+
import y from "./AiTaskPanel.vue.js";
|
|
7
|
+
const C = /* @__PURE__ */ n({
|
|
8
8
|
__name: "AiTaskProvider",
|
|
9
9
|
props: {
|
|
10
10
|
title: {},
|
|
@@ -25,11 +25,11 @@ const C = /* @__PURE__ */ u({
|
|
|
25
25
|
modelValue: { type: Boolean },
|
|
26
26
|
showDialog: { type: Boolean, default: !0 }
|
|
27
27
|
},
|
|
28
|
-
emits: ["finish"
|
|
29
|
-
setup(r, { emit:
|
|
30
|
-
const e = r,
|
|
31
|
-
l(
|
|
32
|
-
const
|
|
28
|
+
emits: ["finish"],
|
|
29
|
+
setup(r, { emit: i }) {
|
|
30
|
+
const e = r, m = i, o = M();
|
|
31
|
+
l(A, o), l(P, b(o));
|
|
32
|
+
const p = u(() => {
|
|
33
33
|
const t = {
|
|
34
34
|
title: e.title,
|
|
35
35
|
freeText: e.freeText,
|
|
@@ -50,17 +50,14 @@ const C = /* @__PURE__ */ u({
|
|
|
50
50
|
return e.modelValue !== void 0 && (t.modelValue = e.modelValue), t;
|
|
51
51
|
});
|
|
52
52
|
let a;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
return h(() => {
|
|
57
|
-
o.hydrate(), a = o.onTaskFinish((t) => s("finish", t));
|
|
58
|
-
}), d(() => {
|
|
53
|
+
return c(() => {
|
|
54
|
+
o.hydrate(), a = o.onTaskFinish((t) => m("finish", t));
|
|
55
|
+
}), h(() => {
|
|
59
56
|
a == null || a();
|
|
60
|
-
}), (t,
|
|
61
|
-
r.showDialog !== !1 ? (
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
}), (t, S) => (s(), d(T, null, [
|
|
58
|
+
r.showDialog !== !1 ? (s(), f(_, x(k({ key: 0 }, p.value)), null, 16)) : B("", !0),
|
|
59
|
+
L(y),
|
|
60
|
+
w(t.$slots, "default")
|
|
64
61
|
], 64));
|
|
65
62
|
}
|
|
66
63
|
});
|
package/dist/ai-task/style.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
.ai-task-panel[data-v-
|
|
1
|
+
.ai-task-panel[data-v-67ff2ad3]{position:fixed;right:24px;bottom:24px;width:420px;max-height:min(520px,100vh - 48px);display:flex;flex-direction:column;background:var(--el-bg-color);border-radius:12px;box-shadow:0 8px 32px #0000001f;border:1px solid var(--el-border-color-lighter);z-index:3000;overflow:hidden}.ai-task-panel__header[data-v-67ff2ad3]{display:flex;align-items:flex-start;justify-content:space-between;padding:16px 16px 12px;border-bottom:1px solid var(--el-border-color-extra-light)}.ai-task-panel__header-left[data-v-67ff2ad3]{display:flex;gap:12px;align-items:center;min-width:0}.ai-task-panel__icon[data-v-67ff2ad3]{width:44px;height:44px;border-radius:50%;background:var(--el-color-primary-light-9);color:var(--el-color-primary);display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0}.ai-task-panel__subtitle[data-v-67ff2ad3]{font-size:12px;color:var(--el-text-color-secondary)}.ai-task-panel__title[data-v-67ff2ad3]{font-size:18px;font-weight:700;color:var(--el-text-color-primary);line-height:1.3}.ai-task-panel__header-actions[data-v-67ff2ad3]{display:flex;align-items:center;gap:4px;flex-shrink:0}.ai-task-panel__body[data-v-67ff2ad3]{flex:1;overflow:auto;padding:8px 0}.ai-task-list[data-v-67ff2ad3]{display:flex;flex-direction:column}.ai-task-row[data-v-67ff2ad3]{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;border-bottom:1px solid var(--el-border-color-extra-light)}.ai-task-row[data-v-67ff2ad3]:last-child{border-bottom:none}.ai-task-row__icon[data-v-67ff2ad3]{width:40px;flex-shrink:0;display:flex;align-items:center;justify-content:center}.ai-task-row__icon .ok[data-v-67ff2ad3]{color:var(--el-color-success);font-size:28px}.ai-task-row__icon .err[data-v-67ff2ad3]{color:var(--el-color-danger);font-size:28px}.ai-task-row__icon .muted[data-v-67ff2ad3]{color:var(--el-text-color-secondary);font-size:24px}.ai-task-row__main[data-v-67ff2ad3]{flex:1;min-width:0}.ai-task-row__title[data-v-67ff2ad3]{font-size:14px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-task-row__meta[data-v-67ff2ad3]{font-size:12px;color:var(--el-text-color-secondary);margin-top:2px}.ai-task-row__summary[data-v-67ff2ad3]{font-size:12px;color:var(--el-text-color-regular);margin-top:4px;line-height:1.4}.ai-task-row__ops[data-v-67ff2ad3]{flex-shrink:0;display:flex;flex-direction:column;align-items:flex-end;gap:2px}.ai-task-panel__footer[data-v-67ff2ad3]{padding:8px 16px;border-top:1px solid var(--el-border-color-extra-light);text-align:center}.ai-task-panel-mini[data-v-67ff2ad3]{position:fixed;right:24px;bottom:24px;z-index:3000;display:flex;align-items:center;gap:8px;padding:10px 16px;background:var(--el-bg-color);border-radius:24px;box-shadow:0 4px 16px #0000001f;border:1px solid var(--el-border-color-lighter);cursor:pointer;font-size:13px;color:var(--el-text-color-primary)}.ai-task-panel-mini[data-v-67ff2ad3]:hover{border-color:var(--el-color-primary-light-5)}.spinning[data-v-67ff2ad3]{animation:ai-spin-67ff2ad3 1.2s linear infinite}@keyframes ai-spin-67ff2ad3{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ai-panel-slide-enter-active[data-v-67ff2ad3],.ai-panel-slide-leave-active[data-v-67ff2ad3]{transition:all .25s ease}.ai-panel-slide-enter-from[data-v-67ff2ad3],.ai-panel-slide-leave-to[data-v-67ff2ad3]{opacity:0;transform:translateY(16px)}.result-pre[data-v-67ff2ad3]{margin:0;max-height:420px;overflow:auto;font-size:12px;line-height:1.5;background:var(--el-fill-color-light);padding:12px;border-radius:8px;white-space:pre-wrap;word-break:break-all}.m-l-8[data-v-67ff2ad3]{margin-left:8px}
|
|
2
2
|
|
|
3
3
|
.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}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** 从工作流产物中提取 Vue SFC 源码 */
|
|
2
|
+
export declare function extractVueSourceFromResult(result: unknown): {
|
|
3
|
+
fileName?: string;
|
|
4
|
+
source?: string;
|
|
5
|
+
uiLibrary?: string;
|
|
6
|
+
uiLibraryName?: string;
|
|
7
|
+
} | null;
|
|
8
|
+
/** 格式化任务结果用于展示:Vue 源码优先,否则 JSON */
|
|
9
|
+
export declare function formatTaskResultPreview(result: unknown, runId?: number | null): string;
|
|
10
|
+
//# sourceMappingURL=extractVueSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractVueSource.d.ts","sourceRoot":"","sources":["../../../src/ai-task/utils/extractVueSource.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,GAAG,IAAI,CAeP;AAED,mCAAmC;AACnC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAatF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function t(e) {
|
|
2
|
+
if (!e || typeof e != "object") return null;
|
|
3
|
+
const r = e;
|
|
4
|
+
return typeof r.source == "string" && r.source.trim() ? {
|
|
5
|
+
fileName: typeof r.fileName == "string" ? r.fileName : void 0,
|
|
6
|
+
source: r.source,
|
|
7
|
+
uiLibrary: typeof r.uiLibrary == "string" ? r.uiLibrary : void 0,
|
|
8
|
+
uiLibraryName: typeof r.uiLibraryName == "string" ? r.uiLibraryName : void 0
|
|
9
|
+
} : r.data && typeof r.data == "object" ? t(r.data) : null;
|
|
10
|
+
}
|
|
11
|
+
function o(e, r) {
|
|
12
|
+
const i = t(e);
|
|
13
|
+
if (i != null && i.source) {
|
|
14
|
+
const a = [
|
|
15
|
+
i.fileName ? `# ${i.fileName}` : "",
|
|
16
|
+
i.uiLibraryName || i.uiLibrary ? `UI: ${i.uiLibraryName || i.uiLibrary}` : "",
|
|
17
|
+
r ? `runId: ${r}` : ""
|
|
18
|
+
].filter(Boolean).join(" · ");
|
|
19
|
+
return a ? `${a}
|
|
20
|
+
|
|
21
|
+
${i.source}` : i.source;
|
|
22
|
+
}
|
|
23
|
+
return JSON.stringify(r != null ? { result: e, runId: r } : e, null, 2);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
t as extractVueSourceFromResult,
|
|
27
|
+
o as formatTaskResultPreview
|
|
28
|
+
};
|