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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AiAnswerReport, OutputFileValue } from 'wi-chat/parser';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
/** output_file 报告(values.file_id / values.file_name) */
|
|
5
|
+
report: AiAnswerReport<OutputFileValue>;
|
|
6
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
7
|
+
/** output_file 报告(values.file_id / values.file_name) */
|
|
8
|
+
report: AiAnswerReport<OutputFileValue>;
|
|
9
|
+
}>>>, {}, {}>;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
12
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
13
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
14
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
15
|
+
} : {
|
|
16
|
+
type: import('vue').PropType<T[K]>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { AiAnswerReport, OutputFileValue } from 'wi-chat/parser';
|
|
3
|
+
|
|
4
|
+
/** 文件预览类型 */
|
|
5
|
+
export type OutputFilePreviewKind = 'image' | 'pdf' | 'html' | 'text' | 'code' | 'audio' | 'video' | 'office' | 'unknown';
|
|
6
|
+
/** 宿主接管预览时收到的请求 */
|
|
7
|
+
export interface OutputFilePreviewRequest {
|
|
8
|
+
/** 文件 id */
|
|
9
|
+
fileId: string;
|
|
10
|
+
/** 文件名(含扩展名) */
|
|
11
|
+
fileName: string;
|
|
12
|
+
/** 加载文件二进制(带缓存) */
|
|
13
|
+
loadFile: () => Promise<Blob>;
|
|
14
|
+
/** 下载文件(已加载时直接复用缓存) */
|
|
15
|
+
download: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/** 宿主注入的 outputFile 配置(provide/inject 通道,见 provideOutputFileConfig) */
|
|
18
|
+
export interface OutputFileConfig {
|
|
19
|
+
/**
|
|
20
|
+
* 按 file_id 加载文件二进制(推荐):宿主用自己的请求层实现,
|
|
21
|
+
* 可携带鉴权头、走 POST /file/download_file 等。
|
|
22
|
+
*/
|
|
23
|
+
loadFile?: (fileId: string) => Promise<Blob>;
|
|
24
|
+
/**
|
|
25
|
+
* 文件直链(loadFile 缺省时使用):本模块用 fetch 拉取并转 Blob。
|
|
26
|
+
* 内置 Web 消息视图默认注入 ChatApi.getFileUrl 的结果。
|
|
27
|
+
*/
|
|
28
|
+
getFileUrl?: (fileId: string) => string;
|
|
29
|
+
/** 追加请求头(如 wisession),仅 getFileUrl 的 fetch 路径使用 */
|
|
30
|
+
getHeaders?: () => Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* 完全接管预览:提供后点击文件卡片不再渲染内置抽屉,
|
|
33
|
+
* 由宿主打开自己的侧边栏 / 弹窗等。
|
|
34
|
+
*/
|
|
35
|
+
openPreview?: (request: OutputFilePreviewRequest) => void;
|
|
36
|
+
/** 自定义下载:缺省用 Blob + a[download] 触发浏览器下载 */
|
|
37
|
+
downloadFile?: (payload: {
|
|
38
|
+
fileId: string;
|
|
39
|
+
fileName: string;
|
|
40
|
+
blob: Blob;
|
|
41
|
+
}) => void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 宿主注入 outputFile 配置:在组件 setup 内调用一次,其组件树内的 OutputFile
|
|
45
|
+
* (含懒加载渲染器)即可通过 useOutputFile 读到。
|
|
46
|
+
* @param config 宿主配置(loadFile / getFileUrl / openPreview / downloadFile 等)
|
|
47
|
+
*/
|
|
48
|
+
export declare const provideOutputFileConfig: (config: OutputFileConfig) => void;
|
|
49
|
+
/** useOutputFile 返回值:纯 UI 组件渲染文件卡片与预览抽屉所需的全部状态 */
|
|
50
|
+
export interface UseOutputFileReturn {
|
|
51
|
+
/** 文件 id */
|
|
52
|
+
fileId: ComputedRef<string>;
|
|
53
|
+
/** 文件名(缺省「未命名文件」) */
|
|
54
|
+
fileName: ComputedRef<string>;
|
|
55
|
+
/** 扩展名(小写,无扩展名时为空串) */
|
|
56
|
+
extension: ComputedRef<string>;
|
|
57
|
+
/** 预览类型 */
|
|
58
|
+
previewKind: ComputedRef<OutputFilePreviewKind>;
|
|
59
|
+
/** 文件大小文案(未加载时为空串) */
|
|
60
|
+
fileSize: ComputedRef<string>;
|
|
61
|
+
/** 内置抽屉是否可见 */
|
|
62
|
+
visible: Ref<boolean>;
|
|
63
|
+
/** 文件是否加载中 */
|
|
64
|
+
loading: Ref<boolean>;
|
|
65
|
+
/** 加载 / 下载错误文案 */
|
|
66
|
+
error: Ref<string>;
|
|
67
|
+
/** 是否属于暂不支持在线预览的类型(Office / 二进制未知类型) */
|
|
68
|
+
unsupported: Ref<boolean>;
|
|
69
|
+
/** 文本 / HTML / 代码预览内容 */
|
|
70
|
+
textContent: Ref<string>;
|
|
71
|
+
/** 图片 / PDF / 音视频预览的 object URL */
|
|
72
|
+
objectUrl: Ref<string>;
|
|
73
|
+
/** 打开预览(有 openPreview 时交给宿主) */
|
|
74
|
+
open: () => Promise<void>;
|
|
75
|
+
/** 关闭内置抽屉 */
|
|
76
|
+
close: () => void;
|
|
77
|
+
/** 下载文件 */
|
|
78
|
+
download: () => Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* outputFile 操作逻辑:从 report 算出文件信息,并提供加载 / 预览 / 下载能力。
|
|
82
|
+
* @param report output_file 报告(支持 ref / getter / 直接对象,流式更新时自动重算)
|
|
83
|
+
* @returns 文件信息、抽屉状态与操作方法
|
|
84
|
+
*/
|
|
85
|
+
export declare const useOutputFile: (report: MaybeRefOrGetter<AiAnswerReport<OutputFileValue> | undefined>) => UseOutputFileReturn;
|
package/dist/renderers/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.flex[data-v-efad55c8]{display:flex}.justify-start[data-v-efad55c8]{justify-content:flex-start}.ai-answer-bubble[data-v-efad55c8]{width:100%;min-width:0;color:#27344d;font-size:14px;line-height:1.75;word-break:break-word}.ai-answer-bubble__error[data-v-efad55c8]{color:#f56c6c}.ai-answer-bubble__status[data-v-efad55c8]{margin-top:4px;color:#8a93a6;font-size:12px}.ai-answer-bubble__loading[data-v-efad55c8]{display:flex;align-items:center;gap:8px;color:#76819a}.ai-answer-bubble__pulse[data-v-efad55c8]{width:7px;height:7px;border-radius:50%;background:var(--wi-chat-primary);box-shadow:0 0 #5b7fff4d;animation:wi-answer-pulse-efad55c8 1.6s ease-out infinite}@keyframes wi-answer-pulse-efad55c8{70%{box-shadow:0 0 0 6px #5b7fff00}to{box-shadow:0 0 #5b7fff00}}.deep-thinking[data-v-c6f5cb64]{margin-bottom:12px;overflow:hidden;border:1px solid color-mix(in srgb,var(--wi-chat-primary) 20%,transparent);border-radius:9px;background:color-mix(in srgb,var(--wi-chat-primary) 6%,#fff)}.deep-thinking__header[data-v-c6f5cb64]{display:flex;align-items:center;gap:8px;width:100%;padding:9px 11px;border:0;background:transparent;color:#53617c;cursor:pointer;transition:background-color .2s ease,color .2s ease}.deep-thinking__header[data-v-c6f5cb64]:hover{background:color-mix(in srgb,var(--wi-chat-primary) 8%,transparent);color:var(--wi-chat-primary)}.deep-thinking__title[data-v-c6f5cb64]{display:flex;flex:1;align-items:center;gap:8px;text-align:left;font-weight:600}.deep-thinking__title[data-v-c6f5cb64]:before{width:6px;height:6px;border-radius:50%;background:var(--wi-chat-primary);content:""}.deep-thinking__count[data-v-c6f5cb64],.deep-thinking__index[data-v-c6f5cb64]{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;border-radius:50%;font-size:12px}.deep-thinking__count[data-v-c6f5cb64]{background:color-mix(in srgb,var(--wi-chat-primary) 10%,transparent);color:var(--wi-chat-primary);font-weight:600}.deep-thinking__list[data-v-c6f5cb64]{display:flex;flex-direction:column;gap:9px;padding:10px 11px 11px;border-top:1px solid #e8ecf8;background:#ffffffb8;color:#5f6d87}.deep-thinking__item[data-v-c6f5cb64]{display:grid;grid-template-columns:20px minmax(0,1fr);gap:8px;font-size:13px;line-height:20px}.deep-thinking__index[data-v-c6f5cb64]{border:1px solid #dce3f3;background:#fff;color:#687597}.deep-thinking__item[data-v-c6f5cb64] p{margin:0}.knowledge-result>div+div[data-v-1827e802]{margin-top:12px}.knowledge-result[data-v-1827e802] .markdown-it{overflow-wrap:break-word}.knowledge-result[data-v-1827e802] .wi-md-table-wrap{position:relative}.knowledge-result[data-v-1827e802] .wi-md-table-download{position:absolute;top:4px;right:4px;display:inline-flex;align-items:center;justify-content:center;padding:4px;border:1px solid var(--wi-chat-border, #e1e4e8);border-radius:4px;background:var(--wi-chat-bg, #fff);color:var(--wi-chat-text-secondary, #8a93a6);cursor:pointer;opacity:0;transition:opacity .2s ease;z-index:10}.knowledge-result[data-v-1827e802] .wi-md-table-wrap:hover .wi-md-table-download{opacity:1}.knowledge-result[data-v-1827e802] .wi-md-table-download:hover{color:var(--wi-chat-primary, #5b7fff);border-color:var(--wi-chat-primary, #5b7fff)}.iframe-page__frame[data-v-f4c94a4e]{width:100%;border:0}.iframe-page__frame--url[data-v-f4c94a4e]{height:var(--wi-chat-iframe-url-height, 70vh)}
|
|
1
|
+
@charset "UTF-8";.flex[data-v-efad55c8]{display:flex}.justify-start[data-v-efad55c8]{justify-content:flex-start}.ai-answer-bubble[data-v-efad55c8]{width:100%;min-width:0;color:#27344d;font-size:14px;line-height:1.75;word-break:break-word}.ai-answer-bubble__error[data-v-efad55c8]{color:#f56c6c}.ai-answer-bubble__status[data-v-efad55c8]{margin-top:4px;color:#8a93a6;font-size:12px}.ai-answer-bubble__loading[data-v-efad55c8]{display:flex;align-items:center;gap:8px;color:#76819a}.ai-answer-bubble__pulse[data-v-efad55c8]{width:7px;height:7px;border-radius:50%;background:var(--wi-chat-primary);box-shadow:0 0 #5b7fff4d;animation:wi-answer-pulse-efad55c8 1.6s ease-out infinite}@keyframes wi-answer-pulse-efad55c8{70%{box-shadow:0 0 0 6px #5b7fff00}to{box-shadow:0 0 #5b7fff00}}.deep-thinking[data-v-c6f5cb64]{margin-bottom:12px;overflow:hidden;border:1px solid color-mix(in srgb,var(--wi-chat-primary) 20%,transparent);border-radius:9px;background:color-mix(in srgb,var(--wi-chat-primary) 6%,#fff)}.deep-thinking__header[data-v-c6f5cb64]{display:flex;align-items:center;gap:8px;width:100%;padding:9px 11px;border:0;background:transparent;color:#53617c;cursor:pointer;transition:background-color .2s ease,color .2s ease}.deep-thinking__header[data-v-c6f5cb64]:hover{background:color-mix(in srgb,var(--wi-chat-primary) 8%,transparent);color:var(--wi-chat-primary)}.deep-thinking__title[data-v-c6f5cb64]{display:flex;flex:1;align-items:center;gap:8px;text-align:left;font-weight:600}.deep-thinking__title[data-v-c6f5cb64]:before{width:6px;height:6px;border-radius:50%;background:var(--wi-chat-primary);content:""}.deep-thinking__count[data-v-c6f5cb64],.deep-thinking__index[data-v-c6f5cb64]{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;border-radius:50%;font-size:12px}.deep-thinking__count[data-v-c6f5cb64]{background:color-mix(in srgb,var(--wi-chat-primary) 10%,transparent);color:var(--wi-chat-primary);font-weight:600}.deep-thinking__list[data-v-c6f5cb64]{display:flex;flex-direction:column;gap:9px;padding:10px 11px 11px;border-top:1px solid #e8ecf8;background:#ffffffb8;color:#5f6d87}.deep-thinking__item[data-v-c6f5cb64]{display:grid;grid-template-columns:20px minmax(0,1fr);gap:8px;font-size:13px;line-height:20px}.deep-thinking__index[data-v-c6f5cb64]{border:1px solid #dce3f3;background:#fff;color:#687597}.deep-thinking__item[data-v-c6f5cb64] p{margin:0}.knowledge-result>div+div[data-v-1827e802]{margin-top:12px}.knowledge-result[data-v-1827e802] .markdown-it{overflow-wrap:break-word}.knowledge-result[data-v-1827e802] .wi-md-table-wrap{position:relative}.knowledge-result[data-v-1827e802] .wi-md-table-download{position:absolute;top:4px;right:4px;display:inline-flex;align-items:center;justify-content:center;padding:4px;border:1px solid var(--wi-chat-border, #e1e4e8);border-radius:4px;background:var(--wi-chat-bg, #fff);color:var(--wi-chat-text-secondary, #8a93a6);cursor:pointer;opacity:0;transition:opacity .2s ease;z-index:10}.knowledge-result[data-v-1827e802] .wi-md-table-wrap:hover .wi-md-table-download{opacity:1}.knowledge-result[data-v-1827e802] .wi-md-table-download:hover{color:var(--wi-chat-primary, #5b7fff);border-color:var(--wi-chat-primary, #5b7fff)}.wi-output-file[data-v-f61a91b5]{width:100%;max-width:380px}.wi-output-file__card[data-v-f61a91b5]{display:flex;align-items:center;gap:12px;width:100%;padding:12px 14px;border:1px solid var(--wi-chat-border, #e1e4e8);border-left:3px solid var(--wi-chat-primary, #5b7fff);border-radius:12px;background:var(--wi-chat-bg, #fff);cursor:pointer;transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease}.wi-output-file__card[data-v-f61a91b5]:hover,.wi-output-file__card[data-v-f61a91b5]:focus-visible{border-color:color-mix(in srgb,var(--wi-chat-primary, #5b7fff) 45%,#fff);box-shadow:0 10px 26px #2d5ba021;outline:none;transform:translateY(-1px)}.wi-output-file__icon[data-v-f61a91b5]{display:grid;flex:0 0 40px;width:40px;height:46px;place-items:center;border:1px solid #e4ebf5;border-radius:9px;background:#f3f7fd;color:var(--wi-chat-primary, #5b7fff)}.wi-output-file__icon svg[data-v-f61a91b5]{width:22px;height:22px}.wi-output-file__icon.is-image[data-v-f61a91b5]{background:#eefbf4;border-color:#d6f0e0;color:#16a34a}.wi-output-file__icon.is-pdf[data-v-f61a91b5]{background:#fff1f0;border-color:#fbd9d6;color:#e5484d}.wi-output-file__icon.is-office[data-v-f61a91b5]{background:#eef4ff;border-color:#dbe7ff;color:#2f6feb}.wi-output-file__icon.is-audio[data-v-f61a91b5],.wi-output-file__icon.is-video[data-v-f61a91b5]{background:#f6efff;border-color:#ead9ff;color:#8b5cf6}.wi-output-file__icon.is-text[data-v-f61a91b5],.wi-output-file__icon.is-code[data-v-f61a91b5],.wi-output-file__icon.is-html[data-v-f61a91b5]{background:#f4f6fa;border-color:#e3e8f0;color:#536176}.wi-output-file__info[data-v-f61a91b5]{flex:1;min-width:0}.wi-output-file__name[data-v-f61a91b5]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--wi-chat-text, #27344d);font-size:14px;font-weight:600}.wi-output-file__meta[data-v-f61a91b5]{display:flex;align-items:center;gap:8px;margin-top:4px;color:var(--wi-chat-text-secondary, #8a93a6);font-size:11px}.wi-output-file__ext[data-v-f61a91b5]{font-weight:600;letter-spacing:.04em}.wi-output-file__download[data-v-f61a91b5]{display:grid;flex:0 0 32px;width:32px;height:32px;place-items:center;border:1px solid var(--wi-chat-border, #e1e4e8);border-radius:8px;background:#f7f9fc;color:#536176;cursor:pointer;transition:color .15s ease,background .15s ease,border-color .15s ease}.wi-output-file__download[data-v-f61a91b5]:hover,.wi-output-file__download[data-v-f61a91b5]:focus-visible{border-color:var(--wi-chat-primary, #5b7fff);background:var(--wi-chat-primary, #5b7fff);color:#fff;outline:none}.wi-output-file__download svg[data-v-f61a91b5]{width:16px;height:16px}.wi-output-file-mask[data-v-f61a91b5]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:3000;display:flex;justify-content:flex-end;background:#0f172a52}.wi-output-file-drawer[data-v-f61a91b5]{display:flex;flex-direction:column;width:min(620px,92vw);height:100%;background:var(--wi-chat-bg, #fff);box-shadow:-12px 0 32px #0f172a2e}@media (max-width: 640px){.wi-output-file-drawer[data-v-f61a91b5]{width:100vw}}.wi-output-file-drawer__head[data-v-f61a91b5]{display:flex;align-items:flex-start;gap:12px;padding:16px 18px;border-bottom:1px solid var(--wi-chat-border, #e1e4e8)}.wi-output-file-drawer__title[data-v-f61a91b5]{flex:1;min-width:0}.wi-output-file-drawer__ext[data-v-f61a91b5]{display:inline-block;padding:2px 6px;border-radius:4px;background:#eef2ff;color:var(--wi-chat-primary, #5b7fff);font-size:11px;font-weight:600;letter-spacing:.04em}.wi-output-file-drawer__name[data-v-f61a91b5]{margin-top:6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--wi-chat-text, #27344d);font-size:15px;font-weight:600}.wi-output-file-drawer__size[data-v-f61a91b5]{margin-top:4px;color:var(--wi-chat-text-secondary, #8a93a6);font-size:12px}.wi-output-file-drawer__actions[data-v-f61a91b5]{display:flex;flex:0 0 auto;gap:8px}.wi-output-file-drawer__btn[data-v-f61a91b5]{padding:5px 12px;border:1px solid var(--wi-chat-border, #e1e4e8);border-radius:7px;background:#f7f9fc;color:#536176;font-family:inherit;font-size:12px;cursor:pointer}.wi-output-file-drawer__btn[data-v-f61a91b5]:hover,.wi-output-file-drawer__btn[data-v-f61a91b5]:focus-visible{border-color:var(--wi-chat-primary, #5b7fff);color:var(--wi-chat-primary, #5b7fff);outline:none}.wi-output-file-drawer__btn--close[data-v-f61a91b5]{padding:3px 10px;font-size:18px;line-height:1.2}.wi-output-file-drawer__body[data-v-f61a91b5]{flex:1;min-height:0;padding:16px 18px;overflow:auto;background:#f8fafc}.wi-output-file-drawer__state[data-v-f61a91b5]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;height:100%;color:var(--wi-chat-text-secondary, #8a93a6);font-size:13px;text-align:center}.wi-output-file-drawer__state.is-error[data-v-f61a91b5]{color:#f56c6c}.wi-output-file-drawer__state p[data-v-f61a91b5]{margin:0}.wi-output-file-drawer__image[data-v-f61a91b5]{display:block;max-width:100%;margin:0 auto;border-radius:8px;background:#fff}.wi-output-file-drawer__frame[data-v-f61a91b5]{width:100%;height:100%;min-height:70vh;border:0;border-radius:8px;background:#fff}.wi-output-file-drawer__media[data-v-f61a91b5]{display:block;width:100%;max-height:70vh;margin:0 auto}.wi-output-file-drawer__text[data-v-f61a91b5]{min-height:100%;margin:0;padding:14px;border:1px solid var(--wi-chat-border, #e1e4e8);border-radius:8px;background:#fff;color:var(--wi-chat-text, #27344d);font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:12.5px;line-height:1.6;white-space:pre-wrap;word-break:break-word}.wi-output-file-fade-enter-active[data-v-f61a91b5],.wi-output-file-fade-leave-active[data-v-f61a91b5]{transition:opacity .18s ease}.wi-output-file-fade-enter-from[data-v-f61a91b5],.wi-output-file-fade-leave-to[data-v-f61a91b5]{opacity:0}.iframe-page__frame[data-v-f4c94a4e]{width:100%;border:0}.iframe-page__frame--url[data-v-f4c94a4e]{height:var(--wi-chat-iframe-url-height, 70vh)}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
|
|
2
|
+
import { OutputFileConfig } from 'wi-chat/renderers';
|
|
2
3
|
import { ChatAgentItem, ChatSubmitPayload } from './types';
|
|
3
4
|
|
|
4
5
|
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -10,6 +11,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
10
11
|
baseURL?: string;
|
|
11
12
|
/** 自定义文件地址解析函数 */
|
|
12
13
|
getFileUrl?: (fileId: string) => string;
|
|
14
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
15
|
+
outputFileConfig?: OutputFileConfig;
|
|
13
16
|
/** 历史消息是否加载中 */
|
|
14
17
|
loading?: boolean;
|
|
15
18
|
/** 流式回答是否进行中 */
|
|
@@ -67,6 +70,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__
|
|
|
67
70
|
baseURL?: string;
|
|
68
71
|
/** 自定义文件地址解析函数 */
|
|
69
72
|
getFileUrl?: (fileId: string) => string;
|
|
73
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
74
|
+
outputFileConfig?: OutputFileConfig;
|
|
70
75
|
/** 历史消息是否加载中 */
|
|
71
76
|
loading?: boolean;
|
|
72
77
|
/** 流式回答是否进行中 */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
|
|
2
|
+
import { OutputFileConfig } from 'wi-chat/renderers';
|
|
2
3
|
|
|
3
4
|
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
5
|
/** 当前分组消息列表 */
|
|
@@ -9,6 +10,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
9
10
|
baseURL?: string;
|
|
10
11
|
/** 自定义文件地址解析函数 */
|
|
11
12
|
getFileUrl?: (fileId: string) => string;
|
|
13
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
14
|
+
outputFileConfig?: OutputFileConfig;
|
|
12
15
|
/** 历史消息是否加载中 */
|
|
13
16
|
loading?: boolean;
|
|
14
17
|
/** 空态主标题 */
|
|
@@ -39,6 +42,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
39
42
|
baseURL?: string;
|
|
40
43
|
/** 自定义文件地址解析函数 */
|
|
41
44
|
getFileUrl?: (fileId: string) => string;
|
|
45
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
46
|
+
outputFileConfig?: OutputFileConfig;
|
|
42
47
|
/** 历史消息是否加载中 */
|
|
43
48
|
loading?: boolean;
|
|
44
49
|
/** 空态主标题 */
|
package/dist/web-ui/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("wi-chat/renderers"),e=require("vue"),N=require("element-plus"),P=require("wi-chat/parser"),M=require("wi-chat/tools"),I=i=>(e.pushScopeId("data-v-dc2d5f2b"),i=i(),e.popScopeId(),i),W={class:"wi-web-attach-card__icon"},H=I(()=>e.createElementVNode("div",{class:"wi-web-attach-card__image-fallback"},[e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.createElementVNode("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.createElementVNode("polyline",{points:"21 15 16 10 5 21"})])],-1)),K=I(()=>e.createElementVNode("div",{class:"wi-web-attach-card__image-fallback"},[e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.createElementVNode("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.createElementVNode("polyline",{points:"21 15 16 10 5 21"})])],-1)),Y={key:1,viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2"},X=e.createStaticVNode('<rect x="3" y="3" width="18" height="18" rx="2" data-v-dc2d5f2b></rect><path d="M3 9h18" data-v-dc2d5f2b></path><path d="M3 15h18" data-v-dc2d5f2b></path><path d="M9 3v18" data-v-dc2d5f2b></path><path d="M15 3v18" data-v-dc2d5f2b></path>',5),Z=[X],G={key:2,viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2"},J=I(()=>e.createElementVNode("path",{d:"M18 20V10"},null,-1)),ee=I(()=>e.createElementVNode("path",{d:"M12 20V4"},null,-1)),te=I(()=>e.createElementVNode("path",{d:"M6 20v-6"},null,-1)),oe=[J,ee,te],le={key:3,viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2"},ne=e.createStaticVNode('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" data-v-dc2d5f2b></path><polyline points="14 2 14 8 20 8" data-v-dc2d5f2b></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-dc2d5f2b></line><line x1="16" y1="17" x2="8" y2="17" data-v-dc2d5f2b></line><polyline points="10 9 9 9 8 9" data-v-dc2d5f2b></polyline>',5),ae=[ne],se={class:"wi-web-attach-card__info"},ie=["title"],re={key:0,class:"wi-web-attach-card__size"},ce={class:"wi-web-attach-card__actions"},de=I(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),e.createElementVNode("line",{x1:"12",y1:"15",x2:"12",y2:"3"})],-1)),ue=[de],pe=e.defineComponent({__name:"AttachmentCard",props:{item:{},clickable:{type:Boolean,default:!1},removable:{type:Boolean,default:!1},downloadable:{type:Boolean,default:void 0},baseURL:{default:""},getFileUrl:{type:Function,default:void 0}},emits:["click","remove","download"],setup(i,{emit:g}){const n=i,c=g,u=e.computed(()=>{var o;return((o=n.item)==null?void 0:o.attachContent)||{}}),_=e.computed(()=>P.isImageAttachment(n.item)),v=e.computed(()=>P.resolveAttachPreviewUrl(n.item,n.baseURL,n.getFileUrl)),l=e.computed(()=>{if(n.removable)return!1;if(n.downloadable!==void 0)return n.downloadable;if(n.item.type&&n.item.type!=="file")return!1;const o=u.value;return!!(o.fileId||o.raw)}),s=()=>{c("click",n.item)},a=()=>{c("remove",n.item)},r=async()=>{c("download",n.item),await M.downloadAttachment(n.item,{baseURL:n.baseURL,getFileUrl:n.getFileUrl})};return(o,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wi-web-attach-card",{"is-clickable":o.clickable||!!o.$attrs.onClick}]),onClick:s},[e.createElementVNode("div",W,[e.renderSlot(o.$slots,"icon",{item:o.item},()=>[_.value&&v.value?(e.openBlock(),e.createBlock(e.unref(N.ElImage),{key:0,src:v.value,"preview-src-list":[v.value],"zoom-rate":1.2,"preview-teleported":"",fit:"cover",class:"wi-web-attach-card__image",onClick:d[0]||(d[0]=e.withModifiers(()=>{},["stop"]))},{placeholder:e.withCtx(()=>[H]),error:e.withCtx(()=>[K]),_:1},8,["src","preview-src-list"])):o.item.type==="table"?(e.openBlock(),e.createElementBlock("svg",Y,Z)):o.item.type==="metric"?(e.openBlock(),e.createElementBlock("svg",G,oe)):(e.openBlock(),e.createElementBlock("svg",le,ae))],!0)]),e.createElementVNode("div",se,[e.createElementVNode("div",{class:"wi-web-attach-card__name",title:o.item.name},[e.renderSlot(o.$slots,"title",{item:o.item},()=>[e.createTextVNode(e.toDisplayString(o.item.name),1)],!0)],8,ie),o.item.description||o.$slots.description?(e.openBlock(),e.createElementBlock("div",re,[e.renderSlot(o.$slots,"description",{item:o.item},()=>[e.createTextVNode(e.toDisplayString(o.item.description),1)],!0)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ce,[e.renderSlot(o.$slots,"actions",{item:o.item},()=>[l.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-web-attach-card__action-btn wi-web-attach-card__download",title:"下载附件",onClick:e.withModifiers(r,["stop"])},ue)):e.createCommentVNode("",!0),o.removable?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"wi-web-attach-card__action-btn wi-web-attach-card__delete",title:"删除附件",onClick:e.withModifiers(a,["stop"])}," × ")):e.createCommentVNode("",!0)],!0)])],2))}}),S=(i,g)=>{const n=i.__vccOpts||i;for(const[c,u]of g)n[c]=u;return n},L=S(pe,[["__scopeId","data-v-dc2d5f2b"]]),me={key:0,class:"wi-web-attachment-list"},he=e.defineComponent({__name:"AttachmentList",props:{items:{default:()=>[]},removable:{type:Boolean,default:!1},downloadable:{type:Boolean,default:void 0},clickable:{type:Boolean,default:!1},baseURL:{default:""},getFileUrl:{type:Function,default:void 0}},emits:["remove","click","download"],setup(i,{emit:g}){const n=i,c=g,u=e.computed(()=>(n.items||[]).map((a,r)=>{var p,b;const o=P.normalizeAttachment(a),d=(p=o.attachContent)==null?void 0:p.raw,w=((b=o.attachContent)==null?void 0:b.fileId)||(d?`${d.name}_${d.size}_${r}`:`${o.name}_${r}`);return{...o,key:w}})),_=(s,a)=>{c("remove",s,a)},v=(s,a)=>{c("click",s,a)},l=(s,a)=>{c("download",s,a)};return(s,a)=>u.value.length>0?(e.openBlock(),e.createElementBlock("div",me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(r,o)=>(e.openBlock(),e.createBlock(L,{key:r.key||o,item:r,removable:s.removable,downloadable:s.downloadable,clickable:s.clickable||!!s.$attrs.onClick,"base-u-r-l":s.baseURL,"get-file-url":s.getFileUrl,onClick:d=>v(r,o),onRemove:d=>_(o,r),onDownload:d=>l(r,o)},{icon:e.withCtx(d=>[e.renderSlot(s.$slots,"icon",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),title:e.withCtx(d=>[e.renderSlot(s.$slots,"title",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),description:e.withCtx(d=>[e.renderSlot(s.$slots,"description",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),actions:e.withCtx(d=>[e.renderSlot(s.$slots,"actions",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),_:2},1032,["item","removable","downloadable","clickable","base-u-r-l","get-file-url","onClick","onRemove","onDownload"]))),128))])):e.createCommentVNode("",!0)}}),T=S(he,[["__scopeId","data-v-ff76d134"]]),V=i=>(e.pushScopeId("data-v-e3cdddb7"),i=i(),e.popScopeId(),i),we={class:"wi-web-inputbox"},_e={key:0,class:"wi-web-inputbox__top-bar"},ve={key:0,class:"wi-web-inputbox__agent-bar"},be={class:"wi-web-inputbox__agent-icon-wrapper"},fe=["src"],ge={key:1,class:"wi-web-inputbox__agent-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ke=V(()=>e.createElementVNode("circle",{cx:"12",cy:"8",r:"4"},null,-1)),ye=V(()=>e.createElementVNode("path",{d:"M4 20c0-4 4-6 8-6s8 2 8 6"},null,-1)),Be=[ke,ye],Ee={class:"wi-web-inputbox__agent-title"},Ve=V(()=>e.createElementVNode("path",{d:"M840.4 300H183.6c-19.7 0-30.7 22.7-18.5 37.1l328.4 388.7c9.5 11.2 27.5 11.2 37 0l328.4-388.7c12.2-14.4 1.2-37.1-18.5-37.1z",fill:"currentColor"},null,-1)),Ce=[Ve],Ne={class:"wi-web-agent-list"},$e=V(()=>e.createElementVNode("div",{class:"wi-web-agent-list__header"},"切换智能体",-1)),Se={key:0,class:"wi-web-agent-list__empty"},Ae=["onClick"],Ie={class:"wi-web-agent-item__left"},Ue=["src"],Pe={key:1,class:"wi-web-agent-item__avatar-fallback"},Re=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("circle",{cx:"12",cy:"8",r:"4"}),e.createElementVNode("path",{d:"M4 20c0-4 4-6 8-6s8 2 8 6"})],-1)),xe=[Re],Te={class:"wi-web-agent-item__title"},Fe={key:0,class:"wi-web-agent-item__check"},ze={key:1,class:"wi-web-inputbox__options"},Me={class:"wi-web-inputbox__main"},Le={key:0,class:"wi-web-inputbox__attachments"},De={class:"wi-web-inputbox__footer"},Oe={class:"wi-web-inputbox__footer-left"},je={class:"wi-web-inputbox__footer-right"},Qe={key:0,class:"wi-web-inputbox__counter"},qe=V(()=>e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16",fill:"currentColor"},[e.createElementVNode("path",{d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896z m0 85.333333a362.666667 362.666667 0 1 0 0 725.333334 362.666667 362.666667 0 0 0 0-725.333334z m120.746667 181.333334a42.666667 42.666667 0 0 1 54.826666 4.693333l5.546667 6.357334a42.666667 42.666667 0 0 1-4.693333 54.826666l-6.357334 5.546667-114.730666 114.773333 114.730666 114.730667a42.666667 42.666667 0 0 1 5.461334 54.826666l-5.461334 6.357334a42.666667 42.666667 0 0 1-54.826666 5.461333l-6.357334-5.461333-114.730666-114.730667-114.730667 114.730667a42.666667 42.666667 0 0 1-54.826667 5.461333l-6.357333-5.461333a42.666667 42.666667 0 0 1-5.461333-54.826667l5.461333-6.357333 114.730667-114.730667-114.730667-114.773333a42.666667 42.666667 0 0 1-5.461333-54.826667l5.461333-6.357333a42.666667 42.666667 0 0 1 54.826667-5.461334l6.357333 5.461334 114.730667 114.730666 114.730666-114.730666a42.666667 42.666667 0 0 1 24.32-11.434667z"})],-1)),We=[qe],He=["disabled"],Ke=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})],-1)),Ye=[Ke],Xe=["accept"],Ze=V(()=>e.createElementVNode("div",{class:"wi-web-inputbox__divider"},null,-1)),Ge=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},[e.createElementVNode("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})],-1)),Je=[Ge],et=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"currentColor"},[e.createElementVNode("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"})],-1)),tt=[et],ot=e.defineComponent({__name:"Inputbox",props:{modelValue:{default:""},placeholder:{default:'"↑↓"切换历史输入,"⇧↵"换行'},disabled:{type:Boolean,default:!1},talking:{type:Boolean,default:!1},maxlength:{default:1024},autosize:{type:[Object,Boolean],default:()=>({minRows:3,maxRows:8})},showAgentBar:{type:Boolean,default:!0},showUpload:{type:Boolean,default:!0},showWordLimit:{type:Boolean,default:!0},accept:{default:".csv,.txt,.pdf,.doc,.docx,.xls,.xlsx,.png,.jpg,.jpeg,.gif,.mp4"},agentList:{default:()=>[]},currentAgent:{default:null},defaultAgentTitle:{default:"系统默认智能体"},baseURL:{default:""},getFileUrl:{type:Function,default:void 0},incPrevQuestion:{default:"Y"},showIncPrevQuestion:{type:Boolean,default:!0}},emits:["update:modelValue","submit","stop","selectAgent","update:files","update:attachments","update:incPrevQuestion"],setup(i,{expose:g,emit:n}){const c=i,u=n,_=e.ref(null),v=e.ref(null),l=e.ref(!1),s=t=>P.parseRealtimeAttachment(t),a=e.ref([]),r=e.computed(()=>!!!(c.modelValue&&c.modelValue.trim())),o=t=>t?c.getFileUrl?c.getFileUrl(t):P.resolveRemoteFileUrl(t,c.baseURL,"/algorithm/get_file_data"):"",d=t=>{u("selectAgent",t),l.value=!1},w=t=>{u("update:incPrevQuestion",t?"N":"Y")},p=()=>{u("update:modelValue","")},b=()=>{v.value&&(v.value.value="",v.value.click())},k=t=>{const h=t.target;if(h.files&&h.files.length>0){const m=Array.from(h.files);for(const f of m)a.value.some(U=>{var z;const x=((z=U.attachContent)==null?void 0:z.raw)||U.raw;return x&&x.name===f.name&&x.size===f.size&&x.lastModified===f.lastModified})||a.value.push(s(f));const B=a.value.map(f=>{var $;return(($=f.attachContent)==null?void 0:$.raw)||f.raw}).filter(Boolean);u("update:files",B),u("update:attachments",[...a.value])}},C=t=>{var f;const h=a.value.splice(t,1)[0],m=((f=h==null?void 0:h.attachContent)==null?void 0:f.url)||(h==null?void 0:h.url);m&&m.startsWith("blob:")&&URL.revokeObjectURL(m);const B=a.value.map($=>{var U;return((U=$.attachContent)==null?void 0:U.raw)||$.raw}).filter(Boolean);u("update:files",B),u("update:attachments",[...a.value])},A=()=>{a.value.forEach(t=>{var m;const h=((m=t==null?void 0:t.attachContent)==null?void 0:m.url)||(t==null?void 0:t.url);h&&h.startsWith("blob:")&&URL.revokeObjectURL(h)}),a.value=[],u("update:files",[]),u("update:attachments",[])},R=()=>{if(c.disabled||r.value)return;const t=c.modelValue||"",h=a.value.map(B=>{var f;return((f=B.attachContent)==null?void 0:f.raw)||B.raw}).filter(Boolean),m=[...a.value];u("submit",{text:t,files:h,attachments:m,agent:c.currentAgent}),a.value=[],u("update:files",[]),u("update:attachments",[])},y=t=>{t.isComposing||t.keyCode===229||(t.preventDefault(),R())};return e.onBeforeUnmount(()=>{A()}),g({clearFiles:A,getFiles:()=>a.value.map(t=>{var h;return((h=t.attachContent)==null?void 0:h.raw)||t.raw}).filter(Boolean),getAttachments:()=>a.value,focus:()=>{var t;(t=_.value)==null||t.focus()}}),(t,h)=>(e.openBlock(),e.createElementBlock("div",we,[t.showAgentBar||t.showIncPrevQuestion?(e.openBlock(),e.createElementBlock("div",_e,[t.showAgentBar?(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(e.unref(N.ElPopover),{visible:l.value,"onUpdate:visible":h[0]||(h[0]=m=>l.value=m),placement:"top-start",width:260,trigger:"click","popper-class":"wi-web-agent-popover"},{reference:e.withCtx(()=>{var m,B,f;return[e.createElementVNode("div",{class:e.normalizeClass(["wi-web-inputbox__agent-btn",{"is-disabled":t.disabled||t.talking}])},[e.createElementVNode("div",be,[(m=t.currentAgent)!=null&&m.image_id&&o(t.currentAgent.image_id)?(e.openBlock(),e.createElementBlock("img",{key:0,src:o(t.currentAgent.image_id),class:"wi-web-inputbox__agent-avatar"},null,8,fe)):(e.openBlock(),e.createElementBlock("svg",ge,Be))]),e.createElementVNode("span",Ee," @"+e.toDisplayString(((B=t.currentAgent)==null?void 0:B.entry_title)||((f=t.currentAgent)==null?void 0:f.entry_id)||t.defaultAgentTitle),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["wi-web-inputbox__agent-arrow",{"is-active":l.value}]),viewBox:"0 0 1024 1024",width:"12",height:"12"},Ce,2))],2)]}),default:e.withCtx(()=>[e.createElementVNode("div",Ne,[$e,!t.agentList||t.agentList.length===0?(e.openBlock(),e.createElementBlock("div",Se," 暂无可选智能体 ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.agentList,m=>{var B,f;return e.openBlock(),e.createElementBlock("div",{key:m.entry_id,class:e.normalizeClass(["wi-web-agent-item",{"is-active":m.entry_id===((B=t.currentAgent)==null?void 0:B.entry_id)}]),onClick:$=>d(m)},[e.createElementVNode("div",Ie,[m.image_id&&o(m.image_id)?(e.openBlock(),e.createElementBlock("img",{key:0,src:o(m.image_id),class:"wi-web-agent-item__avatar"},null,8,Ue)):(e.openBlock(),e.createElementBlock("div",Pe,xe)),e.createElementVNode("span",Te,e.toDisplayString(m.entry_title||m.entry_id),1)]),m.entry_id===((f=t.currentAgent)==null?void 0:f.entry_id)?(e.openBlock(),e.createElementBlock("span",Fe,"✓")):e.createCommentVNode("",!0)],10,Ae)}),128))])]),_:1},8,["visible"])])):e.createCommentVNode("",!0),t.showIncPrevQuestion?(e.openBlock(),e.createElementBlock("div",ze,[e.createVNode(e.unref(N.ElCheckbox),{class:"wi-web-inputbox__ignore-prev","model-value":t.incPrevQuestion==="N","onUpdate:modelValue":w},{default:e.withCtx(()=>[e.createTextVNode(" 忽略之前对话 ")]),_:1},8,["model-value"])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Me,[a.value.length>0?(e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(T,{items:a.value,"base-u-r-l":t.baseURL,"get-file-url":t.getFileUrl,removable:"",onRemove:C},null,8,["items","base-u-r-l","get-file-url"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(N.ElInput),{ref_key:"textareaRef",ref:_,"model-value":t.modelValue,type:"textarea",resize:"none",maxlength:t.maxlength,autosize:t.autosize,placeholder:t.placeholder,disabled:t.disabled||t.talking,class:"wi-web-inputbox__textarea","onUpdate:modelValue":h[1]||(h[1]=m=>u("update:modelValue",m)),onKeydown:e.withKeys(e.withModifiers(y,["exact"]),["enter"])},null,8,["model-value","maxlength","autosize","placeholder","disabled","onKeydown"]),e.createElementVNode("div",De,[e.createElementVNode("div",Oe,[e.renderSlot(t.$slots,"footer-left",{},void 0,!0)]),e.createElementVNode("div",je,[t.showWordLimit?(e.openBlock(),e.createElementBlock("div",Qe,e.toDisplayString((t.modelValue||"").length)+"/"+e.toDisplayString(t.maxlength),1)):e.createCommentVNode("",!0),t.modelValue&&!t.disabled&&!t.talking?(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:1,content:"清除",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"wi-web-inputbox__icon-btn",onClick:p},We)]),_:1})):e.createCommentVNode("",!0),t.showUpload?(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:2,content:"上传附件",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"wi-web-inputbox__icon-btn",disabled:t.disabled||t.talking,onClick:b},Ye,8,He)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("input",{ref_key:"fileInputRef",ref:v,type:"file",multiple:"",accept:t.accept,class:"wi-web-inputbox__hidden-file",onChange:k},null,40,Xe),Ze,t.talking?(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:3,content:"停止生成",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"wi-web-inputbox__action-btn wi-web-inputbox__action-btn--stop",onClick:h[2]||(h[2]=m=>u("stop"))},Je)]),_:1})):(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:4,content:"发送",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["wi-web-inputbox__action-btn wi-web-inputbox__action-btn--send",{"is-disabled":t.disabled||!t.talking&&r.value}]),onClick:R},tt,2)]),_:1}))])])])]))}}),D=S(ot,[["__scopeId","data-v-e3cdddb7"]]),lt=[{id:"recordset",answerType:"recordset",component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>Ct))}],O=i=>E.createAnswerContentMap([...lt,...i??[]]),nt=i=>(e.pushScopeId("data-v-18813783"),i=i(),e.popScopeId(),i),at={key:0,class:"wi-web-chat-messages__loading"},st={key:1,class:"wi-web-chat-messages__empty"},it=nt(()=>e.createElementVNode("div",{class:"wi-web-chat-messages__empty-logo"},"WI",-1)),rt={class:"wi-web-chat-messages__empty-title"},ct={class:"wi-web-chat-messages__empty-description"},dt={key:0,class:"wi-web-chat-messages__user"},ut={class:"wi-web-chat-messages__user-wrapper"},pt={class:"wi-web-chat-messages__user-bubble"},mt={key:1,class:"wi-web-chat-messages__assistant"},ht=e.defineComponent({__name:"ChatMessagesView",props:{messages:{},parsers:{default:()=>[]},baseURL:{default:""},getFileUrl:{type:Function,default:void 0},loading:{type:Boolean,default:!1},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"}},emits:["loadOlder","updateThinkingExpanded"],setup(i,{expose:g,emit:n}){const c=i,u=n,_=e.ref(),{showScrollToBottom:v,forceScrollToBottom:l,requestScrollToBottom:s,onReachTop:a}=M.useAutoScroll(_),r=e.computed(()=>O(c.parsers));return e.watch(()=>c.messages[c.messages.length-1],()=>{s()},{deep:!0}),a(()=>u("loadOlder")),g({forceScrollToBottom:l,requestScrollToBottom:s}),(o,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"scrollEl",ref:_,class:"wi-web-chat-messages"},[o.loading?(e.openBlock(),e.createElementBlock("div",at,"历史加载中...")):o.messages.length===0?(e.openBlock(),e.createElementBlock("div",st,[it,e.createElementVNode("div",rt,e.toDisplayString(o.emptyTitle),1),e.createElementVNode("div",ct,e.toDisplayString(o.emptyDescription),1)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.messages,w=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.id},[w.role==="user"?(e.openBlock(),e.createElementBlock("div",dt,[e.createElementVNode("div",ut,[w.attachments&&w.attachments.length>0?(e.openBlock(),e.createBlock(T,{key:0,class:"wi-web-chat-messages__attachments",items:w.attachments,"base-u-r-l":o.baseURL,"get-file-url":o.getFileUrl},null,8,["items","base-u-r-l","get-file-url"])):e.createCommentVNode("",!0),e.createElementVNode("div",pt,e.toDisplayString(w.content),1)])])):(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(e.unref(E.DeepThinkingSteps),{steps:w.thinking.steps,expanded:w.thinking.expanded,"onUpdate:expanded":p=>u("updateThinkingExpanded",w,p)},null,8,["steps","expanded","onUpdate:expanded"]),e.createVNode(e.unref(E.AiAnswerBubble),{answer:w.answer,error:w.error,stopped:w.stopped,"content-map":r.value},null,8,["answer","error","stopped","content-map"])]))],64))),128)),e.createVNode(e.Transition,{name:"wi-web-chat-messages-fade"},{default:e.withCtx(()=>[e.unref(v)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-web-chat-messages__bottom",onClick:d[0]||(d[0]=(...w)=>e.unref(l)&&e.unref(l)(...w))}," 回到底部 ")):e.createCommentVNode("",!0)]),_:1})],512))}}),j=S(ht,[["__scopeId","data-v-18813783"]]),wt={class:"wi-web-chat-container"},_t={class:"wi-web-chat-container__footer"},vt=e.defineComponent({__name:"ChatContainer",props:{messages:{},parsers:{default:()=>[]},baseURL:{default:""},getFileUrl:{type:Function,default:void 0},loading:{type:Boolean,default:!1},talking:{type:Boolean,default:!1},session:{default:""},question:{default:""},incPrevQuestion:{default:"Y"},agentList:{default:()=>[]},currentAgent:{default:null},placeholder:{default:"请输入问题,按 Enter 发送,Shift+Enter 换行"},hasMore:{type:Boolean,default:!0},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"},disabled:{type:Boolean,default:!1}},emits:["update:question","update:incPrevQuestion","submit","stop","selectAgent","loadOlder","updateThinkingExpanded"],setup(i,{emit:g}){const n=i,c=g,u=l=>{c("submit",l)},_=()=>{n.hasMore&&c("loadOlder")},v=l=>{c("selectAgent",l)};return(l,s)=>(e.openBlock(),e.createElementBlock("section",wt,[e.renderSlot(l.$slots,"messages",{},()=>[e.createVNode(j,{messages:l.messages,parsers:l.parsers,"base-u-r-l":l.baseURL,"get-file-url":l.getFileUrl,loading:l.loading,"empty-title":l.emptyTitle,"empty-description":l.emptyDescription,onLoadOlder:_,onUpdateThinkingExpanded:s[0]||(s[0]=(a,r)=>c("updateThinkingExpanded",a,r))},null,8,["messages","parsers","base-u-r-l","get-file-url","loading","empty-title","empty-description"])],!0),e.renderSlot(l.$slots,"above-input",{},void 0,!0),e.createElementVNode("footer",_t,[e.createVNode(D,{"model-value":l.question,"onUpdate:modelValue":s[1]||(s[1]=a=>c("update:question",a)),"inc-prev-question":l.incPrevQuestion,"onUpdate:incPrevQuestion":s[2]||(s[2]=a=>c("update:incPrevQuestion",a)),"base-u-r-l":l.baseURL,disabled:l.disabled||!l.session,talking:l.talking,"agent-list":l.agentList,"current-agent":l.currentAgent,placeholder:l.placeholder,"get-file-url":l.getFileUrl,onSelectAgent:v,onSubmit:u,onStop:s[3]||(s[3]=a=>c("stop"))},null,8,["model-value","inc-prev-question","base-u-r-l","disabled","talking","agent-list","current-agent","placeholder","get-file-url"])])]))}}),bt=S(vt,[["__scopeId","data-v-44d5a53f"]]),Q=i=>(e.pushScopeId("data-v-96941d57"),i=i(),e.popScopeId(),i),ft={key:0,class:"wi-web-recordset"},gt={class:"wi-web-recordset__header"},kt={class:"wi-web-recordset__title"},yt=Q(()=>e.createElementVNode("button",{type:"button",class:"wi-web-recordset__columns-btn",title:"选择展示列"},[e.createElementVNode("svg",{class:"wi-web-recordset__columns-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),e.createElementVNode("path",{d:"M9 4v16M15 4v16"})]),e.createElementVNode("span",null,"列")],-1)),Bt={class:"wi-web-recordset__columns-panel"},Et=Q(()=>e.createElementVNode("div",{class:"wi-web-recordset__columns-panel-title"},"选择展示列",-1)),Vt=e.defineComponent({__name:"RecordsetTable",props:{report:{},maxHeight:{default:420}},setup(i){const g=i,n=e.computed(()=>{var p;return((p=g.report)==null?void 0:p.values)??{}}),c=e.computed(()=>n.value.chart==="table"),u=e.computed(()=>n.value.title??""),_=e.computed(()=>(Array.isArray(n.value.cols)?n.value.cols:[]).map((b,k)=>({key:`c${k}`,title:(b==null?void 0:b.title)||(b==null?void 0:b.name)||`列${k+1}`}))),v=e.computed(()=>{const p=Number(n.value.max_cols);return Number.isFinite(p)&&p>0?p:1/0}),l=e.computed(()=>_.value.length>v.value),s=e.ref([]),a=e.computed(()=>new Set(s.value)),r=e.computed(()=>_.value.filter(p=>a.value.has(p.key)));e.watch(()=>_.value.map(p=>p.key).join("|"),()=>{s.value=_.value.slice(0,v.value).map(p=>p.key)},{immediate:!0});const o=e.computed(()=>(Array.isArray(n.value.values)?n.value.values:[]).map(b=>{const k={};return _.value.forEach((C,A)=>{k[C.key]=Array.isArray(b)?b[A]:void 0}),k})),d=e.ref(!1),w=(p,b)=>{const k=new Set(s.value);b?k.add(p):k.delete(p),s.value=_.value.filter(C=>k.has(C.key)).map(C=>C.key)};return(p,b)=>{const k=e.resolveComponent("el-checkbox"),C=e.resolveComponent("el-popover"),A=e.resolveComponent("el-table-column"),R=e.resolveComponent("el-table");return c.value?(e.openBlock(),e.createElementBlock("div",ft,[e.createElementVNode("div",gt,[e.createElementVNode("div",kt,e.toDisplayString(u.value),1),l.value?(e.openBlock(),e.createBlock(C,{key:0,visible:d.value,"onUpdate:visible":b[0]||(b[0]=y=>d.value=y),placement:"bottom-end",width:220,trigger:"click","popper-class":"wi-web-recordset-columns-popper"},{reference:e.withCtx(()=>[yt]),default:e.withCtx(()=>[e.createElementVNode("div",Bt,[Et,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,y=>(e.openBlock(),e.createBlock(k,{key:y.key,class:"wi-web-recordset__column-item","model-value":a.value.has(y.key),"onUpdate:modelValue":t=>w(y.key,!!t)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.title),1)]),_:2},1032,["model-value","onUpdate:modelValue"]))),128))])]),_:1},8,["visible"])):e.createCommentVNode("",!0)]),e.createVNode(R,{data:o.value,border:"",size:"small",class:"wi-web-recordset__table","max-height":p.maxHeight},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,y=>(e.openBlock(),e.createBlock(A,{key:y.key,prop:y.key,label:y.title,"min-width":"120","show-overflow-tooltip":""},null,8,["prop","label"]))),128))]),_:1},8,["data","max-height"])])):e.createCommentVNode("",!0)}}}),q=S(Vt,[["__scopeId","data-v-96941d57"]]),Ct=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"})),F=i=>(e.pushScopeId("data-v-94659445"),i=i(),e.popScopeId(),i),Nt={class:"wi-web-env-switch__track"},$t={class:"wi-web-env-switch__items"},St=["disabled","onClick"],At={class:"wi-web-env-switch__icon"},It={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},Ut=F(()=>e.createElementVNode("path",{d:"M17.5 19a4.5 4.5 0 0 0 .6-8.96 6 6 0 0 0-11.63 1.4A3.8 3.8 0 0 0 7 19z"},null,-1)),Pt=[Ut],Rt={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},xt=F(()=>e.createElementVNode("rect",{x:"2.5",y:"4",width:"19",height:"12",rx:"2","stroke-linejoin":"round"},null,-1)),Tt=F(()=>e.createElementVNode("path",{d:"M8.5 20h7M12 16v4"},null,-1)),Ft=[xt,Tt],zt={class:"wi-web-env-switch__label"},Mt={key:0,class:"wi-web-env-switch__hint"},Lt={class:"wi-web-env-switch__hint-text"},Dt={key:0,class:"wi-web-env-switch__hint-status"},Ot=e.defineComponent({__name:"EnvSwitch",props:{modelValue:{default:"local"},options:{default:()=>[]},disabled:{type:Boolean,default:!1},size:{default:"default"},showHint:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(i,{emit:g}){const n=i,c=g,u=[{value:"local",label:"本地电脑",description:"在当前设备上执行,文件与终端直连本机",status:"已就绪",online:!0},{value:"cloud",label:"云电脑",description:"在云端环境中执行,算力与存储由服务端提供",status:"未连接",online:!1}],_={default:3,small:2},v=e.computed(()=>{const r=n.options??[];return r.length>0?r:u}),l=e.computed(()=>{if(!n.showHint)return null;const r=v.value;return r.find(o=>o.value===n.modelValue)??r[0]??null}),s=e.computed(()=>{const r=v.value,o=r.length||1,d=Math.max(r.findIndex(p=>p.value===n.modelValue),0),w=_[n.size]??_.default;return{width:`calc(${100/o}% - ${2*w/o}px)`,transform:`translateX(${d*100}%)`}}),a=r=>{n.disabled||r.disabled||r.value!==n.modelValue&&(c("update:modelValue",r.value),c("change",r))};return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wi-web-env-switch",[`is-${r.size}`,{"is-disabled":r.disabled}]])},[e.createElementVNode("div",Nt,[e.createElementVNode("span",{class:"wi-web-env-switch__thumb",style:e.normalizeStyle(s.value)},null,4),e.createElementVNode("div",$t,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,d=>(e.openBlock(),e.createElementBlock("button",{key:d.value,type:"button",class:e.normalizeClass(["wi-web-env-switch__item",{"is-active":d.value===r.modelValue,"is-disabled":d.disabled}]),disabled:r.disabled||d.disabled,onClick:w=>a(d)},[e.createElementVNode("span",At,[d.value==="cloud"?(e.openBlock(),e.createElementBlock("svg",It,Pt)):(e.openBlock(),e.createElementBlock("svg",Rt,Ft))]),e.createElementVNode("span",zt,e.toDisplayString(d.label),1)],10,St))),128))])]),l.value?(e.openBlock(),e.createElementBlock("div",Mt,[e.createElementVNode("span",Lt,e.toDisplayString(l.value.description),1),l.value.status?(e.openBlock(),e.createElementBlock("span",Dt,[e.createElementVNode("i",{class:e.normalizeClass(["wi-web-env-switch__dot",{"is-online":l.value.online}])},null,2),e.createTextVNode(" "+e.toDisplayString(l.value.status),1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),jt=S(Ot,[["__scopeId","data-v-94659445"]]);Object.defineProperty(exports,"AiAnswerBubble",{enumerable:!0,get:()=>E.AiAnswerBubble});Object.defineProperty(exports,"DeepThinkingSteps",{enumerable:!0,get:()=>E.DeepThinkingSteps});Object.defineProperty(exports,"IframePage",{enumerable:!0,get:()=>E.IframePage});Object.defineProperty(exports,"KnowledgeStreamResult",{enumerable:!0,get:()=>E.KnowledgeStreamResult});Object.defineProperty(exports,"createAnswerContentMap",{enumerable:!0,get:()=>E.createAnswerContentMap});Object.defineProperty(exports,"injectIframeResizerChild",{enumerable:!0,get:()=>E.injectIframeResizerChild});Object.defineProperty(exports,"provideIframePageConfig",{enumerable:!0,get:()=>E.provideIframePageConfig});Object.defineProperty(exports,"resolveIframePlaceholders",{enumerable:!0,get:()=>E.resolveIframePlaceholders});Object.defineProperty(exports,"useIframePage",{enumerable:!0,get:()=>E.useIframePage});exports.AttachmentCard=L;exports.AttachmentList=T;exports.ChatContainer=bt;exports.ChatMessagesView=j;exports.EnvSwitch=jt;exports.Inputbox=D;exports.RecordsetTable=q;exports.createWebAnswerContentMap=O;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("wi-chat/renderers"),e=require("vue"),N=require("element-plus"),F=require("wi-chat/parser"),L=require("wi-chat/tools"),I=r=>(e.pushScopeId("data-v-dc2d5f2b"),r=r(),e.popScopeId(),r),W={class:"wi-web-attach-card__icon"},H=I(()=>e.createElementVNode("div",{class:"wi-web-attach-card__image-fallback"},[e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.createElementVNode("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.createElementVNode("polyline",{points:"21 15 16 10 5 21"})])],-1)),K=I(()=>e.createElementVNode("div",{class:"wi-web-attach-card__image-fallback"},[e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.createElementVNode("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.createElementVNode("polyline",{points:"21 15 16 10 5 21"})])],-1)),Y={key:1,viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2"},X=e.createStaticVNode('<rect x="3" y="3" width="18" height="18" rx="2" data-v-dc2d5f2b></rect><path d="M3 9h18" data-v-dc2d5f2b></path><path d="M3 15h18" data-v-dc2d5f2b></path><path d="M9 3v18" data-v-dc2d5f2b></path><path d="M15 3v18" data-v-dc2d5f2b></path>',5),Z=[X],G={key:2,viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2"},J=I(()=>e.createElementVNode("path",{d:"M18 20V10"},null,-1)),ee=I(()=>e.createElementVNode("path",{d:"M12 20V4"},null,-1)),te=I(()=>e.createElementVNode("path",{d:"M6 20v-6"},null,-1)),oe=[J,ee,te],le={key:3,viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor","stroke-width":"2"},ne=e.createStaticVNode('<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" data-v-dc2d5f2b></path><polyline points="14 2 14 8 20 8" data-v-dc2d5f2b></polyline><line x1="16" y1="13" x2="8" y2="13" data-v-dc2d5f2b></line><line x1="16" y1="17" x2="8" y2="17" data-v-dc2d5f2b></line><polyline points="10 9 9 9 8 9" data-v-dc2d5f2b></polyline>',5),ae=[ne],se={class:"wi-web-attach-card__info"},ie=["title"],re={key:0,class:"wi-web-attach-card__size"},ce={class:"wi-web-attach-card__actions"},de=I(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),e.createElementVNode("line",{x1:"12",y1:"15",x2:"12",y2:"3"})],-1)),ue=[de],pe=e.defineComponent({__name:"AttachmentCard",props:{item:{},clickable:{type:Boolean,default:!1},removable:{type:Boolean,default:!1},downloadable:{type:Boolean,default:void 0},baseURL:{default:""},getFileUrl:{type:Function,default:void 0}},emits:["click","remove","download"],setup(r,{emit:g}){const n=r,a=g,u=e.computed(()=>{var o;return((o=n.item)==null?void 0:o.attachContent)||{}}),_=e.computed(()=>F.isImageAttachment(n.item)),v=e.computed(()=>F.resolveAttachPreviewUrl(n.item,n.baseURL,n.getFileUrl)),l=e.computed(()=>{if(n.removable)return!1;if(n.downloadable!==void 0)return n.downloadable;if(n.item.type&&n.item.type!=="file")return!1;const o=u.value;return!!(o.fileId||o.raw)}),i=()=>{a("click",n.item)},s=()=>{a("remove",n.item)},c=async()=>{a("download",n.item),await L.downloadAttachment(n.item,{baseURL:n.baseURL,getFileUrl:n.getFileUrl})};return(o,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wi-web-attach-card",{"is-clickable":o.clickable||!!o.$attrs.onClick}]),onClick:i},[e.createElementVNode("div",W,[e.renderSlot(o.$slots,"icon",{item:o.item},()=>[_.value&&v.value?(e.openBlock(),e.createBlock(e.unref(N.ElImage),{key:0,src:v.value,"preview-src-list":[v.value],"zoom-rate":1.2,"preview-teleported":"",fit:"cover",class:"wi-web-attach-card__image",onClick:d[0]||(d[0]=e.withModifiers(()=>{},["stop"]))},{placeholder:e.withCtx(()=>[H]),error:e.withCtx(()=>[K]),_:1},8,["src","preview-src-list"])):o.item.type==="table"?(e.openBlock(),e.createElementBlock("svg",Y,Z)):o.item.type==="metric"?(e.openBlock(),e.createElementBlock("svg",G,oe)):(e.openBlock(),e.createElementBlock("svg",le,ae))],!0)]),e.createElementVNode("div",se,[e.createElementVNode("div",{class:"wi-web-attach-card__name",title:o.item.name},[e.renderSlot(o.$slots,"title",{item:o.item},()=>[e.createTextVNode(e.toDisplayString(o.item.name),1)],!0)],8,ie),o.item.description||o.$slots.description?(e.openBlock(),e.createElementBlock("div",re,[e.renderSlot(o.$slots,"description",{item:o.item},()=>[e.createTextVNode(e.toDisplayString(o.item.description),1)],!0)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ce,[e.renderSlot(o.$slots,"actions",{item:o.item},()=>[l.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-web-attach-card__action-btn wi-web-attach-card__download",title:"下载附件",onClick:e.withModifiers(c,["stop"])},ue)):e.createCommentVNode("",!0),o.removable?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"wi-web-attach-card__action-btn wi-web-attach-card__delete",title:"删除附件",onClick:e.withModifiers(s,["stop"])}," × ")):e.createCommentVNode("",!0)],!0)])],2))}}),S=(r,g)=>{const n=r.__vccOpts||r;for(const[a,u]of g)n[a]=u;return n},M=S(pe,[["__scopeId","data-v-dc2d5f2b"]]),me={key:0,class:"wi-web-attachment-list"},he=e.defineComponent({__name:"AttachmentList",props:{items:{default:()=>[]},removable:{type:Boolean,default:!1},downloadable:{type:Boolean,default:void 0},clickable:{type:Boolean,default:!1},baseURL:{default:""},getFileUrl:{type:Function,default:void 0}},emits:["remove","click","download"],setup(r,{emit:g}){const n=r,a=g,u=e.computed(()=>(n.items||[]).map((s,c)=>{var p,b;const o=F.normalizeAttachment(s),d=(p=o.attachContent)==null?void 0:p.raw,w=((b=o.attachContent)==null?void 0:b.fileId)||(d?`${d.name}_${d.size}_${c}`:`${o.name}_${c}`);return{...o,key:w}})),_=(i,s)=>{a("remove",i,s)},v=(i,s)=>{a("click",i,s)},l=(i,s)=>{a("download",i,s)};return(i,s)=>u.value.length>0?(e.openBlock(),e.createElementBlock("div",me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(c,o)=>(e.openBlock(),e.createBlock(M,{key:c.key||o,item:c,removable:i.removable,downloadable:i.downloadable,clickable:i.clickable||!!i.$attrs.onClick,"base-u-r-l":i.baseURL,"get-file-url":i.getFileUrl,onClick:d=>v(c,o),onRemove:d=>_(o,c),onDownload:d=>l(c,o)},{icon:e.withCtx(d=>[e.renderSlot(i.$slots,"icon",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),title:e.withCtx(d=>[e.renderSlot(i.$slots,"title",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),description:e.withCtx(d=>[e.renderSlot(i.$slots,"description",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),actions:e.withCtx(d=>[e.renderSlot(i.$slots,"actions",e.normalizeProps(e.guardReactiveProps(d)),void 0,!0)]),_:2},1032,["item","removable","downloadable","clickable","base-u-r-l","get-file-url","onClick","onRemove","onDownload"]))),128))])):e.createCommentVNode("",!0)}}),T=S(he,[["__scopeId","data-v-ff76d134"]]),V=r=>(e.pushScopeId("data-v-e3cdddb7"),r=r(),e.popScopeId(),r),we={class:"wi-web-inputbox"},_e={key:0,class:"wi-web-inputbox__top-bar"},ve={key:0,class:"wi-web-inputbox__agent-bar"},be={class:"wi-web-inputbox__agent-icon-wrapper"},fe=["src"],ge={key:1,class:"wi-web-inputbox__agent-svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},ke=V(()=>e.createElementVNode("circle",{cx:"12",cy:"8",r:"4"},null,-1)),ye=V(()=>e.createElementVNode("path",{d:"M4 20c0-4 4-6 8-6s8 2 8 6"},null,-1)),Be=[ke,ye],Ee={class:"wi-web-inputbox__agent-title"},Ve=V(()=>e.createElementVNode("path",{d:"M840.4 300H183.6c-19.7 0-30.7 22.7-18.5 37.1l328.4 388.7c9.5 11.2 27.5 11.2 37 0l328.4-388.7c12.2-14.4 1.2-37.1-18.5-37.1z",fill:"currentColor"},null,-1)),Ce=[Ve],Ne={class:"wi-web-agent-list"},$e=V(()=>e.createElementVNode("div",{class:"wi-web-agent-list__header"},"切换智能体",-1)),Se={key:0,class:"wi-web-agent-list__empty"},Ae=["onClick"],Ie={class:"wi-web-agent-item__left"},Ue=["src"],Fe={key:1,class:"wi-web-agent-item__avatar-fallback"},Pe=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("circle",{cx:"12",cy:"8",r:"4"}),e.createElementVNode("path",{d:"M4 20c0-4 4-6 8-6s8 2 8 6"})],-1)),Re=[Pe],Te={class:"wi-web-agent-item__title"},xe={key:0,class:"wi-web-agent-item__check"},ze={key:1,class:"wi-web-inputbox__options"},Le={class:"wi-web-inputbox__main"},Me={key:0,class:"wi-web-inputbox__attachments"},Oe={class:"wi-web-inputbox__footer"},De={class:"wi-web-inputbox__footer-left"},je={class:"wi-web-inputbox__footer-right"},Qe={key:0,class:"wi-web-inputbox__counter"},qe=V(()=>e.createElementVNode("svg",{viewBox:"0 0 1024 1024",width:"16",height:"16",fill:"currentColor"},[e.createElementVNode("path",{d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896z m0 85.333333a362.666667 362.666667 0 1 0 0 725.333334 362.666667 362.666667 0 0 0 0-725.333334z m120.746667 181.333334a42.666667 42.666667 0 0 1 54.826666 4.693333l5.546667 6.357334a42.666667 42.666667 0 0 1-4.693333 54.826666l-6.357334 5.546667-114.730666 114.773333 114.730666 114.730667a42.666667 42.666667 0 0 1 5.461334 54.826666l-5.461334 6.357334a42.666667 42.666667 0 0 1-54.826666 5.461333l-6.357334-5.461333-114.730666-114.730667-114.730667 114.730667a42.666667 42.666667 0 0 1-54.826667 5.461333l-6.357333-5.461333a42.666667 42.666667 0 0 1-5.461333-54.826667l5.461333-6.357333 114.730667-114.730667-114.730667-114.773333a42.666667 42.666667 0 0 1-5.461333-54.826667l5.461333-6.357333a42.666667 42.666667 0 0 1 54.826667-5.461334l6.357333 5.461334 114.730667 114.730666 114.730666-114.730666a42.666667 42.666667 0 0 1 24.32-11.434667z"})],-1)),We=[qe],He=["disabled"],Ke=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})],-1)),Ye=[Ke],Xe=["accept"],Ze=V(()=>e.createElementVNode("div",{class:"wi-web-inputbox__divider"},null,-1)),Ge=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor"},[e.createElementVNode("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})],-1)),Je=[Ge],et=V(()=>e.createElementVNode("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"currentColor"},[e.createElementVNode("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"})],-1)),tt=[et],ot=e.defineComponent({__name:"Inputbox",props:{modelValue:{default:""},placeholder:{default:'"↑↓"切换历史输入,"⇧↵"换行'},disabled:{type:Boolean,default:!1},talking:{type:Boolean,default:!1},maxlength:{default:1024},autosize:{type:[Object,Boolean],default:()=>({minRows:3,maxRows:8})},showAgentBar:{type:Boolean,default:!0},showUpload:{type:Boolean,default:!0},showWordLimit:{type:Boolean,default:!0},accept:{default:".csv,.txt,.pdf,.doc,.docx,.xls,.xlsx,.png,.jpg,.jpeg,.gif,.mp4"},agentList:{default:()=>[]},currentAgent:{default:null},defaultAgentTitle:{default:"系统默认智能体"},baseURL:{default:""},getFileUrl:{type:Function,default:void 0},incPrevQuestion:{default:"Y"},showIncPrevQuestion:{type:Boolean,default:!0}},emits:["update:modelValue","submit","stop","selectAgent","update:files","update:attachments","update:incPrevQuestion"],setup(r,{expose:g,emit:n}){const a=r,u=n,_=e.ref(null),v=e.ref(null),l=e.ref(!1),i=t=>F.parseRealtimeAttachment(t),s=e.ref([]),c=e.computed(()=>!!!(a.modelValue&&a.modelValue.trim())),o=t=>t?a.getFileUrl?a.getFileUrl(t):F.resolveRemoteFileUrl(t,a.baseURL,"/algorithm/get_file_data"):"",d=t=>{u("selectAgent",t),l.value=!1},w=t=>{u("update:incPrevQuestion",t?"N":"Y")},p=()=>{u("update:modelValue","")},b=()=>{v.value&&(v.value.value="",v.value.click())},y=t=>{const h=t.target;if(h.files&&h.files.length>0){const m=Array.from(h.files);for(const f of m)s.value.some(U=>{var z;const R=((z=U.attachContent)==null?void 0:z.raw)||U.raw;return R&&R.name===f.name&&R.size===f.size&&R.lastModified===f.lastModified})||s.value.push(i(f));const E=s.value.map(f=>{var $;return(($=f.attachContent)==null?void 0:$.raw)||f.raw}).filter(Boolean);u("update:files",E),u("update:attachments",[...s.value])}},C=t=>{var f;const h=s.value.splice(t,1)[0],m=((f=h==null?void 0:h.attachContent)==null?void 0:f.url)||(h==null?void 0:h.url);m&&m.startsWith("blob:")&&URL.revokeObjectURL(m);const E=s.value.map($=>{var U;return((U=$.attachContent)==null?void 0:U.raw)||$.raw}).filter(Boolean);u("update:files",E),u("update:attachments",[...s.value])},A=()=>{s.value.forEach(t=>{var m;const h=((m=t==null?void 0:t.attachContent)==null?void 0:m.url)||(t==null?void 0:t.url);h&&h.startsWith("blob:")&&URL.revokeObjectURL(h)}),s.value=[],u("update:files",[]),u("update:attachments",[])},P=()=>{if(a.disabled||c.value)return;const t=a.modelValue||"",h=s.value.map(E=>{var f;return((f=E.attachContent)==null?void 0:f.raw)||E.raw}).filter(Boolean),m=[...s.value];u("submit",{text:t,files:h,attachments:m,agent:a.currentAgent}),s.value=[],u("update:files",[]),u("update:attachments",[])},B=t=>{t.isComposing||t.keyCode===229||(t.preventDefault(),P())};return e.onBeforeUnmount(()=>{A()}),g({clearFiles:A,getFiles:()=>s.value.map(t=>{var h;return((h=t.attachContent)==null?void 0:h.raw)||t.raw}).filter(Boolean),getAttachments:()=>s.value,focus:()=>{var t;(t=_.value)==null||t.focus()}}),(t,h)=>(e.openBlock(),e.createElementBlock("div",we,[t.showAgentBar||t.showIncPrevQuestion?(e.openBlock(),e.createElementBlock("div",_e,[t.showAgentBar?(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(e.unref(N.ElPopover),{visible:l.value,"onUpdate:visible":h[0]||(h[0]=m=>l.value=m),placement:"top-start",width:260,trigger:"click","popper-class":"wi-web-agent-popover"},{reference:e.withCtx(()=>{var m,E,f;return[e.createElementVNode("div",{class:e.normalizeClass(["wi-web-inputbox__agent-btn",{"is-disabled":t.disabled||t.talking}])},[e.createElementVNode("div",be,[(m=t.currentAgent)!=null&&m.image_id&&o(t.currentAgent.image_id)?(e.openBlock(),e.createElementBlock("img",{key:0,src:o(t.currentAgent.image_id),class:"wi-web-inputbox__agent-avatar"},null,8,fe)):(e.openBlock(),e.createElementBlock("svg",ge,Be))]),e.createElementVNode("span",Ee," @"+e.toDisplayString(((E=t.currentAgent)==null?void 0:E.entry_title)||((f=t.currentAgent)==null?void 0:f.entry_id)||t.defaultAgentTitle),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["wi-web-inputbox__agent-arrow",{"is-active":l.value}]),viewBox:"0 0 1024 1024",width:"12",height:"12"},Ce,2))],2)]}),default:e.withCtx(()=>[e.createElementVNode("div",Ne,[$e,!t.agentList||t.agentList.length===0?(e.openBlock(),e.createElementBlock("div",Se," 暂无可选智能体 ")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.agentList,m=>{var E,f;return e.openBlock(),e.createElementBlock("div",{key:m.entry_id,class:e.normalizeClass(["wi-web-agent-item",{"is-active":m.entry_id===((E=t.currentAgent)==null?void 0:E.entry_id)}]),onClick:$=>d(m)},[e.createElementVNode("div",Ie,[m.image_id&&o(m.image_id)?(e.openBlock(),e.createElementBlock("img",{key:0,src:o(m.image_id),class:"wi-web-agent-item__avatar"},null,8,Ue)):(e.openBlock(),e.createElementBlock("div",Fe,Re)),e.createElementVNode("span",Te,e.toDisplayString(m.entry_title||m.entry_id),1)]),m.entry_id===((f=t.currentAgent)==null?void 0:f.entry_id)?(e.openBlock(),e.createElementBlock("span",xe,"✓")):e.createCommentVNode("",!0)],10,Ae)}),128))])]),_:1},8,["visible"])])):e.createCommentVNode("",!0),t.showIncPrevQuestion?(e.openBlock(),e.createElementBlock("div",ze,[e.createVNode(e.unref(N.ElCheckbox),{class:"wi-web-inputbox__ignore-prev","model-value":t.incPrevQuestion==="N","onUpdate:modelValue":w},{default:e.withCtx(()=>[e.createTextVNode(" 忽略之前对话 ")]),_:1},8,["model-value"])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Le,[s.value.length>0?(e.openBlock(),e.createElementBlock("div",Me,[e.createVNode(T,{items:s.value,"base-u-r-l":t.baseURL,"get-file-url":t.getFileUrl,removable:"",onRemove:C},null,8,["items","base-u-r-l","get-file-url"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(N.ElInput),{ref_key:"textareaRef",ref:_,"model-value":t.modelValue,type:"textarea",resize:"none",maxlength:t.maxlength,autosize:t.autosize,placeholder:t.placeholder,disabled:t.disabled||t.talking,class:"wi-web-inputbox__textarea","onUpdate:modelValue":h[1]||(h[1]=m=>u("update:modelValue",m)),onKeydown:e.withKeys(e.withModifiers(B,["exact"]),["enter"])},null,8,["model-value","maxlength","autosize","placeholder","disabled","onKeydown"]),e.createElementVNode("div",Oe,[e.createElementVNode("div",De,[e.renderSlot(t.$slots,"footer-left",{},void 0,!0)]),e.createElementVNode("div",je,[t.showWordLimit?(e.openBlock(),e.createElementBlock("div",Qe,e.toDisplayString((t.modelValue||"").length)+"/"+e.toDisplayString(t.maxlength),1)):e.createCommentVNode("",!0),t.modelValue&&!t.disabled&&!t.talking?(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:1,content:"清除",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"wi-web-inputbox__icon-btn",onClick:p},We)]),_:1})):e.createCommentVNode("",!0),t.showUpload?(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:2,content:"上传附件",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"wi-web-inputbox__icon-btn",disabled:t.disabled||t.talking,onClick:b},Ye,8,He)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("input",{ref_key:"fileInputRef",ref:v,type:"file",multiple:"",accept:t.accept,class:"wi-web-inputbox__hidden-file",onChange:y},null,40,Xe),Ze,t.talking?(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:3,content:"停止生成",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"wi-web-inputbox__action-btn wi-web-inputbox__action-btn--stop",onClick:h[2]||(h[2]=m=>u("stop"))},Je)]),_:1})):(e.openBlock(),e.createBlock(e.unref(N.ElTooltip),{key:4,content:"发送",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["wi-web-inputbox__action-btn wi-web-inputbox__action-btn--send",{"is-disabled":t.disabled||!t.talking&&c.value}]),onClick:P},tt,2)]),_:1}))])])])]))}}),O=S(ot,[["__scopeId","data-v-e3cdddb7"]]),lt=[{id:"recordset",answerType:"recordset",component:e.defineAsyncComponent(()=>Promise.resolve().then(()=>Ct))}],D=r=>k.createAnswerContentMap([...lt,...r??[]]),nt=r=>(e.pushScopeId("data-v-bcad9562"),r=r(),e.popScopeId(),r),at={key:0,class:"wi-web-chat-messages__loading"},st={key:1,class:"wi-web-chat-messages__empty"},it=nt(()=>e.createElementVNode("div",{class:"wi-web-chat-messages__empty-logo"},"WI",-1)),rt={class:"wi-web-chat-messages__empty-title"},ct={class:"wi-web-chat-messages__empty-description"},dt={key:0,class:"wi-web-chat-messages__user"},ut={class:"wi-web-chat-messages__user-wrapper"},pt={class:"wi-web-chat-messages__user-bubble"},mt={key:1,class:"wi-web-chat-messages__assistant"},ht=e.defineComponent({__name:"ChatMessagesView",props:{messages:{},parsers:{default:()=>[]},baseURL:{default:""},getFileUrl:{type:Function,default:void 0},outputFileConfig:{},loading:{type:Boolean,default:!1},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"}},emits:["loadOlder","updateThinkingExpanded"],setup(r,{expose:g,emit:n}){const a=r,u=n;k.provideOutputFileConfig(a.outputFileConfig??{getFileUrl:o=>{var d;return((d=a.getFileUrl)==null?void 0:d.call(a,o))??(a.baseURL?`${a.baseURL.replace(/\/$/,"")}/algorithm/get_file_data?file_id=${encodeURIComponent(o)}`:"")}});const _=e.ref(),{showScrollToBottom:v,forceScrollToBottom:l,requestScrollToBottom:i,onReachTop:s}=L.useAutoScroll(_),c=e.computed(()=>D(a.parsers));return e.watch(()=>a.messages[a.messages.length-1],()=>{i()},{deep:!0}),s(()=>u("loadOlder")),g({forceScrollToBottom:l,requestScrollToBottom:i}),(o,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"scrollEl",ref:_,class:"wi-web-chat-messages"},[o.loading?(e.openBlock(),e.createElementBlock("div",at,"历史加载中...")):o.messages.length===0?(e.openBlock(),e.createElementBlock("div",st,[it,e.createElementVNode("div",rt,e.toDisplayString(o.emptyTitle),1),e.createElementVNode("div",ct,e.toDisplayString(o.emptyDescription),1)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.messages,w=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.id},[w.role==="user"?(e.openBlock(),e.createElementBlock("div",dt,[e.createElementVNode("div",ut,[w.attachments&&w.attachments.length>0?(e.openBlock(),e.createBlock(T,{key:0,class:"wi-web-chat-messages__attachments",items:w.attachments,"base-u-r-l":o.baseURL,"get-file-url":o.getFileUrl},null,8,["items","base-u-r-l","get-file-url"])):e.createCommentVNode("",!0),e.createElementVNode("div",pt,e.toDisplayString(w.content),1)])])):(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(e.unref(k.DeepThinkingSteps),{steps:w.thinking.steps,expanded:w.thinking.expanded,"onUpdate:expanded":p=>u("updateThinkingExpanded",w,p)},null,8,["steps","expanded","onUpdate:expanded"]),e.createVNode(e.unref(k.AiAnswerBubble),{answer:w.answer,error:w.error,stopped:w.stopped,"content-map":c.value},null,8,["answer","error","stopped","content-map"])]))],64))),128)),e.createVNode(e.Transition,{name:"wi-web-chat-messages-fade"},{default:e.withCtx(()=>[e.unref(v)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"wi-web-chat-messages__bottom",onClick:d[0]||(d[0]=(...w)=>e.unref(l)&&e.unref(l)(...w))}," 回到底部 ")):e.createCommentVNode("",!0)]),_:1})],512))}}),j=S(ht,[["__scopeId","data-v-bcad9562"]]),wt={class:"wi-web-chat-container"},_t={class:"wi-web-chat-container__footer"},vt=e.defineComponent({__name:"ChatContainer",props:{messages:{},parsers:{default:()=>[]},baseURL:{default:""},getFileUrl:{type:Function,default:void 0},outputFileConfig:{},loading:{type:Boolean,default:!1},talking:{type:Boolean,default:!1},session:{default:""},question:{default:""},incPrevQuestion:{default:"Y"},agentList:{default:()=>[]},currentAgent:{default:null},placeholder:{default:"请输入问题,按 Enter 发送,Shift+Enter 换行"},hasMore:{type:Boolean,default:!0},emptyTitle:{default:"输入问题,开始与 AI 对话"},emptyDescription:{default:"回答内容由共享渲染层统一分发"},disabled:{type:Boolean,default:!1}},emits:["update:question","update:incPrevQuestion","submit","stop","selectAgent","loadOlder","updateThinkingExpanded"],setup(r,{emit:g}){const n=r,a=g,u=l=>{a("submit",l)},_=()=>{n.hasMore&&a("loadOlder")},v=l=>{a("selectAgent",l)};return(l,i)=>(e.openBlock(),e.createElementBlock("section",wt,[e.renderSlot(l.$slots,"messages",{},()=>[e.createVNode(j,{messages:l.messages,parsers:l.parsers,"base-u-r-l":l.baseURL,"get-file-url":l.getFileUrl,"output-file-config":l.outputFileConfig,loading:l.loading,"empty-title":l.emptyTitle,"empty-description":l.emptyDescription,onLoadOlder:_,onUpdateThinkingExpanded:i[0]||(i[0]=(s,c)=>a("updateThinkingExpanded",s,c))},null,8,["messages","parsers","base-u-r-l","get-file-url","output-file-config","loading","empty-title","empty-description"])],!0),e.renderSlot(l.$slots,"above-input",{},void 0,!0),e.createElementVNode("footer",_t,[e.createVNode(O,{"model-value":l.question,"onUpdate:modelValue":i[1]||(i[1]=s=>a("update:question",s)),"inc-prev-question":l.incPrevQuestion,"onUpdate:incPrevQuestion":i[2]||(i[2]=s=>a("update:incPrevQuestion",s)),"base-u-r-l":l.baseURL,disabled:l.disabled||!l.session,talking:l.talking,"agent-list":l.agentList,"current-agent":l.currentAgent,placeholder:l.placeholder,"get-file-url":l.getFileUrl,onSelectAgent:v,onSubmit:u,onStop:i[3]||(i[3]=s=>a("stop"))},null,8,["model-value","inc-prev-question","base-u-r-l","disabled","talking","agent-list","current-agent","placeholder","get-file-url"])])]))}}),bt=S(vt,[["__scopeId","data-v-8663b501"]]),Q=r=>(e.pushScopeId("data-v-96941d57"),r=r(),e.popScopeId(),r),ft={key:0,class:"wi-web-recordset"},gt={class:"wi-web-recordset__header"},kt={class:"wi-web-recordset__title"},yt=Q(()=>e.createElementVNode("button",{type:"button",class:"wi-web-recordset__columns-btn",title:"选择展示列"},[e.createElementVNode("svg",{class:"wi-web-recordset__columns-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),e.createElementVNode("path",{d:"M9 4v16M15 4v16"})]),e.createElementVNode("span",null,"列")],-1)),Bt={class:"wi-web-recordset__columns-panel"},Et=Q(()=>e.createElementVNode("div",{class:"wi-web-recordset__columns-panel-title"},"选择展示列",-1)),Vt=e.defineComponent({__name:"RecordsetTable",props:{report:{},maxHeight:{default:420}},setup(r){const g=r,n=e.computed(()=>{var p;return((p=g.report)==null?void 0:p.values)??{}}),a=e.computed(()=>n.value.chart==="table"),u=e.computed(()=>n.value.title??""),_=e.computed(()=>(Array.isArray(n.value.cols)?n.value.cols:[]).map((b,y)=>({key:`c${y}`,title:(b==null?void 0:b.title)||(b==null?void 0:b.name)||`列${y+1}`}))),v=e.computed(()=>{const p=Number(n.value.max_cols);return Number.isFinite(p)&&p>0?p:1/0}),l=e.computed(()=>_.value.length>v.value),i=e.ref([]),s=e.computed(()=>new Set(i.value)),c=e.computed(()=>_.value.filter(p=>s.value.has(p.key)));e.watch(()=>_.value.map(p=>p.key).join("|"),()=>{i.value=_.value.slice(0,v.value).map(p=>p.key)},{immediate:!0});const o=e.computed(()=>(Array.isArray(n.value.values)?n.value.values:[]).map(b=>{const y={};return _.value.forEach((C,A)=>{y[C.key]=Array.isArray(b)?b[A]:void 0}),y})),d=e.ref(!1),w=(p,b)=>{const y=new Set(i.value);b?y.add(p):y.delete(p),i.value=_.value.filter(C=>y.has(C.key)).map(C=>C.key)};return(p,b)=>{const y=e.resolveComponent("el-checkbox"),C=e.resolveComponent("el-popover"),A=e.resolveComponent("el-table-column"),P=e.resolveComponent("el-table");return a.value?(e.openBlock(),e.createElementBlock("div",ft,[e.createElementVNode("div",gt,[e.createElementVNode("div",kt,e.toDisplayString(u.value),1),l.value?(e.openBlock(),e.createBlock(C,{key:0,visible:d.value,"onUpdate:visible":b[0]||(b[0]=B=>d.value=B),placement:"bottom-end",width:220,trigger:"click","popper-class":"wi-web-recordset-columns-popper"},{reference:e.withCtx(()=>[yt]),default:e.withCtx(()=>[e.createElementVNode("div",Bt,[Et,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,B=>(e.openBlock(),e.createBlock(y,{key:B.key,class:"wi-web-recordset__column-item","model-value":s.value.has(B.key),"onUpdate:modelValue":t=>w(B.key,!!t)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(B.title),1)]),_:2},1032,["model-value","onUpdate:modelValue"]))),128))])]),_:1},8,["visible"])):e.createCommentVNode("",!0)]),e.createVNode(P,{data:o.value,border:"",size:"small",class:"wi-web-recordset__table","max-height":p.maxHeight},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,B=>(e.openBlock(),e.createBlock(A,{key:B.key,prop:B.key,label:B.title,"min-width":"120","show-overflow-tooltip":""},null,8,["prop","label"]))),128))]),_:1},8,["data","max-height"])])):e.createCommentVNode("",!0)}}}),q=S(Vt,[["__scopeId","data-v-96941d57"]]),Ct=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"})),x=r=>(e.pushScopeId("data-v-94659445"),r=r(),e.popScopeId(),r),Nt={class:"wi-web-env-switch__track"},$t={class:"wi-web-env-switch__items"},St=["disabled","onClick"],At={class:"wi-web-env-switch__icon"},It={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},Ut=x(()=>e.createElementVNode("path",{d:"M17.5 19a4.5 4.5 0 0 0 .6-8.96 6 6 0 0 0-11.63 1.4A3.8 3.8 0 0 0 7 19z"},null,-1)),Ft=[Ut],Pt={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},Rt=x(()=>e.createElementVNode("rect",{x:"2.5",y:"4",width:"19",height:"12",rx:"2","stroke-linejoin":"round"},null,-1)),Tt=x(()=>e.createElementVNode("path",{d:"M8.5 20h7M12 16v4"},null,-1)),xt=[Rt,Tt],zt={class:"wi-web-env-switch__label"},Lt={key:0,class:"wi-web-env-switch__hint"},Mt={class:"wi-web-env-switch__hint-text"},Ot={key:0,class:"wi-web-env-switch__hint-status"},Dt=e.defineComponent({__name:"EnvSwitch",props:{modelValue:{default:"local"},options:{default:()=>[]},disabled:{type:Boolean,default:!1},size:{default:"default"},showHint:{type:Boolean,default:!0}},emits:["update:modelValue","change"],setup(r,{emit:g}){const n=r,a=g,u=[{value:"local",label:"本地电脑",description:"在当前设备上执行,文件与终端直连本机",status:"已就绪",online:!0},{value:"cloud",label:"云电脑",description:"在云端环境中执行,算力与存储由服务端提供",status:"未连接",online:!1}],_={default:3,small:2},v=e.computed(()=>{const c=n.options??[];return c.length>0?c:u}),l=e.computed(()=>{if(!n.showHint)return null;const c=v.value;return c.find(o=>o.value===n.modelValue)??c[0]??null}),i=e.computed(()=>{const c=v.value,o=c.length||1,d=Math.max(c.findIndex(p=>p.value===n.modelValue),0),w=_[n.size]??_.default;return{width:`calc(${100/o}% - ${2*w/o}px)`,transform:`translateX(${d*100}%)`}}),s=c=>{n.disabled||c.disabled||c.value!==n.modelValue&&(a("update:modelValue",c.value),a("change",c))};return(c,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wi-web-env-switch",[`is-${c.size}`,{"is-disabled":c.disabled}]])},[e.createElementVNode("div",Nt,[e.createElementVNode("span",{class:"wi-web-env-switch__thumb",style:e.normalizeStyle(i.value)},null,4),e.createElementVNode("div",$t,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,d=>(e.openBlock(),e.createElementBlock("button",{key:d.value,type:"button",class:e.normalizeClass(["wi-web-env-switch__item",{"is-active":d.value===c.modelValue,"is-disabled":d.disabled}]),disabled:c.disabled||d.disabled,onClick:w=>s(d)},[e.createElementVNode("span",At,[d.value==="cloud"?(e.openBlock(),e.createElementBlock("svg",It,Ft)):(e.openBlock(),e.createElementBlock("svg",Pt,xt))]),e.createElementVNode("span",zt,e.toDisplayString(d.label),1)],10,St))),128))])]),l.value?(e.openBlock(),e.createElementBlock("div",Lt,[e.createElementVNode("span",Mt,e.toDisplayString(l.value.description),1),l.value.status?(e.openBlock(),e.createElementBlock("span",Ot,[e.createElementVNode("i",{class:e.normalizeClass(["wi-web-env-switch__dot",{"is-online":l.value.online}])},null,2),e.createTextVNode(" "+e.toDisplayString(l.value.status),1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],2))}}),jt=S(Dt,[["__scopeId","data-v-94659445"]]);Object.defineProperty(exports,"AiAnswerBubble",{enumerable:!0,get:()=>k.AiAnswerBubble});Object.defineProperty(exports,"DeepThinkingSteps",{enumerable:!0,get:()=>k.DeepThinkingSteps});Object.defineProperty(exports,"IframePage",{enumerable:!0,get:()=>k.IframePage});Object.defineProperty(exports,"KnowledgeStreamResult",{enumerable:!0,get:()=>k.KnowledgeStreamResult});Object.defineProperty(exports,"OutputFile",{enumerable:!0,get:()=>k.OutputFile});Object.defineProperty(exports,"createAnswerContentMap",{enumerable:!0,get:()=>k.createAnswerContentMap});Object.defineProperty(exports,"injectIframeResizerChild",{enumerable:!0,get:()=>k.injectIframeResizerChild});Object.defineProperty(exports,"provideIframePageConfig",{enumerable:!0,get:()=>k.provideIframePageConfig});Object.defineProperty(exports,"provideOutputFileConfig",{enumerable:!0,get:()=>k.provideOutputFileConfig});Object.defineProperty(exports,"resolveIframePlaceholders",{enumerable:!0,get:()=>k.resolveIframePlaceholders});Object.defineProperty(exports,"useIframePage",{enumerable:!0,get:()=>k.useIframePage});exports.AttachmentCard=M;exports.AttachmentList=T;exports.ChatContainer=bt;exports.ChatMessagesView=j;exports.EnvSwitch=jt;exports.Inputbox=O;exports.RecordsetTable=q;exports.createWebAnswerContentMap=D;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/web-ui/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export { default as RecordsetTable } from './recordset/RecordsetTable.vue';
|
|
|
10
10
|
export { createWebAnswerContentMap } from './recordset/webAnswerContentMap';
|
|
11
11
|
export { default as EnvSwitch } from './envswitch/EnvSwitch.vue';
|
|
12
12
|
export type { ChatEnvType, ChatEnvOption } from './envswitch/types';
|
|
13
|
-
export { AiAnswerBubble, createAnswerContentMap, DeepThinkingSteps, IframePage, injectIframeResizerChild, KnowledgeStreamResult, provideIframePageConfig, resolveIframePlaceholders, useIframePage, } from 'wi-chat/renderers';
|
|
14
|
-
export type { AnswerContentMap, IframePageConfig, UseIframePageReturn } from 'wi-chat/renderers';
|
|
13
|
+
export { AiAnswerBubble, createAnswerContentMap, DeepThinkingSteps, IframePage, injectIframeResizerChild, KnowledgeStreamResult, OutputFile, provideIframePageConfig, provideOutputFileConfig, resolveIframePlaceholders, useIframePage, } from 'wi-chat/renderers';
|
|
14
|
+
export type { AnswerContentMap, IframePageConfig, OutputFileConfig, OutputFilePreviewKind, OutputFilePreviewRequest, UseIframePageReturn, } from 'wi-chat/renderers';
|