liyu-pc-base 1.0.1213 → 1.0.1223

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.
@@ -1,7 +1,7 @@
1
1
  import { A as e, z as t } from "./init-plugin-CERVEi6b.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { n as r } from "./view-model-DKGqNoLB.js";
4
- import { a as i, s as a } from "./utils-CdD9ak3N.js";
4
+ import { a as i, s as a } from "./utils-BEKXRkuc.js";
5
5
  import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createTextVNode as u, createVNode as d, defineComponent as f, onMounted as p, openBlock as m, reactive as h, ref as g, resolveComponent as _, toDisplayString as v, unref as y, withCtx as b } from "vue";
6
6
  import { message as x } from "ant-design-vue";
7
7
  import { useI18n as S } from "vue-i18n";
@@ -0,0 +1,165 @@
1
+ import { getApiData as e } from "./api/api-model.js";
2
+ import { t } from "./markdown-it-B9l1CghD.js";
3
+ import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, onMounted as u, onUnmounted as d, openBlock as f, ref as p, resolveComponent as m, withCtx as h } from "vue";
4
+ import { message as g } from "ant-design-vue";
5
+ //#region src/components/lysync/aiGenModel.vue?vue&type=script&setup=true&lang.ts
6
+ var _ = { style: { "min-height": "420px" } }, v = { style: {
7
+ "margin-bottom": "12px",
8
+ display: "flex",
9
+ gap: "12px",
10
+ "align-items": "center"
11
+ } }, y = {
12
+ key: 0,
13
+ style: {
14
+ color: "#999",
15
+ "font-size": "12px"
16
+ }
17
+ }, b = ["innerHTML"], x = /* @__PURE__ */ l({
18
+ __name: "aiGenModel",
19
+ props: {
20
+ title: {},
21
+ record: {}
22
+ },
23
+ emits: ["cancel", "ok"],
24
+ setup(l, { emit: x }) {
25
+ let S = l, C = x, w = p(!0), T = p(!1), E = p(!0), D = p(""), O = p(""), k = p(""), A = p(null), j = new t(), M = j.renderer.rules.fence;
26
+ j.renderer.rules.fence = (e, t, n, r, i) => `<div class="mark-code-block"><button class="md-copy-btn" type="button" aria-label="复制代码"><span class="md-copy-icon">复制</span></button>${M ? M(e, t, n, r, i) : i.renderToken(e, t, n)}</div>`;
27
+ let N = null, P = p(null), F = async (e) => {
28
+ let t = e.target.closest(".md-copy-btn");
29
+ if (!t) return;
30
+ let n = t.closest(".mark-code-block")?.querySelector("pre code");
31
+ if (!n) return;
32
+ await I((n.textContent || "").replace(/\n$/, "")) ? g.success("已复制到剪贴板") : g.error("复制失败,请手动复制");
33
+ let r = t.querySelector(".md-copy-icon");
34
+ r && (r.textContent = "已复制"), setTimeout(() => {
35
+ r && (r.textContent = "复制");
36
+ }, 1500);
37
+ }, I = async (e) => {
38
+ try {
39
+ if (navigator.clipboard && window.isSecureContext) return await navigator.clipboard.writeText(e), !0;
40
+ } catch {}
41
+ try {
42
+ let t = document.createElement("textarea");
43
+ t.value = e, t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select();
44
+ let n = document.execCommand("copy");
45
+ return document.body.removeChild(t), n;
46
+ } catch {
47
+ return !1;
48
+ }
49
+ }, L = n(() => S.record?.id ?? null), R = n(() => S.record?.model_app ?? ""), z = n(() => j.render(k.value)), B = () => {
50
+ N &&= (clearTimeout(N), null);
51
+ }, V = async () => {
52
+ if (!(!L.value || !O.value)) {
53
+ B(), T.value = !0, E.value = !0, D.value = "", k.value = "";
54
+ try {
55
+ A.value = (await e({
56
+ data_source_id: L.value,
57
+ sql: O.value
58
+ }, `${R.value}/ai_gen_model`)).task_id, H();
59
+ } catch (e) {
60
+ T.value = !1, E.value = !1, D.value = e?.message || "发起任务时发生错误";
61
+ }
62
+ }
63
+ }, H = async () => {
64
+ if (A.value) try {
65
+ let t = await e({ task_id: A.value }, `${R.value}/get_ai_gen_model_result`);
66
+ t.ready ? (T.value = !1, E.value = t.success, t.success ? k.value = t.result : D.value = t.message || "获取结果失败") : (E.value = !0, D.value = "", k.value = "", N = setTimeout(H, 1e3));
67
+ } catch (e) {
68
+ T.value = !1, E.value = !1, D.value = e?.message || "获取结果时发生错误";
69
+ }
70
+ }, U = () => {
71
+ B(), C("cancel");
72
+ };
73
+ return u(() => {
74
+ P.value?.addEventListener("click", F);
75
+ }), d(() => {
76
+ B(), P.value?.removeEventListener("click", F);
77
+ }), (e, t) => {
78
+ let n = m("a-alert"), l = m("a-textarea"), u = m("a-form-item"), d = m("a-form"), p = m("a-button"), g = m("a-divider"), x = m("a-spin"), S = m("a-modal");
79
+ return f(), r(S, {
80
+ title: e.title,
81
+ width: "80%",
82
+ open: w.value,
83
+ footer: null,
84
+ centered: "",
85
+ "destroy-on-close": "",
86
+ "mask-closable": !1,
87
+ "body-style": {
88
+ maxHeight: "72vh",
89
+ overflowY: "auto"
90
+ },
91
+ onCancel: U
92
+ }, {
93
+ default: h(() => [c(x, {
94
+ spinning: T.value,
95
+ tip: "AI 正在根据 SQL 生成 Model..."
96
+ }, {
97
+ default: h(() => [o("div", _, [
98
+ E.value ? i("", !0) : (f(), r(n, {
99
+ key: 0,
100
+ message: D.value,
101
+ type: "error",
102
+ "show-icon": "",
103
+ style: { "margin-bottom": "16px" }
104
+ }, null, 8, ["message"])),
105
+ c(d, {
106
+ layout: "vertical",
107
+ size: "small"
108
+ }, {
109
+ default: h(() => [c(u, { label: "查询 SQL(用于生成 Model)" }, {
110
+ default: h(() => [c(l, {
111
+ value: O.value,
112
+ "onUpdate:value": t[0] ||= (e) => O.value = e,
113
+ placeholder: "请输入一条 SELECT 查询 SQL,例如:SELECT id, name, created_at FROM my_table",
114
+ "auto-size": {
115
+ minRows: 4,
116
+ maxRows: 12
117
+ },
118
+ disabled: T.value,
119
+ "allow-clear": ""
120
+ }, null, 8, ["value", "disabled"])]),
121
+ _: 1
122
+ })]),
123
+ _: 1
124
+ }),
125
+ o("div", v, [
126
+ c(p, {
127
+ type: "primary",
128
+ loading: T.value,
129
+ disabled: !O.value || !L.value,
130
+ onClick: V
131
+ }, {
132
+ default: h(() => t[1] ||= [s(" 生成模型 ")]),
133
+ _: 1
134
+ }, 8, ["loading", "disabled"]),
135
+ c(p, {
136
+ disabled: T.value,
137
+ onClick: U
138
+ }, {
139
+ default: h(() => t[2] ||= [s(" 关闭 ")]),
140
+ _: 1
141
+ }, 8, ["disabled"]),
142
+ L.value ? i("", !0) : (f(), a("span", y, " 未获取到数据源信息,无法生成 "))
143
+ ]),
144
+ k.value ? (f(), r(g, {
145
+ key: 1,
146
+ orientation: "left"
147
+ }, {
148
+ default: h(() => t[3] ||= [s(" 生成结果 ")]),
149
+ _: 1
150
+ })) : i("", !0),
151
+ o("div", {
152
+ class: "mark-container",
153
+ ref_key: "markContainer",
154
+ ref: P
155
+ }, [o("div", { innerHTML: z.value }, null, 8, b)], 512)
156
+ ])]),
157
+ _: 1
158
+ }, 8, ["spinning"])]),
159
+ _: 1
160
+ }, 8, ["title", "open"]);
161
+ };
162
+ }
163
+ });
164
+ //#endregion
165
+ export { x as default };
@@ -1,14 +1,14 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _ } from "../components-BKIrVR35.js";
2
- import { f as v, t as y } from "../tablePro-WP1Uw_b4.js";
3
- import { g as b, h as x, i as S, l as C } from "../TinymceEditor-x6oH3OLc.js";
4
- import { i as w, r as T } from "../RemoteSelect-CrqKuqLy.js";
5
- import { t as E } from "../RemoteModal-DmeZX6tX.js";
6
- import { t as D } from "../RemoteSelectPro-0DhaMGFT.js";
7
- import { t as O } from "../JsonStr-JwOPdAYW.js";
8
- import { t as k } from "../JsonObj-CmylW4Or.js";
9
- import { t as A } from "../FieldRender-D457aew2.js";
10
- import { t as j } from "../FieldRender2-iJAXSY7Y.js";
11
- import { t as M } from "../SearchRender-BcTES9Vj.js";
12
- import { t as N } from "../FormRender3-DSuUFghA.js";
13
- import { E as P, T as F } from "../tablePageHost-yfsOVGWf.js";
14
- export { e as AddConditionGroupModal, T as BoldMatcher, b as CodeEditor, _ as ExtraFieldSettings, A as FieldRender, j as FieldRender2, o as FormRender, l as FormRender2, N as FormRender3, a as GeneralFilter, S as IconSelect, k as JsonObj, u as JsonRenderForm, h as JsonRenderFormDesign, O as JsonStr, E as RemoteModal, D as RemoteSelectPro, C as RemoteTreeSelectPro, M as SearchRender, i as SideSearchRender, v as SmallTableSerarchField, f as ViewManage, m as ai_agent_files, d as ai_agent_web, x as debugCode, r as fullLayout, w as getFormConfig, g as gridPage, t as inner_page, p as normalizeContainer, F as pivotCharts, P as pivotTable, c as remotePagesV2, n as sql_db_view, y as tablePro, s as validateJsonRenderConfig };
1
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "../components-D7myD060.js";
2
+ import { f as y, t as b } from "../tablePro-Bd6rublT.js";
3
+ import { _ as x, d as S, i as C, v as w } from "../TinymceEditor-CowTAt9s.js";
4
+ import { i as T, r as E } from "../RemoteSelect-CrqKuqLy.js";
5
+ import { t as D } from "../RemoteModal-DmeZX6tX.js";
6
+ import { t as O } from "../RemoteSelectPro-Ba7o82t8.js";
7
+ import { t as k } from "../JsonStr-JwOPdAYW.js";
8
+ import { t as A } from "../JsonObj-CmylW4Or.js";
9
+ import { t as j } from "../FieldRender-GHezux_e.js";
10
+ import { t as M } from "../FieldRender2-C3B14eIg.js";
11
+ import { t as N } from "../SearchRender-D95TTDWk.js";
12
+ import { t as P } from "../FormRender3-qp2fiaBQ.js";
13
+ import { E as F, T as I } from "../tablePageHost-0TwO9-bh.js";
14
+ export { _ as AddConditionGroupModal, E as BoldMatcher, w as CodeEditor, v as ExtraFieldSettings, j as FieldRender, M as FieldRender2, a as FormRender, o as FormRender2, P as FormRender3, e as GeneralFilter, C as IconSelect, A as JsonObj, u as JsonRenderForm, h as JsonRenderFormDesign, k as JsonStr, D as RemoteModal, O as RemoteSelectPro, S as RemoteTreeSelectPro, N as SearchRender, f as SideSearchRender, y as SmallTableSerarchField, l as ViewManage, n as ai_agent_files, m as ai_agent_sessions, d as ai_agent_web, x as debugCode, i as fullLayout, T as getFormConfig, r as gridPage, t as inner_page, p as normalizeContainer, I as pivotCharts, F as pivotTable, g as remotePagesV2, c as sql_db_view, b as tablePro, s as validateJsonRenderConfig };