wi-chat 0.3.0 → 0.4.0
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/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +59 -54
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +5 -0
- package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +5 -0
- package/dist/mobile-ui/index.cjs +1 -1
- package/dist/mobile-ui/index.d.ts +2 -2
- package/dist/mobile-ui/index.js +78 -71
- package/dist/mobile-ui/style.css +1 -1
- package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +43 -0
- package/dist/parser/answerCom/outputFile/types.d.ts +17 -0
- package/dist/parser/index.cjs +2 -2
- package/dist/parser/index.d.ts +3 -0
- package/dist/parser/index.js +220 -180
- package/dist/parser/registry.d.ts +1 -1
- package/dist/renderers/index.cjs +1 -1
- package/dist/renderers/index.d.ts +3 -0
- package/dist/renderers/index.js +512 -146
- package/dist/renderers/outputFile/OutputFile.vue.d.ts +19 -0
- package/dist/renderers/outputFile/useOutputFile.d.ts +85 -0
- package/dist/renderers/style.css +1 -1
- package/dist/web-ui/chat/ChatContainer.vue.d.ts +5 -0
- package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +5 -0
- package/dist/web-ui/index.cjs +1 -1
- package/dist/web-ui/index.d.ts +2 -2
- package/dist/web-ui/index.js +402 -388
- package/dist/web-ui/style.css +1 -1
- package/package.json +1 -1
package/dist/renderers/index.js
CHANGED
|
@@ -1,243 +1,609 @@
|
|
|
1
1
|
import "wi-chat/style.css";
|
|
2
|
-
import { defineAsyncComponent as
|
|
3
|
-
import { knowledgeStreamParser as
|
|
4
|
-
import { renderMarkdown as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
{ ...
|
|
8
|
-
{ ...
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { defineAsyncComponent as N, defineComponent as L, computed as I, openBlock as l, createElementBlock as d, createElementVNode as i, Fragment as M, renderList as B, createBlock as P, resolveDynamicComponent as ie, createCommentVNode as C, createTextVNode as le, pushScopeId as H, popScopeId as K, toDisplayString as S, withDirectives as ce, vShow as de, getCurrentInstance as te, inject as oe, toValue as O, ref as E, watch as ue, onBeforeUnmount as pe, provide as ne, withKeys as J, unref as n, withModifiers as D, normalizeClass as _e, Teleport as fe, createVNode as we, Transition as me, withCtx as ve } from "vue";
|
|
3
|
+
import { knowledgeStreamParser as he, iframePageParser as be, outputFileParser as ge, formatFileSize as ye, IFRAME_RESIZER_CHILD_SCRIPT as ke } from "wi-chat/parser";
|
|
4
|
+
import { renderMarkdown as se, downloadTableAsExcel as Se } from "wi-chat/tools";
|
|
5
|
+
import Z from "@iframe-resizer/vue/iframe-resizer.vue";
|
|
6
|
+
const Ie = [
|
|
7
|
+
{ ...he, component: N(() => Promise.resolve().then(() => We)) },
|
|
8
|
+
{ ...be, component: N(() => Promise.resolve().then(() => Xt)) },
|
|
9
|
+
{ ...ge, component: N(() => Promise.resolve().then(() => jt)) }
|
|
10
|
+
], Ee = (o) => {
|
|
11
|
+
const t = (r) => {
|
|
12
|
+
const s = {};
|
|
13
|
+
for (const e of r)
|
|
14
|
+
!e.answerType || !e.component || (s[e.answerType] = e.component);
|
|
15
|
+
return s;
|
|
15
16
|
};
|
|
16
|
-
return { ...t(
|
|
17
|
-
},
|
|
17
|
+
return { ...t(Ie), ...t(o ?? []) };
|
|
18
|
+
}, Ce = (o) => (H("data-v-efad55c8"), o = o(), K(), o), Ue = { class: "flex justify-start" }, Oe = { class: "ai-answer-bubble" }, xe = {
|
|
18
19
|
key: 0,
|
|
19
20
|
class: "ai-answer-bubble__error"
|
|
20
|
-
},
|
|
21
|
+
}, Le = { class: "ai-answer-bubble__body" }, Te = {
|
|
21
22
|
key: 0,
|
|
22
23
|
class: "ai-answer-bubble__status"
|
|
23
|
-
},
|
|
24
|
+
}, $e = {
|
|
24
25
|
key: 2,
|
|
25
26
|
class: "ai-answer-bubble__status"
|
|
26
|
-
},
|
|
27
|
+
}, Re = {
|
|
27
28
|
key: 3,
|
|
28
29
|
class: "ai-answer-bubble__loading"
|
|
29
|
-
},
|
|
30
|
+
}, Me = /* @__PURE__ */ Ce(() => /* @__PURE__ */ i("span", { class: "ai-answer-bubble__pulse" }, null, -1)), Pe = /* @__PURE__ */ L({
|
|
30
31
|
__name: "AiAnswerBubble",
|
|
31
32
|
props: {
|
|
32
33
|
answer: {},
|
|
33
34
|
error: { type: Boolean, default: !1 },
|
|
34
35
|
stopped: { type: Boolean, default: !1 },
|
|
35
|
-
contentMap: { default: () =>
|
|
36
|
+
contentMap: { default: () => Ee() }
|
|
36
37
|
},
|
|
37
|
-
setup(
|
|
38
|
-
const t =
|
|
39
|
-
var e,
|
|
40
|
-
return ((
|
|
41
|
-
}),
|
|
42
|
-
return (e,
|
|
43
|
-
|
|
44
|
-
e.error ? (l(),
|
|
45
|
-
|
|
46
|
-
(l(!0),
|
|
47
|
-
key:
|
|
48
|
-
report:
|
|
38
|
+
setup(o) {
|
|
39
|
+
const t = o, r = I(() => {
|
|
40
|
+
var e, c;
|
|
41
|
+
return ((c = (e = t.answer) == null ? void 0 : e.answer) == null ? void 0 : c.reports) ?? [];
|
|
42
|
+
}), s = I(() => r.value.filter((e) => t.contentMap[e.answer_type]));
|
|
43
|
+
return (e, c) => (l(), d("div", Ue, [
|
|
44
|
+
i("div", Oe, [
|
|
45
|
+
e.error ? (l(), d("div", xe, "回答加载失败")) : s.value.length ? (l(), d(M, { key: 1 }, [
|
|
46
|
+
i("div", Le, [
|
|
47
|
+
(l(!0), d(M, null, B(s.value, (_, p) => (l(), P(ie(e.contentMap[_.answer_type]), {
|
|
48
|
+
key: p,
|
|
49
|
+
report: _
|
|
49
50
|
}, null, 8, ["report"]))), 128))
|
|
50
51
|
]),
|
|
51
|
-
e.stopped ? (l(),
|
|
52
|
-
], 64)) : e.stopped ? (l(),
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
e.stopped ? (l(), d("div", Te, "回答已停止")) : C("", !0)
|
|
53
|
+
], 64)) : e.stopped ? (l(), d("div", $e, "回答已停止")) : r.value.length ? C("", !0) : (l(), d("div", Re, [
|
|
54
|
+
Me,
|
|
55
|
+
le("正在思考...")
|
|
55
56
|
]))
|
|
56
57
|
])
|
|
57
58
|
]));
|
|
58
59
|
}
|
|
59
|
-
}),
|
|
60
|
-
const
|
|
61
|
-
for (const [
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
},
|
|
60
|
+
}), T = (o, t) => {
|
|
61
|
+
const r = o.__vccOpts || o;
|
|
62
|
+
for (const [s, e] of t)
|
|
63
|
+
r[s] = e;
|
|
64
|
+
return r;
|
|
65
|
+
}, Zt = /* @__PURE__ */ T(Pe, [["__scopeId", "data-v-efad55c8"]]), je = (o) => (H("data-v-c6f5cb64"), o = o(), K(), o), Fe = {
|
|
65
66
|
key: 0,
|
|
66
67
|
class: "deep-thinking"
|
|
67
|
-
},
|
|
68
|
+
}, Ne = ["aria-expanded"], De = /* @__PURE__ */ je(() => /* @__PURE__ */ i("span", { class: "deep-thinking__title" }, "深度思考", -1)), Ae = { class: "deep-thinking__count" }, ze = { class: "deep-thinking__list" }, Be = { class: "deep-thinking__index" }, He = ["innerHTML"], Ke = /* @__PURE__ */ L({
|
|
68
69
|
__name: "DeepThinkingSteps",
|
|
69
70
|
props: {
|
|
70
71
|
steps: {},
|
|
71
72
|
expanded: { type: Boolean }
|
|
72
73
|
},
|
|
73
74
|
emits: ["update:expanded"],
|
|
74
|
-
setup(
|
|
75
|
-
const
|
|
76
|
-
let
|
|
77
|
-
return
|
|
78
|
-
},
|
|
79
|
-
return (
|
|
80
|
-
|
|
75
|
+
setup(o, { emit: t }) {
|
|
76
|
+
const r = o, s = t, e = { imageDownload: !1, tableDownload: !1 }, c = /* @__PURE__ */ new Map(), _ = (u) => {
|
|
77
|
+
let f = c.get(u);
|
|
78
|
+
return f === void 0 && (c.size > 500 && c.clear(), f = se(u, e), c.set(u, f)), f;
|
|
79
|
+
}, p = I(() => r.steps.map(_));
|
|
80
|
+
return (u, f) => p.value.length ? (l(), d("div", Fe, [
|
|
81
|
+
i("button", {
|
|
81
82
|
type: "button",
|
|
82
83
|
class: "deep-thinking__header",
|
|
83
|
-
"aria-expanded":
|
|
84
|
-
onClick:
|
|
84
|
+
"aria-expanded": u.expanded,
|
|
85
|
+
onClick: f[0] || (f[0] = (b) => s("update:expanded", !u.expanded))
|
|
85
86
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
], 8,
|
|
90
|
-
|
|
91
|
-
(l(!0),
|
|
92
|
-
key:
|
|
87
|
+
De,
|
|
88
|
+
i("span", Ae, S(p.value.length), 1),
|
|
89
|
+
i("span", null, S(u.expanded ? "收起" : "展开"), 1)
|
|
90
|
+
], 8, Ne),
|
|
91
|
+
ce(i("div", ze, [
|
|
92
|
+
(l(!0), d(M, null, B(p.value, (b, w) => (l(), d("div", {
|
|
93
|
+
key: w,
|
|
93
94
|
class: "deep-thinking__item"
|
|
94
95
|
}, [
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
i("span", Be, S(w + 1), 1),
|
|
97
|
+
i("div", {
|
|
97
98
|
class: "markdown-it",
|
|
98
|
-
innerHTML:
|
|
99
|
-
}, null, 8,
|
|
99
|
+
innerHTML: b
|
|
100
|
+
}, null, 8, He)
|
|
100
101
|
]))), 128))
|
|
101
102
|
], 512), [
|
|
102
|
-
[
|
|
103
|
+
[de, u.expanded]
|
|
103
104
|
])
|
|
104
|
-
])) :
|
|
105
|
+
])) : C("", !0);
|
|
105
106
|
}
|
|
106
|
-
}),
|
|
107
|
+
}), Qt = /* @__PURE__ */ T(Ke, [["__scopeId", "data-v-c6f5cb64"]]), Ve = ["innerHTML"], Xe = /* @__PURE__ */ L({
|
|
107
108
|
__name: "KnowledgeStreamResult",
|
|
108
109
|
props: {
|
|
109
110
|
report: {}
|
|
110
111
|
},
|
|
111
|
-
setup(
|
|
112
|
-
const t =
|
|
113
|
-
var
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
112
|
+
setup(o) {
|
|
113
|
+
const t = o, r = { imageDownload: !1, tableDownload: !0 }, s = (p) => {
|
|
114
|
+
var w;
|
|
115
|
+
const f = p.target.closest(".wi-md-table-download");
|
|
116
|
+
if (!f)
|
|
116
117
|
return;
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
}, e = /* @__PURE__ */ new Map(),
|
|
121
|
-
let
|
|
122
|
-
return
|
|
123
|
-
},
|
|
124
|
-
return (
|
|
118
|
+
p.preventDefault(), p.stopPropagation();
|
|
119
|
+
const b = (w = f.closest(".wi-md-table-wrap")) == null ? void 0 : w.querySelector("table");
|
|
120
|
+
b && Se(b);
|
|
121
|
+
}, e = /* @__PURE__ */ new Map(), c = (p) => {
|
|
122
|
+
let u = e.get(p);
|
|
123
|
+
return u === void 0 && (e.size > 300 && e.clear(), u = se(p, r), e.set(p, u)), u;
|
|
124
|
+
}, _ = I(() => (t.report.values || []).map((p) => c(p.answer || "")));
|
|
125
|
+
return (p, u) => (l(), d("div", {
|
|
125
126
|
class: "knowledge-result",
|
|
126
|
-
onClick:
|
|
127
|
+
onClick: s
|
|
127
128
|
}, [
|
|
128
|
-
(l(!0),
|
|
129
|
-
key:
|
|
129
|
+
(l(!0), d(M, null, B(_.value, (f, b) => (l(), d("div", {
|
|
130
|
+
key: b,
|
|
130
131
|
class: "markdown-it",
|
|
131
|
-
innerHTML:
|
|
132
|
-
}, null, 8,
|
|
132
|
+
innerHTML: f
|
|
133
|
+
}, null, 8, Ve))), 128))
|
|
133
134
|
]));
|
|
134
135
|
}
|
|
135
|
-
}),
|
|
136
|
+
}), Ge = /* @__PURE__ */ T(Xe, [["__scopeId", "data-v-1827e802"]]), We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
136
137
|
__proto__: null,
|
|
137
|
-
default:
|
|
138
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
default: Ge
|
|
139
|
+
}, Symbol.toStringTag, { value: "Module" })), re = Symbol("wi-chat-output-file-config"), eo = (o) => {
|
|
140
|
+
ne(re, o);
|
|
141
|
+
}, qe = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg", "ico"]), Ye = /* @__PURE__ */ new Set(["mp3", "wav", "ogg", "m4a", "aac", "flac"]), Je = /* @__PURE__ */ new Set(["mp4", "webm", "mov", "avi", "mkv"]), Ze = /* @__PURE__ */ new Set(["doc", "docx", "xls", "xlsx", "ppt", "pptx"]), Qe = /* @__PURE__ */ new Set(["html", "htm"]), et = /* @__PURE__ */ new Set([
|
|
142
|
+
"js",
|
|
143
|
+
"mjs",
|
|
144
|
+
"cjs",
|
|
145
|
+
"ts",
|
|
146
|
+
"tsx",
|
|
147
|
+
"jsx",
|
|
148
|
+
"vue",
|
|
149
|
+
"py",
|
|
150
|
+
"java",
|
|
151
|
+
"c",
|
|
152
|
+
"h",
|
|
153
|
+
"cpp",
|
|
154
|
+
"hpp",
|
|
155
|
+
"cs",
|
|
156
|
+
"go",
|
|
157
|
+
"rs",
|
|
158
|
+
"php",
|
|
159
|
+
"rb",
|
|
160
|
+
"sh",
|
|
161
|
+
"bash",
|
|
162
|
+
"bat",
|
|
163
|
+
"ps1",
|
|
164
|
+
"css",
|
|
165
|
+
"scss",
|
|
166
|
+
"less"
|
|
167
|
+
]), tt = /* @__PURE__ */ new Set([
|
|
168
|
+
"txt",
|
|
169
|
+
"text",
|
|
170
|
+
"md",
|
|
171
|
+
"markdown",
|
|
172
|
+
"json",
|
|
173
|
+
"csv",
|
|
174
|
+
"log",
|
|
175
|
+
"xml",
|
|
176
|
+
"yaml",
|
|
177
|
+
"yml",
|
|
178
|
+
"ini",
|
|
179
|
+
"conf",
|
|
180
|
+
"env",
|
|
181
|
+
"toml",
|
|
182
|
+
"sql"
|
|
183
|
+
]), Q = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), ot = (o) => {
|
|
184
|
+
const t = o.lastIndexOf(".");
|
|
185
|
+
return t >= 0 ? o.slice(t + 1).toLowerCase() : "";
|
|
186
|
+
}, nt = (o) => qe.has(o) ? "image" : o === "pdf" ? "pdf" : Qe.has(o) ? "html" : Ye.has(o) ? "audio" : Je.has(o) ? "video" : Ze.has(o) ? "office" : et.has(o) ? "code" : tt.has(o) ? "text" : "unknown", st = (o) => {
|
|
187
|
+
const t = te() ? oe(re, {}) : {}, r = I(() => {
|
|
188
|
+
var h;
|
|
189
|
+
const a = O(o);
|
|
190
|
+
return ((h = a == null ? void 0 : a.values) == null ? void 0 : h.file_id) ?? (a == null ? void 0 : a.file_id) ?? "";
|
|
191
|
+
}), s = I(() => {
|
|
192
|
+
var h;
|
|
193
|
+
const a = O(o);
|
|
194
|
+
return ((h = a == null ? void 0 : a.values) == null ? void 0 : h.file_name) ?? (a == null ? void 0 : a.file_name) ?? "未命名文件";
|
|
195
|
+
}), e = I(() => ot(s.value)), c = I(() => nt(e.value)), _ = E(!1), p = E(!1), u = E(""), f = E(!1), b = E(""), w = E(""), y = E(null), U = I(() => y.value ? ye(y.value.size) : ""), k = () => {
|
|
196
|
+
w.value && typeof URL < "u" && typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(w.value), w.value = "";
|
|
197
|
+
}, $ = async () => {
|
|
198
|
+
const a = r.value, h = s.value;
|
|
199
|
+
if (!a)
|
|
200
|
+
throw new Error("缺少文件 id,无法加载文件");
|
|
201
|
+
const g = a || h, W = Q.get(g);
|
|
202
|
+
if (W)
|
|
203
|
+
return W;
|
|
204
|
+
let R = A.get(g);
|
|
205
|
+
return R || (R = (async () => {
|
|
206
|
+
var q, Y;
|
|
207
|
+
if (t.loadFile)
|
|
208
|
+
return t.loadFile(a);
|
|
209
|
+
const x = (q = t.getFileUrl) == null ? void 0 : q.call(t, a);
|
|
210
|
+
if (!x)
|
|
211
|
+
throw new Error("未配置文件加载方式(请提供 loadFile 或 getFileUrl)");
|
|
212
|
+
const F = await fetch(x, { headers: (Y = t.getHeaders) == null ? void 0 : Y.call(t) });
|
|
213
|
+
if (!F.ok)
|
|
214
|
+
throw new Error(`文件加载失败(HTTP ${F.status})`);
|
|
215
|
+
return F.blob();
|
|
216
|
+
})().then((x) => (Q.set(g, x), x)).finally(() => A.delete(g)), A.set(g, R)), R;
|
|
217
|
+
}, m = async () => {
|
|
218
|
+
p.value = !0, u.value = "", f.value = !1, b.value = "", k();
|
|
219
|
+
try {
|
|
220
|
+
const a = await $();
|
|
221
|
+
y.value = a;
|
|
222
|
+
const h = c.value;
|
|
223
|
+
if (h === "office") {
|
|
224
|
+
f.value = !0;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (h === "image" || h === "pdf" || h === "audio" || h === "video") {
|
|
228
|
+
typeof URL < "u" && typeof URL.createObjectURL == "function" && (w.value = URL.createObjectURL(a));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const g = await a.text();
|
|
232
|
+
if (g.includes("\0")) {
|
|
233
|
+
f.value = !0;
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
b.value = g;
|
|
237
|
+
} catch (a) {
|
|
238
|
+
u.value = a instanceof Error ? a.message : String(a);
|
|
239
|
+
} finally {
|
|
240
|
+
p.value = !1;
|
|
241
|
+
}
|
|
242
|
+
}, v = async () => {
|
|
243
|
+
if (t.openPreview) {
|
|
244
|
+
t.openPreview({
|
|
245
|
+
fileId: r.value,
|
|
246
|
+
fileName: s.value,
|
|
247
|
+
loadFile: $,
|
|
248
|
+
download: G
|
|
249
|
+
});
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
_.value = !0, await m();
|
|
253
|
+
}, X = () => {
|
|
254
|
+
_.value = !1, p.value = !1, u.value = "", f.value = !1, b.value = "", k();
|
|
255
|
+
}, G = async () => {
|
|
256
|
+
try {
|
|
257
|
+
const a = y.value ?? await $();
|
|
258
|
+
if (y.value = a, t.downloadFile) {
|
|
259
|
+
t.downloadFile({ fileId: r.value, fileName: s.value, blob: a });
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (typeof document > "u" || typeof URL > "u")
|
|
263
|
+
return;
|
|
264
|
+
const h = URL.createObjectURL(a), g = document.createElement("a");
|
|
265
|
+
g.href = h, g.download = s.value, document.body.appendChild(g), g.click(), g.remove(), URL.revokeObjectURL(h);
|
|
266
|
+
} catch (a) {
|
|
267
|
+
u.value = a instanceof Error ? a.message : String(a), !_.value && !t.openPreview && (_.value = !0);
|
|
268
|
+
}
|
|
269
|
+
}, j = (a) => {
|
|
270
|
+
a.key === "Escape" && _.value && X();
|
|
271
|
+
};
|
|
272
|
+
return ue(_, (a) => {
|
|
273
|
+
typeof window > "u" || (a ? window.addEventListener("keydown", j) : window.removeEventListener("keydown", j));
|
|
274
|
+
}), pe(() => {
|
|
275
|
+
typeof window < "u" && window.removeEventListener("keydown", j), k();
|
|
276
|
+
}), {
|
|
277
|
+
fileId: r,
|
|
278
|
+
fileName: s,
|
|
279
|
+
extension: e,
|
|
280
|
+
previewKind: c,
|
|
281
|
+
fileSize: U,
|
|
282
|
+
visible: _,
|
|
283
|
+
loading: p,
|
|
284
|
+
error: u,
|
|
285
|
+
unsupported: f,
|
|
286
|
+
textContent: b,
|
|
287
|
+
objectUrl: w,
|
|
288
|
+
open: v,
|
|
289
|
+
close: X,
|
|
290
|
+
download: G
|
|
291
|
+
};
|
|
292
|
+
}, V = (o) => (H("data-v-f61a91b5"), o = o(), K(), o), rt = { class: "wi-output-file" }, at = ["aria-label"], it = /* @__PURE__ */ V(() => /* @__PURE__ */ i("svg", {
|
|
293
|
+
viewBox: "0 0 24 24",
|
|
294
|
+
fill: "none",
|
|
295
|
+
stroke: "currentColor",
|
|
296
|
+
"stroke-width": "1.7",
|
|
297
|
+
"stroke-linecap": "round",
|
|
298
|
+
"stroke-linejoin": "round"
|
|
299
|
+
}, [
|
|
300
|
+
/* @__PURE__ */ i("path", { d: "M7 2.5h7l4 4V21.5H7z" }),
|
|
301
|
+
/* @__PURE__ */ i("path", { d: "M14 2.5v4h4" })
|
|
302
|
+
], -1)), lt = [
|
|
303
|
+
it
|
|
304
|
+
], ct = { class: "wi-output-file__info" }, dt = ["title"], ut = { class: "wi-output-file__meta" }, pt = { class: "wi-output-file__ext" }, _t = {
|
|
305
|
+
key: 0,
|
|
306
|
+
class: "wi-output-file__size"
|
|
307
|
+
}, ft = /* @__PURE__ */ V(() => /* @__PURE__ */ i("svg", {
|
|
308
|
+
viewBox: "0 0 24 24",
|
|
309
|
+
fill: "none",
|
|
310
|
+
stroke: "currentColor",
|
|
311
|
+
"stroke-width": "1.8",
|
|
312
|
+
"stroke-linecap": "round",
|
|
313
|
+
"stroke-linejoin": "round"
|
|
314
|
+
}, [
|
|
315
|
+
/* @__PURE__ */ i("path", { d: "M12 3v12" }),
|
|
316
|
+
/* @__PURE__ */ i("path", { d: "m7 10 5 5 5-5" }),
|
|
317
|
+
/* @__PURE__ */ i("path", { d: "M5 21h14" })
|
|
318
|
+
], -1)), wt = [
|
|
319
|
+
ft
|
|
320
|
+
], mt = ["aria-label"], vt = { class: "wi-output-file-drawer__head" }, ht = { class: "wi-output-file-drawer__title" }, bt = { class: "wi-output-file-drawer__ext" }, gt = ["title"], yt = {
|
|
321
|
+
key: 0,
|
|
322
|
+
class: "wi-output-file-drawer__size"
|
|
323
|
+
}, kt = { class: "wi-output-file-drawer__actions" }, St = { class: "wi-output-file-drawer__body" }, It = {
|
|
324
|
+
key: 0,
|
|
325
|
+
class: "wi-output-file-drawer__state"
|
|
326
|
+
}, Et = {
|
|
327
|
+
key: 1,
|
|
328
|
+
class: "wi-output-file-drawer__state is-error"
|
|
329
|
+
}, Ct = {
|
|
330
|
+
key: 2,
|
|
331
|
+
class: "wi-output-file-drawer__state"
|
|
332
|
+
}, Ut = /* @__PURE__ */ V(() => /* @__PURE__ */ i("p", null, "该文件类型暂不支持在线预览,请下载后查看。", -1)), Ot = ["src", "alt"], xt = ["src", "title"], Lt = ["srcdoc", "title"], Tt = ["src"], $t = ["src"], Rt = {
|
|
333
|
+
key: 8,
|
|
334
|
+
class: "wi-output-file-drawer__text"
|
|
335
|
+
}, Mt = /* @__PURE__ */ L({
|
|
336
|
+
__name: "OutputFile",
|
|
337
|
+
props: {
|
|
338
|
+
report: {}
|
|
339
|
+
},
|
|
340
|
+
setup(o) {
|
|
341
|
+
const t = o, {
|
|
342
|
+
fileName: r,
|
|
343
|
+
extension: s,
|
|
344
|
+
previewKind: e,
|
|
345
|
+
fileSize: c,
|
|
346
|
+
visible: _,
|
|
347
|
+
loading: p,
|
|
348
|
+
error: u,
|
|
349
|
+
unsupported: f,
|
|
350
|
+
textContent: b,
|
|
351
|
+
objectUrl: w,
|
|
352
|
+
open: y,
|
|
353
|
+
close: U,
|
|
354
|
+
download: k
|
|
355
|
+
} = st(() => t.report);
|
|
356
|
+
return ($, m) => (l(), d("div", rt, [
|
|
357
|
+
i("div", {
|
|
358
|
+
class: "wi-output-file__card",
|
|
359
|
+
role: "button",
|
|
360
|
+
tabindex: "0",
|
|
361
|
+
"aria-label": `预览文件 ${n(r)}`,
|
|
362
|
+
onClick: m[1] || (m[1] = //@ts-ignore
|
|
363
|
+
(...v) => n(y) && n(y)(...v)),
|
|
364
|
+
onKeydown: [
|
|
365
|
+
m[2] || (m[2] = J(
|
|
366
|
+
//@ts-ignore
|
|
367
|
+
(...v) => n(y) && n(y)(...v),
|
|
368
|
+
["enter"]
|
|
369
|
+
)),
|
|
370
|
+
m[3] || (m[3] = J(D(
|
|
371
|
+
//@ts-ignore
|
|
372
|
+
(...v) => n(y) && n(y)(...v),
|
|
373
|
+
["prevent"]
|
|
374
|
+
), ["space"]))
|
|
375
|
+
]
|
|
376
|
+
}, [
|
|
377
|
+
i("span", {
|
|
378
|
+
class: _e(["wi-output-file__icon", `is-${n(e)}`])
|
|
379
|
+
}, lt, 2),
|
|
380
|
+
i("div", ct, [
|
|
381
|
+
i("div", {
|
|
382
|
+
class: "wi-output-file__name",
|
|
383
|
+
title: n(r)
|
|
384
|
+
}, S(n(r)), 9, dt),
|
|
385
|
+
i("div", ut, [
|
|
386
|
+
i("span", pt, S(n(s).toUpperCase() || "FILE"), 1),
|
|
387
|
+
n(c) ? (l(), d("span", _t, S(n(c)), 1)) : C("", !0)
|
|
388
|
+
])
|
|
389
|
+
]),
|
|
390
|
+
i("button", {
|
|
391
|
+
type: "button",
|
|
392
|
+
class: "wi-output-file__download",
|
|
393
|
+
title: "下载文件",
|
|
394
|
+
"aria-label": "下载文件",
|
|
395
|
+
onClick: m[0] || (m[0] = D(
|
|
396
|
+
//@ts-ignore
|
|
397
|
+
(...v) => n(k) && n(k)(...v),
|
|
398
|
+
["stop"]
|
|
399
|
+
))
|
|
400
|
+
}, wt)
|
|
401
|
+
], 40, at),
|
|
402
|
+
(l(), P(fe, { to: "body" }, [
|
|
403
|
+
we(me, { name: "wi-output-file-fade" }, {
|
|
404
|
+
default: ve(() => [
|
|
405
|
+
n(_) ? (l(), d("div", {
|
|
406
|
+
key: 0,
|
|
407
|
+
class: "wi-output-file-mask",
|
|
408
|
+
onClick: m[8] || (m[8] = D(
|
|
409
|
+
//@ts-ignore
|
|
410
|
+
(...v) => n(U) && n(U)(...v),
|
|
411
|
+
["self"]
|
|
412
|
+
))
|
|
413
|
+
}, [
|
|
414
|
+
i("aside", {
|
|
415
|
+
class: "wi-output-file-drawer",
|
|
416
|
+
role: "dialog",
|
|
417
|
+
"aria-modal": "true",
|
|
418
|
+
"aria-label": `预览文件 ${n(r)}`
|
|
419
|
+
}, [
|
|
420
|
+
i("header", vt, [
|
|
421
|
+
i("div", ht, [
|
|
422
|
+
i("span", bt, S(n(s).toUpperCase() || "FILE"), 1),
|
|
423
|
+
i("div", {
|
|
424
|
+
class: "wi-output-file-drawer__name",
|
|
425
|
+
title: n(r)
|
|
426
|
+
}, S(n(r)), 9, gt),
|
|
427
|
+
n(c) ? (l(), d("div", yt, S(n(c)), 1)) : C("", !0)
|
|
428
|
+
]),
|
|
429
|
+
i("div", kt, [
|
|
430
|
+
i("button", {
|
|
431
|
+
type: "button",
|
|
432
|
+
class: "wi-output-file-drawer__btn",
|
|
433
|
+
onClick: m[4] || (m[4] = //@ts-ignore
|
|
434
|
+
(...v) => n(k) && n(k)(...v))
|
|
435
|
+
}, "下载"),
|
|
436
|
+
i("button", {
|
|
437
|
+
type: "button",
|
|
438
|
+
class: "wi-output-file-drawer__btn wi-output-file-drawer__btn--close",
|
|
439
|
+
title: "关闭",
|
|
440
|
+
"aria-label": "关闭预览",
|
|
441
|
+
onClick: m[5] || (m[5] = //@ts-ignore
|
|
442
|
+
(...v) => n(U) && n(U)(...v))
|
|
443
|
+
}, " × ")
|
|
444
|
+
])
|
|
445
|
+
]),
|
|
446
|
+
i("div", St, [
|
|
447
|
+
n(p) ? (l(), d("div", It, "文件加载中…")) : n(u) ? (l(), d("div", Et, [
|
|
448
|
+
i("p", null, S(n(u)), 1),
|
|
449
|
+
i("button", {
|
|
450
|
+
type: "button",
|
|
451
|
+
class: "wi-output-file-drawer__btn",
|
|
452
|
+
onClick: m[6] || (m[6] = //@ts-ignore
|
|
453
|
+
(...v) => n(k) && n(k)(...v))
|
|
454
|
+
}, "下载文件")
|
|
455
|
+
])) : n(f) ? (l(), d("div", Ct, [
|
|
456
|
+
Ut,
|
|
457
|
+
i("button", {
|
|
458
|
+
type: "button",
|
|
459
|
+
class: "wi-output-file-drawer__btn",
|
|
460
|
+
onClick: m[7] || (m[7] = //@ts-ignore
|
|
461
|
+
(...v) => n(k) && n(k)(...v))
|
|
462
|
+
}, "下载文件")
|
|
463
|
+
])) : n(e) === "image" && n(w) ? (l(), d("img", {
|
|
464
|
+
key: 3,
|
|
465
|
+
class: "wi-output-file-drawer__image",
|
|
466
|
+
src: n(w),
|
|
467
|
+
alt: n(r)
|
|
468
|
+
}, null, 8, Ot)) : n(e) === "pdf" && n(w) ? (l(), d("iframe", {
|
|
469
|
+
key: 4,
|
|
470
|
+
class: "wi-output-file-drawer__frame",
|
|
471
|
+
src: n(w),
|
|
472
|
+
title: n(r)
|
|
473
|
+
}, null, 8, xt)) : n(e) === "html" ? (l(), d("iframe", {
|
|
474
|
+
key: 5,
|
|
475
|
+
class: "wi-output-file-drawer__frame",
|
|
476
|
+
srcdoc: n(b),
|
|
477
|
+
sandbox: "allow-scripts allow-forms allow-modals",
|
|
478
|
+
title: n(r)
|
|
479
|
+
}, null, 8, Lt)) : n(e) === "audio" && n(w) ? (l(), d("audio", {
|
|
480
|
+
key: 6,
|
|
481
|
+
class: "wi-output-file-drawer__media",
|
|
482
|
+
src: n(w),
|
|
483
|
+
controls: ""
|
|
484
|
+
}, null, 8, Tt)) : n(e) === "video" && n(w) ? (l(), d("video", {
|
|
485
|
+
key: 7,
|
|
486
|
+
class: "wi-output-file-drawer__media",
|
|
487
|
+
src: n(w),
|
|
488
|
+
controls: ""
|
|
489
|
+
}, null, 8, $t)) : (l(), d("pre", Rt, S(n(b)), 1))
|
|
490
|
+
])
|
|
491
|
+
], 8, mt)
|
|
492
|
+
])) : C("", !0)
|
|
493
|
+
]),
|
|
494
|
+
_: 1
|
|
495
|
+
})
|
|
496
|
+
]))
|
|
497
|
+
]));
|
|
150
498
|
}
|
|
151
|
-
|
|
152
|
-
|
|
499
|
+
}), Pt = /* @__PURE__ */ T(Mt, [["__scopeId", "data-v-f61a91b5"]]), jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
500
|
+
__proto__: null,
|
|
501
|
+
default: Pt
|
|
502
|
+
}, Symbol.toStringTag, { value: "Module" })), Ft = () => {
|
|
503
|
+
var t, r;
|
|
504
|
+
const o = (r = (t = window == null ? void 0 : window.globalConfig) == null ? void 0 : t.WebApiUrl) == null ? void 0 : r.MainUrl;
|
|
505
|
+
return typeof o == "string" ? o : "";
|
|
506
|
+
}, Nt = () => window.location.origin + window.location.pathname, z = "access-session", Dt = () => {
|
|
507
|
+
const o = window.location.pathname.split("/").filter((t) => !!t).join("-");
|
|
508
|
+
return o ? `${o}-` : "";
|
|
509
|
+
}, At = () => {
|
|
510
|
+
const o = `${Dt()}${z}`, t = [];
|
|
511
|
+
for (let s = 0; s < localStorage.length; s++) {
|
|
512
|
+
const e = localStorage.key(s);
|
|
513
|
+
!e || !e.endsWith(z) || e.slice(0, e.lastIndexOf(":")) !== "wi admin" && (e.endsWith(`x-${z}`) || t.push(e));
|
|
514
|
+
}
|
|
515
|
+
const r = t.find((s) => s.endsWith(o)) ?? t[0];
|
|
516
|
+
if (!r)
|
|
153
517
|
return "";
|
|
154
518
|
try {
|
|
155
|
-
const
|
|
156
|
-
if (!
|
|
519
|
+
const s = localStorage.getItem(r);
|
|
520
|
+
if (!s || s === "undefined")
|
|
157
521
|
return "";
|
|
158
|
-
const e = JSON.parse(
|
|
522
|
+
const e = JSON.parse(s);
|
|
159
523
|
return e == null ? "" : String(e);
|
|
160
524
|
} catch {
|
|
161
525
|
return "";
|
|
162
526
|
}
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
const
|
|
167
|
-
return
|
|
168
|
-
},
|
|
169
|
-
const t =
|
|
170
|
-
var
|
|
171
|
-
const e =
|
|
172
|
-
return
|
|
173
|
-
}),
|
|
174
|
-
var
|
|
175
|
-
const e =
|
|
176
|
-
return ((
|
|
527
|
+
}, ae = Symbol("wi-chat-iframe-page-config"), to = (o) => {
|
|
528
|
+
ne(ae, o);
|
|
529
|
+
}, zt = (o, t) => {
|
|
530
|
+
const r = (t == null ? void 0 : t.mainUrl) !== void 0 ? String(O(t.mainUrl)) : Ft(), s = (t == null ? void 0 : t.token) !== void 0 ? String(O(t.token)) : At();
|
|
531
|
+
return o.replace(/\{\{\s*MAIN_URL\s*\}\}/g, r).replace(/\{\{\s*SERVE_URL\s*\}\}/g, Nt()).replace(/\{\{\s*token\s*\}\}/g, s);
|
|
532
|
+
}, Bt = (o) => {
|
|
533
|
+
const t = te() ? oe(ae, {}) : {}, r = I(() => {
|
|
534
|
+
var _;
|
|
535
|
+
const e = O(o), c = ((_ = e == null ? void 0 : e.values) == null ? void 0 : _.url) ?? (e == null ? void 0 : e.url) ?? "";
|
|
536
|
+
return c ? t.resolveUrl ? t.resolveUrl(c) : zt(c, t) : "";
|
|
537
|
+
}), s = I(() => {
|
|
538
|
+
var c;
|
|
539
|
+
const e = O(o);
|
|
540
|
+
return ((c = e == null ? void 0 : e.values) == null ? void 0 : c.srcdoc) ?? (e == null ? void 0 : e.srcdoc) ?? "";
|
|
177
541
|
});
|
|
178
|
-
return { url:
|
|
179
|
-
},
|
|
180
|
-
if (!
|
|
542
|
+
return { url: r, srcdoc: s };
|
|
543
|
+
}, ee = "data-wi-iframe-resizer-child", Ht = (o) => {
|
|
544
|
+
if (!o)
|
|
181
545
|
return !1;
|
|
182
546
|
let t = null;
|
|
183
547
|
try {
|
|
184
|
-
t =
|
|
548
|
+
t = o.contentDocument;
|
|
185
549
|
} catch {
|
|
186
550
|
return !1;
|
|
187
551
|
}
|
|
188
552
|
if (!t)
|
|
189
553
|
return !1;
|
|
190
|
-
const
|
|
191
|
-
if (!
|
|
554
|
+
const r = t.head || t.documentElement;
|
|
555
|
+
if (!r)
|
|
192
556
|
return !1;
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
557
|
+
const s = t.defaultView;
|
|
558
|
+
if (s != null && s.parentIframe || s != null && s.parentIFrame || t.querySelector(`script[${ee}]`))
|
|
195
559
|
return !1;
|
|
196
560
|
const e = t.createElement("script");
|
|
197
|
-
return e.textContent =
|
|
198
|
-
},
|
|
561
|
+
return e.textContent = ke, e.setAttribute(ee, ""), r.appendChild(e), !0;
|
|
562
|
+
}, Kt = /* @__PURE__ */ L({
|
|
199
563
|
__name: "IframePage",
|
|
200
564
|
props: {
|
|
201
565
|
report: {}
|
|
202
566
|
},
|
|
203
|
-
setup(
|
|
204
|
-
const t =
|
|
205
|
-
|
|
567
|
+
setup(o) {
|
|
568
|
+
const t = o, { url: r, srcdoc: s } = Bt(() => t.report), e = (c) => {
|
|
569
|
+
Ht(c.target);
|
|
206
570
|
};
|
|
207
|
-
return (
|
|
571
|
+
return (c, _) => n(r) ? (l(), P(Z, {
|
|
208
572
|
key: 0,
|
|
209
573
|
class: "iframe-page__frame iframe-page__frame--url",
|
|
210
574
|
license: "GPLv3",
|
|
211
|
-
src:
|
|
575
|
+
src: n(r),
|
|
212
576
|
width: "100%",
|
|
213
577
|
"warning-timeout": 0,
|
|
214
578
|
onLoad: e
|
|
215
|
-
}, null, 8, ["src"])) :
|
|
579
|
+
}, null, 8, ["src"])) : n(s) ? (l(), P(Z, {
|
|
216
580
|
key: 1,
|
|
217
581
|
class: "iframe-page iframe-page--srcdoc",
|
|
218
582
|
license: "GPLv3",
|
|
219
|
-
srcdoc:
|
|
583
|
+
srcdoc: n(s),
|
|
220
584
|
width: "100%",
|
|
221
585
|
frameborder: "no",
|
|
222
586
|
border: "0",
|
|
223
587
|
marginwidth: "0",
|
|
224
588
|
marginheight: "0",
|
|
225
589
|
scrolling: "no"
|
|
226
|
-
}, null, 8, ["srcdoc"])) :
|
|
590
|
+
}, null, 8, ["srcdoc"])) : C("", !0);
|
|
227
591
|
}
|
|
228
|
-
}),
|
|
592
|
+
}), Vt = /* @__PURE__ */ T(Kt, [["__scopeId", "data-v-f4c94a4e"]]), Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
229
593
|
__proto__: null,
|
|
230
|
-
default:
|
|
594
|
+
default: Vt
|
|
231
595
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
232
596
|
export {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
597
|
+
Zt as AiAnswerBubble,
|
|
598
|
+
Qt as DeepThinkingSteps,
|
|
599
|
+
Vt as IframePage,
|
|
600
|
+
Ge as KnowledgeStreamResult,
|
|
601
|
+
Pt as OutputFile,
|
|
602
|
+
Ee as createAnswerContentMap,
|
|
603
|
+
Ht as injectIframeResizerChild,
|
|
604
|
+
to as provideIframePageConfig,
|
|
605
|
+
eo as provideOutputFileConfig,
|
|
606
|
+
zt as resolveIframePlaceholders,
|
|
607
|
+
Bt as useIframePage
|
|
242
608
|
};
|
|
243
609
|
//# sourceMappingURL=index.js.map
|