wi-chat 0.0.0-stage → 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/core/index.cjs +2 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +454 -0
- package/dist/core/useAgent.d.ts +35 -0
- package/dist/core/useChat.d.ts +195 -0
- package/dist/core/useChatSession.d.ts +89 -0
- package/dist/core/useHistory.d.ts +63 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +81 -0
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +129 -0
- package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +77 -0
- package/dist/mobile-ui/chat/types.d.ts +9 -0
- package/dist/mobile-ui/index.cjs +2 -0
- package/dist/mobile-ui/index.d.ts +7 -0
- package/dist/mobile-ui/index.js +225 -0
- package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +95 -0
- package/dist/mobile-ui/style.css +1 -0
- package/dist/parser/answer.d.ts +51 -0
- package/dist/parser/answerCom/iframePage/parseIframePage.d.ts +49 -0
- package/dist/parser/answerCom/iframePage/types.d.ts +11 -0
- package/dist/parser/answerCom/knowledgeStream/parseKnowledgeStream.d.ts +54 -0
- package/dist/parser/answerCom/knowledgeStream/types.d.ts +27 -0
- package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +43 -0
- package/dist/parser/answerCom/outputFile/types.d.ts +17 -0
- package/dist/parser/answerCom/recordset/parseRecordset.d.ts +48 -0
- package/dist/parser/answerCom/recordset/types.d.ts +36 -0
- package/dist/parser/attach/attachActions.d.ts +43 -0
- package/dist/parser/attach/index.d.ts +9 -0
- package/dist/parser/attach/parseAttach.d.ts +27 -0
- package/dist/parser/attach/types.d.ts +48 -0
- package/dist/parser/deepThinking/parseDeepThinking.d.ts +30 -0
- package/dist/parser/deepThinking/types.d.ts +14 -0
- package/dist/parser/history/history.d.ts +54 -0
- package/dist/parser/history/index.d.ts +7 -0
- package/dist/parser/index.cjs +3 -0
- package/dist/parser/index.d.ts +45 -0
- package/dist/parser/index.js +479 -0
- package/dist/parser/message.d.ts +60 -0
- package/dist/parser/registry.d.ts +81 -0
- package/dist/parser/sse.d.ts +34 -0
- package/dist/parser/stream.d.ts +8 -0
- package/dist/renderers/aiAnswer/AiAnswerBubble.vue.d.ts +58 -0
- package/dist/renderers/aiAnswer/contentMap.d.ts +13 -0
- package/dist/renderers/deepThinking/DeepThinkingSteps.vue.d.ts +21 -0
- package/dist/renderers/iframePage/IframePage.vue.d.ts +19 -0
- package/dist/renderers/iframePage/useIframePage.d.ts +64 -0
- package/dist/renderers/index.cjs +2 -0
- package/dist/renderers/index.d.ts +12 -0
- package/dist/renderers/index.js +609 -0
- package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +19 -0
- 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 -0
- package/dist/request/api.d.ts +132 -0
- package/dist/request/client.d.ts +30 -0
- package/dist/request/index.cjs +4 -0
- package/dist/request/index.d.ts +18 -0
- package/dist/request/index.js +264 -0
- package/dist/request/login.d.ts +37 -0
- package/dist/request/ws.d.ts +91 -0
- package/dist/style.css +24 -0
- package/dist/styles/github.css +2 -0
- package/dist/styles/katex.css +2 -0
- package/dist/theme/index.cjs +3 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +37 -0
- package/dist/theme/theme.d.ts +40 -0
- package/dist/tools/attachDownload.d.ts +20 -0
- package/dist/tools/index.cjs +17 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +251 -0
- package/dist/tools/markdown/MarkdownContent.vue.d.ts +36 -0
- package/dist/tools/markdown/imagePreview.d.ts +15 -0
- package/dist/tools/markdown/index.d.ts +5 -0
- package/dist/tools/markdown/renderMarkdown.d.ts +22 -0
- package/dist/tools/markdown/tableDownload.d.ts +14 -0
- package/dist/tools/stream.d.ts +9 -0
- package/dist/tools/style.css +1 -0
- package/dist/tools/useAutoScroll.d.ts +31 -0
- package/dist/web-ui/attach/AttachmentCard.vue.d.ts +91 -0
- package/dist/web-ui/attach/AttachmentList.vue.d.ts +94 -0
- package/dist/web-ui/attach/types.d.ts +5 -0
- package/dist/web-ui/chat/ChatContainer.vue.d.ts +165 -0
- package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +88 -0
- package/dist/web-ui/chat/types.d.ts +24 -0
- package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +67 -0
- package/dist/web-ui/envswitch/types.d.ts +22 -0
- package/dist/web-ui/index.cjs +2 -0
- package/dist/web-ui/index.d.ts +14 -0
- package/dist/web-ui/index.js +1048 -0
- package/dist/web-ui/inputbox/Inputbox.vue.d.ts +215 -0
- package/dist/web-ui/recordset/RecordsetTable.vue.d.ts +37 -0
- package/dist/web-ui/recordset/webAnswerContentMap.d.ts +9 -0
- package/dist/web-ui/style.css +1 -0
- package/package.json +124 -4
- package/styles/github.css +2 -0
- package/styles/katex.css +2 -0
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";.wi-markdown{color:var(--wi-chat-text);font-size:14px;line-height:1.75;word-break:break-word;overflow-wrap:break-word}.wi-markdown>:first-child{margin-top:0}.wi-markdown>:last-child{margin-bottom:0}.wi-markdown p{margin:.5em 0}.wi-markdown h1,.wi-markdown h2,.wi-markdown h3,.wi-markdown h4,.wi-markdown h5,.wi-markdown h6{margin:1em 0 .5em;font-weight:600}.wi-markdown h1{font-size:1.5em}.wi-markdown h2{font-size:1.3em}.wi-markdown h3{font-size:1.15em}.wi-markdown h4,.wi-markdown h5,.wi-markdown h6{font-size:1em}.wi-markdown a{color:var(--wi-chat-primary)}.wi-markdown img{max-width:100%}.wi-markdown blockquote{margin:.5em 0;padding:.25em 1em;border-left:3px solid color-mix(in srgb,var(--wi-chat-primary) 40%,transparent);color:var(--wi-chat-text-secondary);background:color-mix(in srgb,var(--wi-chat-primary) 6%,transparent)}.wi-markdown hr{border:0;border-top:1px solid var(--wi-chat-border);margin:1em 0}.wi-markdown code{font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:.92em}.wi-markdown :not(pre)>code{padding:.15em .4em;border-radius:4px;background:var(--wi-chat-code-bg)}.wi-markdown .wi-md-block{margin:1em 0;border:1px solid var(--wi-chat-border);border-radius:var(--wi-chat-radius);overflow:hidden;background:var(--wi-chat-bg)}.wi-markdown .wi-md-block-header{display:flex;justify-content:space-between;align-items:center;padding:6px 12px;background:var(--wi-chat-header-bg);border-bottom:1px solid var(--wi-chat-border)}.wi-markdown .wi-md-block-header-left,.wi-markdown .wi-md-block-header-right{display:flex;align-items:center;gap:8px}.wi-markdown .wi-md-lang{font-size:12px;font-weight:600;color:var(--wi-chat-text)}.wi-markdown .wi-md-copy,.wi-markdown .wi-md-toggle{display:inline-flex;align-items:center;justify-content:center;padding:4px;border:0;border-radius:4px;background:none;color:var(--wi-chat-text-secondary);cursor:pointer}.wi-markdown .wi-md-copy:hover,.wi-markdown .wi-md-toggle:hover{background:color-mix(in srgb,var(--wi-chat-primary) 10%,transparent);color:var(--wi-chat-primary)}.wi-markdown .wi-md-copy.wi-md-copied{color:#22863a}.wi-markdown .wi-md-copy.wi-md-copied:after{content:"已复制";font-size:12px;color:#22863a}.wi-markdown .wi-md-code{margin:0;padding:14px 16px;overflow-x:auto;background:var(--wi-chat-code-bg)}.wi-markdown .wi-md-code code{background:transparent;padding:0}.wi-markdown .wi-md-block.wi-md-collapsed .wi-md-code{display:none}.wi-markdown .wi-md-block.wi-md-collapsed .wi-md-toggle svg{transform:rotate(-90deg);transition:transform .2s}.wi-markdown .wi-md-table{width:100%;border-collapse:collapse;margin:1em 0}.wi-markdown .wi-md-table thead{background:color-mix(in srgb,var(--wi-chat-primary) 8%,transparent)}.wi-markdown .wi-md-table th,.wi-markdown .wi-md-table td{padding:8px 10px;border:1px solid var(--wi-chat-border);text-align:center}.wi-markdown .wi-md-table th{font-weight:600}.wi-markdown .wi-md-list{margin:.5em 0;padding-left:0;list-style:none}.wi-markdown .wi-md-list-item{position:relative;margin:.25em 0;padding-left:1.5em}.wi-markdown .wi-md-list-ordered{counter-reset:wi-md-counter}.wi-markdown .wi-md-list-ordered>.wi-md-list-item:before{counter-increment:wi-md-counter;content:counter(wi-md-counter) ".";position:absolute;left:0;top:0;font-weight:600;min-width:1.2em;text-align:right}.wi-markdown .wi-md-list-bullet>.wi-md-list-item:before{content:"•";position:absolute;left:0;top:0;font-weight:700}.wi-markdown .wi-md-image-wrap{display:inline-block;position:relative;max-width:100%;cursor:zoom-in}.wi-markdown .wi-md-image-wrap:hover{opacity:.9}.wi-markdown .wi-md-image-download{position:absolute;top:8px;right:8px;display:flex;align-items:center;justify-content:center;width:28px;height:28px;background:#00000080;border-radius:4px;cursor:pointer;color:#fff;opacity:0;transition:opacity .2s ease;z-index:10}.wi-markdown .wi-md-image-wrap:hover .wi-md-image-download{opacity:1}.wi-markdown .wi-md-image-download:hover{background:#000000b3}.wi-markdown .wi-md-table-wrap{position:relative}.wi-markdown .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);border-radius:4px;background:var(--wi-chat-bg);color:var(--wi-chat-text-secondary);cursor:pointer;opacity:0;transition:opacity .2s ease;z-index:10}.wi-markdown .wi-md-table-wrap:hover .wi-md-table-download{opacity:1}.wi-markdown .wi-md-table-download:hover{color:var(--wi-chat-primary);border-color:var(--wi-chat-primary)}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface OnReachTopOptions {
|
|
4
|
+
/**
|
|
5
|
+
* 回调执行完成后是否自动补偿由于顶部前插内容导致的滚动偏移,避免视图跳变。
|
|
6
|
+
* 默认 true(若返回 Promise 则在其 resolve 后补偿)。
|
|
7
|
+
*/
|
|
8
|
+
preserveScroll?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* useAutoScroll 返回值
|
|
12
|
+
*/
|
|
13
|
+
export interface UseAutoScrollReturn {
|
|
14
|
+
/** 是否显示"回到底部"按钮(距底部超过阈值、自动滚动关闭时为 true) */
|
|
15
|
+
showScrollToBottom: Ref<boolean>;
|
|
16
|
+
/** 强制滚动到底部:等待渲染完成(nextTick + 一帧)后执行,并重置自动滚动状态为开启 */
|
|
17
|
+
forceScrollToBottom: () => Promise<void>;
|
|
18
|
+
/** 请求滚动到底部:自动滚动开启时执行强制滚动;关闭(用户上翻)时仅点亮"回到底部"按钮,不强滚 */
|
|
19
|
+
requestScrollToBottom: () => Promise<void>;
|
|
20
|
+
/** 注册"滚动触顶"回调(触发一次后需离开顶部区域才能再次触发;触发期间防重入),供向上翻页加载更早历史 */
|
|
21
|
+
onReachTop: (cb: () => unknown | Promise<unknown>, options?: OnReachTopOptions) => void;
|
|
22
|
+
/** 在执行前插动作(如加载更早历史)期间保持相对滚动位置:action 前记录 scrollHeight,渲染后补偿 scrollTop,避免视图跳变 */
|
|
23
|
+
preserveScrollPosition: (action: () => unknown | Promise<unknown>) => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 创建自动滚动控制句柄:监听滚动容器的滚动位置,维护"是否贴底 / 是否显示回到底部按钮"状态,
|
|
27
|
+
* 并提供触顶回调注册与前插位置补偿;组件内使用时卸载会自动移除滚动监听。
|
|
28
|
+
* @param scrollEl 滚动容器元素的 ref(需指向实际发生滚动的元素;ref 值变化时自动重挂监听)
|
|
29
|
+
* @returns 自动滚动控制句柄(成员说明见 UseAutoScrollReturn)
|
|
30
|
+
*/
|
|
31
|
+
export declare const useAutoScroll: (scrollEl: Ref<HTMLElement | undefined>) => UseAutoScrollReturn;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ChatAttachment } from 'wi-chat/parser';
|
|
2
|
+
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
/** 附件数据对象 */
|
|
5
|
+
item: ChatAttachment<any>;
|
|
6
|
+
/** 是否可点击 */
|
|
7
|
+
clickable?: boolean;
|
|
8
|
+
/** 是否可删除,默认 false */
|
|
9
|
+
removable?: boolean;
|
|
10
|
+
/** 是否展示下载按钮,默认自动判定(普通文件类型且有 fileId 或 raw 时展示) */
|
|
11
|
+
downloadable?: boolean;
|
|
12
|
+
/** 后端基础地址,用于解析远程文件下载/预览 URL */
|
|
13
|
+
baseURL?: string;
|
|
14
|
+
/** 自定义文件链接解析函数 */
|
|
15
|
+
getFileUrl?: (fileId: string) => string;
|
|
16
|
+
}>, {
|
|
17
|
+
clickable: boolean;
|
|
18
|
+
removable: boolean;
|
|
19
|
+
downloadable: any;
|
|
20
|
+
baseURL: string;
|
|
21
|
+
getFileUrl: any;
|
|
22
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
23
|
+
click: (item: ChatAttachment<any>) => void;
|
|
24
|
+
remove: (item: ChatAttachment<any>) => void;
|
|
25
|
+
download: (item: ChatAttachment<any>) => void;
|
|
26
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
27
|
+
/** 附件数据对象 */
|
|
28
|
+
item: ChatAttachment<any>;
|
|
29
|
+
/** 是否可点击 */
|
|
30
|
+
clickable?: boolean;
|
|
31
|
+
/** 是否可删除,默认 false */
|
|
32
|
+
removable?: boolean;
|
|
33
|
+
/** 是否展示下载按钮,默认自动判定(普通文件类型且有 fileId 或 raw 时展示) */
|
|
34
|
+
downloadable?: boolean;
|
|
35
|
+
/** 后端基础地址,用于解析远程文件下载/预览 URL */
|
|
36
|
+
baseURL?: string;
|
|
37
|
+
/** 自定义文件链接解析函数 */
|
|
38
|
+
getFileUrl?: (fileId: string) => string;
|
|
39
|
+
}>, {
|
|
40
|
+
clickable: boolean;
|
|
41
|
+
removable: boolean;
|
|
42
|
+
downloadable: any;
|
|
43
|
+
baseURL: string;
|
|
44
|
+
getFileUrl: any;
|
|
45
|
+
}>>> & {
|
|
46
|
+
onClick?: (item: ChatAttachment<any>) => any;
|
|
47
|
+
onDownload?: (item: ChatAttachment<any>) => any;
|
|
48
|
+
onRemove?: (item: ChatAttachment<any>) => any;
|
|
49
|
+
}, {
|
|
50
|
+
baseURL: string;
|
|
51
|
+
clickable: boolean;
|
|
52
|
+
removable: boolean;
|
|
53
|
+
downloadable: boolean;
|
|
54
|
+
getFileUrl: (fileId: string) => string;
|
|
55
|
+
}, {}>, {
|
|
56
|
+
icon?(_: {
|
|
57
|
+
item: ChatAttachment<any>;
|
|
58
|
+
}): any;
|
|
59
|
+
title?(_: {
|
|
60
|
+
item: ChatAttachment<any>;
|
|
61
|
+
}): any;
|
|
62
|
+
description?(_: {
|
|
63
|
+
item: ChatAttachment<any>;
|
|
64
|
+
}): any;
|
|
65
|
+
actions?(_: {
|
|
66
|
+
item: ChatAttachment<any>;
|
|
67
|
+
}): any;
|
|
68
|
+
}>;
|
|
69
|
+
export default _default;
|
|
70
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
71
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
72
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
73
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
74
|
+
} : {
|
|
75
|
+
type: import('vue').PropType<T[K]>;
|
|
76
|
+
required: true;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type __VLS_WithDefaults<P, D> = {
|
|
80
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
81
|
+
default: D[K];
|
|
82
|
+
}> : P[K];
|
|
83
|
+
};
|
|
84
|
+
type __VLS_Prettify<T> = {
|
|
85
|
+
[K in keyof T]: T[K];
|
|
86
|
+
} & {};
|
|
87
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
88
|
+
new (): {
|
|
89
|
+
$slots: S;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { AttachmentItem } from './types';
|
|
2
|
+
|
|
3
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
/** 附件列表,支持标准 AttachmentItem 对象数组或原生 File 对象数组 */
|
|
5
|
+
items?: any[];
|
|
6
|
+
/** 是否支持删除,默认 false */
|
|
7
|
+
removable?: boolean;
|
|
8
|
+
/** 是否支持点击下载,默认 undefined(卡片自动判定) */
|
|
9
|
+
downloadable?: boolean;
|
|
10
|
+
/** 是否可点击整卡片,默认 false */
|
|
11
|
+
clickable?: boolean;
|
|
12
|
+
/** 后端基础地址,用于解析远程文件下载/预览 URL */
|
|
13
|
+
baseURL?: string;
|
|
14
|
+
/** 自定义文件链接解析函数 */
|
|
15
|
+
getFileUrl?: (fileId: string) => string;
|
|
16
|
+
}>, {
|
|
17
|
+
items: () => any[];
|
|
18
|
+
removable: boolean;
|
|
19
|
+
downloadable: any;
|
|
20
|
+
clickable: boolean;
|
|
21
|
+
baseURL: string;
|
|
22
|
+
getFileUrl: any;
|
|
23
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
24
|
+
remove: (index: number, item: AttachmentItem<any>) => void;
|
|
25
|
+
click: (item: AttachmentItem<any>, index: number) => void;
|
|
26
|
+
download: (item: AttachmentItem<any>, index: number) => void;
|
|
27
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
28
|
+
/** 附件列表,支持标准 AttachmentItem 对象数组或原生 File 对象数组 */
|
|
29
|
+
items?: any[];
|
|
30
|
+
/** 是否支持删除,默认 false */
|
|
31
|
+
removable?: boolean;
|
|
32
|
+
/** 是否支持点击下载,默认 undefined(卡片自动判定) */
|
|
33
|
+
downloadable?: boolean;
|
|
34
|
+
/** 是否可点击整卡片,默认 false */
|
|
35
|
+
clickable?: boolean;
|
|
36
|
+
/** 后端基础地址,用于解析远程文件下载/预览 URL */
|
|
37
|
+
baseURL?: string;
|
|
38
|
+
/** 自定义文件链接解析函数 */
|
|
39
|
+
getFileUrl?: (fileId: string) => string;
|
|
40
|
+
}>, {
|
|
41
|
+
items: () => any[];
|
|
42
|
+
removable: boolean;
|
|
43
|
+
downloadable: any;
|
|
44
|
+
clickable: boolean;
|
|
45
|
+
baseURL: string;
|
|
46
|
+
getFileUrl: any;
|
|
47
|
+
}>>> & {
|
|
48
|
+
onClick?: (item: AttachmentItem<any>, index: number) => any;
|
|
49
|
+
onDownload?: (item: AttachmentItem<any>, index: number) => any;
|
|
50
|
+
onRemove?: (index: number, item: AttachmentItem<any>) => any;
|
|
51
|
+
}, {
|
|
52
|
+
baseURL: string;
|
|
53
|
+
clickable: boolean;
|
|
54
|
+
removable: boolean;
|
|
55
|
+
downloadable: boolean;
|
|
56
|
+
getFileUrl: (fileId: string) => string;
|
|
57
|
+
items: any[];
|
|
58
|
+
}, {}>, {
|
|
59
|
+
icon?(_: {
|
|
60
|
+
item: AttachmentItem<any>;
|
|
61
|
+
}): any;
|
|
62
|
+
title?(_: {
|
|
63
|
+
item: AttachmentItem<any>;
|
|
64
|
+
}): any;
|
|
65
|
+
description?(_: {
|
|
66
|
+
item: AttachmentItem<any>;
|
|
67
|
+
}): any;
|
|
68
|
+
actions?(_: {
|
|
69
|
+
item: AttachmentItem<any>;
|
|
70
|
+
}): any;
|
|
71
|
+
}>;
|
|
72
|
+
export default _default;
|
|
73
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
74
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
75
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
76
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
77
|
+
} : {
|
|
78
|
+
type: import('vue').PropType<T[K]>;
|
|
79
|
+
required: true;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
type __VLS_WithDefaults<P, D> = {
|
|
83
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
84
|
+
default: D[K];
|
|
85
|
+
}> : P[K];
|
|
86
|
+
};
|
|
87
|
+
type __VLS_Prettify<T> = {
|
|
88
|
+
[K in keyof T]: T[K];
|
|
89
|
+
} & {};
|
|
90
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
91
|
+
new (): {
|
|
92
|
+
$slots: S;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
|
|
2
|
+
import { OutputFileConfig } from 'wi-chat/renderers';
|
|
3
|
+
import { ChatAgentItem, ChatSubmitPayload } from './types';
|
|
4
|
+
|
|
5
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
/** 当前分组消息列表 */
|
|
7
|
+
messages: Message[];
|
|
8
|
+
/** 自定义回答类型 parser */
|
|
9
|
+
parsers?: AnswerParser<any>[];
|
|
10
|
+
/** 后端基础地址 */
|
|
11
|
+
baseURL?: string;
|
|
12
|
+
/** 自定义文件地址解析函数 */
|
|
13
|
+
getFileUrl?: (fileId: string) => string;
|
|
14
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
15
|
+
outputFileConfig?: OutputFileConfig;
|
|
16
|
+
/** 历史消息是否加载中 */
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
/** 流式回答是否进行中 */
|
|
19
|
+
talking?: boolean;
|
|
20
|
+
/** 会话 token;为空时禁用输入 */
|
|
21
|
+
session?: string;
|
|
22
|
+
/** 输入框文本 */
|
|
23
|
+
question?: string;
|
|
24
|
+
/** 提问是否携带之前对话上下文 */
|
|
25
|
+
incPrevQuestion?: "Y" | "N";
|
|
26
|
+
/** 智能体列表 */
|
|
27
|
+
agentList?: ChatAgentItem[];
|
|
28
|
+
/** 当前选中的智能体 */
|
|
29
|
+
currentAgent?: ChatAgentItem;
|
|
30
|
+
/** 输入框占位文案 */
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
/** 是否还有更早历史可加载 */
|
|
33
|
+
hasMore?: boolean;
|
|
34
|
+
/** 空态主标题 */
|
|
35
|
+
emptyTitle?: string;
|
|
36
|
+
/** 空态描述文案 */
|
|
37
|
+
emptyDescription?: string;
|
|
38
|
+
/** 是否禁用输入区 */
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
}>, {
|
|
41
|
+
parsers: () => any[];
|
|
42
|
+
baseURL: string;
|
|
43
|
+
getFileUrl: any;
|
|
44
|
+
loading: boolean;
|
|
45
|
+
talking: boolean;
|
|
46
|
+
session: string;
|
|
47
|
+
question: string;
|
|
48
|
+
incPrevQuestion: string;
|
|
49
|
+
agentList: () => any[];
|
|
50
|
+
currentAgent: any;
|
|
51
|
+
placeholder: string;
|
|
52
|
+
hasMore: boolean;
|
|
53
|
+
emptyTitle: string;
|
|
54
|
+
emptyDescription: string;
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
57
|
+
"update:question": (value: string) => void;
|
|
58
|
+
"update:incPrevQuestion": (value: "Y" | "N") => void;
|
|
59
|
+
submit: (payload: ChatSubmitPayload) => void;
|
|
60
|
+
stop: () => void;
|
|
61
|
+
selectAgent: (agent: ChatAgentItem) => void;
|
|
62
|
+
loadOlder: () => void;
|
|
63
|
+
updateThinkingExpanded: (message: AssistantMessage, expanded: boolean) => void;
|
|
64
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
65
|
+
/** 当前分组消息列表 */
|
|
66
|
+
messages: Message[];
|
|
67
|
+
/** 自定义回答类型 parser */
|
|
68
|
+
parsers?: AnswerParser<any>[];
|
|
69
|
+
/** 后端基础地址 */
|
|
70
|
+
baseURL?: string;
|
|
71
|
+
/** 自定义文件地址解析函数 */
|
|
72
|
+
getFileUrl?: (fileId: string) => string;
|
|
73
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
74
|
+
outputFileConfig?: OutputFileConfig;
|
|
75
|
+
/** 历史消息是否加载中 */
|
|
76
|
+
loading?: boolean;
|
|
77
|
+
/** 流式回答是否进行中 */
|
|
78
|
+
talking?: boolean;
|
|
79
|
+
/** 会话 token;为空时禁用输入 */
|
|
80
|
+
session?: string;
|
|
81
|
+
/** 输入框文本 */
|
|
82
|
+
question?: string;
|
|
83
|
+
/** 提问是否携带之前对话上下文 */
|
|
84
|
+
incPrevQuestion?: "Y" | "N";
|
|
85
|
+
/** 智能体列表 */
|
|
86
|
+
agentList?: ChatAgentItem[];
|
|
87
|
+
/** 当前选中的智能体 */
|
|
88
|
+
currentAgent?: ChatAgentItem;
|
|
89
|
+
/** 输入框占位文案 */
|
|
90
|
+
placeholder?: string;
|
|
91
|
+
/** 是否还有更早历史可加载 */
|
|
92
|
+
hasMore?: boolean;
|
|
93
|
+
/** 空态主标题 */
|
|
94
|
+
emptyTitle?: string;
|
|
95
|
+
/** 空态描述文案 */
|
|
96
|
+
emptyDescription?: string;
|
|
97
|
+
/** 是否禁用输入区 */
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
}>, {
|
|
100
|
+
parsers: () => any[];
|
|
101
|
+
baseURL: string;
|
|
102
|
+
getFileUrl: any;
|
|
103
|
+
loading: boolean;
|
|
104
|
+
talking: boolean;
|
|
105
|
+
session: string;
|
|
106
|
+
question: string;
|
|
107
|
+
incPrevQuestion: string;
|
|
108
|
+
agentList: () => any[];
|
|
109
|
+
currentAgent: any;
|
|
110
|
+
placeholder: string;
|
|
111
|
+
hasMore: boolean;
|
|
112
|
+
emptyTitle: string;
|
|
113
|
+
emptyDescription: string;
|
|
114
|
+
disabled: boolean;
|
|
115
|
+
}>>> & {
|
|
116
|
+
onSubmit?: (payload: ChatSubmitPayload) => any;
|
|
117
|
+
onLoadOlder?: () => any;
|
|
118
|
+
onUpdateThinkingExpanded?: (message: AssistantMessage, expanded: boolean) => any;
|
|
119
|
+
onStop?: () => any;
|
|
120
|
+
onSelectAgent?: (agent: ChatAgentItem) => any;
|
|
121
|
+
"onUpdate:incPrevQuestion"?: (value: "Y" | "N") => any;
|
|
122
|
+
"onUpdate:question"?: (value: string) => any;
|
|
123
|
+
}, {
|
|
124
|
+
parsers: AnswerParser<any>[];
|
|
125
|
+
question: string;
|
|
126
|
+
baseURL: string;
|
|
127
|
+
incPrevQuestion: "Y" | "N";
|
|
128
|
+
loading: boolean;
|
|
129
|
+
getFileUrl: (fileId: string) => string;
|
|
130
|
+
placeholder: string;
|
|
131
|
+
emptyTitle: string;
|
|
132
|
+
emptyDescription: string;
|
|
133
|
+
disabled: boolean;
|
|
134
|
+
talking: boolean;
|
|
135
|
+
agentList: ChatAgentItem[];
|
|
136
|
+
currentAgent: ChatAgentItem;
|
|
137
|
+
session: string;
|
|
138
|
+
hasMore: boolean;
|
|
139
|
+
}, {}>, {
|
|
140
|
+
messages?(_: {}): any;
|
|
141
|
+
"above-input"?(_: {}): any;
|
|
142
|
+
}>;
|
|
143
|
+
export default _default;
|
|
144
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
145
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
146
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
147
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
148
|
+
} : {
|
|
149
|
+
type: import('vue').PropType<T[K]>;
|
|
150
|
+
required: true;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
type __VLS_WithDefaults<P, D> = {
|
|
154
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
155
|
+
default: D[K];
|
|
156
|
+
}> : P[K];
|
|
157
|
+
};
|
|
158
|
+
type __VLS_Prettify<T> = {
|
|
159
|
+
[K in keyof T]: T[K];
|
|
160
|
+
} & {};
|
|
161
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
162
|
+
new (): {
|
|
163
|
+
$slots: S;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
|
|
2
|
+
import { OutputFileConfig } from 'wi-chat/renderers';
|
|
3
|
+
|
|
4
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
/** 当前分组消息列表 */
|
|
6
|
+
messages: Message[];
|
|
7
|
+
/** 自定义回答类型 parser(component 字段会注册进共享 contentMap) */
|
|
8
|
+
parsers?: AnswerParser[];
|
|
9
|
+
/** 后端基础地址,用于附件预览与下载 */
|
|
10
|
+
baseURL?: string;
|
|
11
|
+
/** 自定义文件地址解析函数 */
|
|
12
|
+
getFileUrl?: (fileId: string) => string;
|
|
13
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
14
|
+
outputFileConfig?: OutputFileConfig;
|
|
15
|
+
/** 历史消息是否加载中 */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** 空态主标题 */
|
|
18
|
+
emptyTitle?: string;
|
|
19
|
+
/** 空态描述文案 */
|
|
20
|
+
emptyDescription?: string;
|
|
21
|
+
}>, {
|
|
22
|
+
parsers: () => any[];
|
|
23
|
+
baseURL: string;
|
|
24
|
+
getFileUrl: any;
|
|
25
|
+
loading: boolean;
|
|
26
|
+
emptyTitle: string;
|
|
27
|
+
emptyDescription: string;
|
|
28
|
+
}>, {
|
|
29
|
+
/** 强制滚动到底部 */
|
|
30
|
+
forceScrollToBottom: () => Promise<void>;
|
|
31
|
+
/** 自动滚动开启时请求滚动到底部 */
|
|
32
|
+
requestScrollToBottom: () => Promise<void>;
|
|
33
|
+
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
34
|
+
loadOlder: () => void;
|
|
35
|
+
updateThinkingExpanded: (message: AssistantMessage, expanded: boolean) => void;
|
|
36
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
37
|
+
/** 当前分组消息列表 */
|
|
38
|
+
messages: Message[];
|
|
39
|
+
/** 自定义回答类型 parser(component 字段会注册进共享 contentMap) */
|
|
40
|
+
parsers?: AnswerParser[];
|
|
41
|
+
/** 后端基础地址,用于附件预览与下载 */
|
|
42
|
+
baseURL?: string;
|
|
43
|
+
/** 自定义文件地址解析函数 */
|
|
44
|
+
getFileUrl?: (fileId: string) => string;
|
|
45
|
+
/** output_file 文件加载 / 预览配置(缺省用 getFileUrl 拼默认下载地址) */
|
|
46
|
+
outputFileConfig?: OutputFileConfig;
|
|
47
|
+
/** 历史消息是否加载中 */
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
/** 空态主标题 */
|
|
50
|
+
emptyTitle?: string;
|
|
51
|
+
/** 空态描述文案 */
|
|
52
|
+
emptyDescription?: string;
|
|
53
|
+
}>, {
|
|
54
|
+
parsers: () => any[];
|
|
55
|
+
baseURL: string;
|
|
56
|
+
getFileUrl: any;
|
|
57
|
+
loading: boolean;
|
|
58
|
+
emptyTitle: string;
|
|
59
|
+
emptyDescription: string;
|
|
60
|
+
}>>> & {
|
|
61
|
+
onLoadOlder?: () => any;
|
|
62
|
+
onUpdateThinkingExpanded?: (message: AssistantMessage, expanded: boolean) => any;
|
|
63
|
+
}, {
|
|
64
|
+
parsers: AnswerParser[];
|
|
65
|
+
baseURL: string;
|
|
66
|
+
loading: boolean;
|
|
67
|
+
getFileUrl: (fileId: string) => string;
|
|
68
|
+
emptyTitle: string;
|
|
69
|
+
emptyDescription: string;
|
|
70
|
+
}, {}>;
|
|
71
|
+
export default _default;
|
|
72
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
73
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
74
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
75
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
76
|
+
} : {
|
|
77
|
+
type: import('vue').PropType<T[K]>;
|
|
78
|
+
required: true;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
type __VLS_WithDefaults<P, D> = {
|
|
82
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
83
|
+
default: D[K];
|
|
84
|
+
}> : P[K];
|
|
85
|
+
};
|
|
86
|
+
type __VLS_Prettify<T> = {
|
|
87
|
+
[K in keyof T]: T[K];
|
|
88
|
+
} & {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AttachmentItem } from '../attach/types';
|
|
2
|
+
|
|
3
|
+
/** Web 聊天容器使用的智能体选项 */
|
|
4
|
+
export interface ChatAgentItem {
|
|
5
|
+
/** 智能体 ID */
|
|
6
|
+
entry_id: string;
|
|
7
|
+
/** 智能体展示标题 */
|
|
8
|
+
entry_title?: string;
|
|
9
|
+
/** 智能体头像文件 ID */
|
|
10
|
+
image_id?: string;
|
|
11
|
+
/** 兼容后端扩展字段 */
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
/** Web 输入框提交载荷 */
|
|
15
|
+
export interface ChatSubmitPayload {
|
|
16
|
+
/** 提问文本 */
|
|
17
|
+
text: string;
|
|
18
|
+
/** 原生附件文件 */
|
|
19
|
+
files: File[];
|
|
20
|
+
/** 标准化附件列表 */
|
|
21
|
+
attachments?: AttachmentItem[];
|
|
22
|
+
/** 提交时选中的智能体 */
|
|
23
|
+
agent?: ChatAgentItem | null;
|
|
24
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ChatEnvOption, ChatEnvType } from './types';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
/** 当前选中的运行环境(v-model) */
|
|
5
|
+
modelValue?: ChatEnvType;
|
|
6
|
+
/** 选项列表;不传时使用内置的「本地电脑 / 云电脑」两项 */
|
|
7
|
+
options?: ChatEnvOption[];
|
|
8
|
+
/** 是否整体禁用(禁用态不响应点击,也不发出事件) */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** 尺寸档位:default 常规 / small 紧凑(用于工具栏内嵌) */
|
|
11
|
+
size?: 'default' | 'small';
|
|
12
|
+
/** 是否展示下方说明行(描述 + 状态),默认 true */
|
|
13
|
+
showHint?: boolean;
|
|
14
|
+
}>, {
|
|
15
|
+
modelValue: string;
|
|
16
|
+
options: () => any[];
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
size: string;
|
|
19
|
+
showHint: boolean;
|
|
20
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
|
+
"update:modelValue": (value: ChatEnvType) => void;
|
|
22
|
+
change: (option: ChatEnvOption) => void;
|
|
23
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
24
|
+
/** 当前选中的运行环境(v-model) */
|
|
25
|
+
modelValue?: ChatEnvType;
|
|
26
|
+
/** 选项列表;不传时使用内置的「本地电脑 / 云电脑」两项 */
|
|
27
|
+
options?: ChatEnvOption[];
|
|
28
|
+
/** 是否整体禁用(禁用态不响应点击,也不发出事件) */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** 尺寸档位:default 常规 / small 紧凑(用于工具栏内嵌) */
|
|
31
|
+
size?: 'default' | 'small';
|
|
32
|
+
/** 是否展示下方说明行(描述 + 状态),默认 true */
|
|
33
|
+
showHint?: boolean;
|
|
34
|
+
}>, {
|
|
35
|
+
modelValue: string;
|
|
36
|
+
options: () => any[];
|
|
37
|
+
disabled: boolean;
|
|
38
|
+
size: string;
|
|
39
|
+
showHint: boolean;
|
|
40
|
+
}>>> & {
|
|
41
|
+
onChange?: (option: ChatEnvOption) => any;
|
|
42
|
+
"onUpdate:modelValue"?: (value: ChatEnvType) => any;
|
|
43
|
+
}, {
|
|
44
|
+
size: 'default' | 'small';
|
|
45
|
+
options: ChatEnvOption[];
|
|
46
|
+
modelValue: ChatEnvType;
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
showHint: boolean;
|
|
49
|
+
}, {}>;
|
|
50
|
+
export default _default;
|
|
51
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
52
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
53
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
54
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
55
|
+
} : {
|
|
56
|
+
type: import('vue').PropType<T[K]>;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type __VLS_WithDefaults<P, D> = {
|
|
61
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
62
|
+
default: D[K];
|
|
63
|
+
}> : P[K];
|
|
64
|
+
};
|
|
65
|
+
type __VLS_Prettify<T> = {
|
|
66
|
+
[K in keyof T]: T[K];
|
|
67
|
+
} & {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web 端运行环境切换器类型定义
|
|
3
|
+
* 仅描述端侧 UI 的取值与选项结构;环境探测(如 Electron 桥是否可用)与真正的切换动作
|
|
4
|
+
* 一律由宿主实现,组件本身不发起请求、不读写持久化状态。
|
|
5
|
+
*/
|
|
6
|
+
/** 运行环境标识:local 本地电脑(当前设备)/ cloud 云电脑(云端环境) */
|
|
7
|
+
export type ChatEnvType = 'local' | 'cloud';
|
|
8
|
+
/** 运行环境切换器的单个选项 */
|
|
9
|
+
export interface ChatEnvOption {
|
|
10
|
+
/** 环境标识,与组件 v-model 取值一致 */
|
|
11
|
+
value: ChatEnvType;
|
|
12
|
+
/** 选项展示名称,如「本地电脑」 */
|
|
13
|
+
label: string;
|
|
14
|
+
/** 选中后在说明行展示的补充文案 */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** 说明行的状态文案,如「已就绪」「未连接」;为空时不渲染状态区 */
|
|
17
|
+
status?: string;
|
|
18
|
+
/** 状态是否为在线态:true 显示绿点 / false 显示灰点(仅影响状态点配色) */
|
|
19
|
+
online?: boolean;
|
|
20
|
+
/** 该选项是否不可选(置灰且不响应点击) */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|