wi-chat 0.0.0-stage → 0.3.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 +76 -0
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +124 -0
- package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +72 -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 +218 -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/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 +42 -0
- package/dist/parser/index.js +439 -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 +9 -0
- package/dist/renderers/index.js +243 -0
- package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +19 -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 +160 -0
- package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +83 -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 +1034 -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,160 @@
|
|
|
1
|
+
import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
|
|
2
|
+
import { ChatAgentItem, ChatSubmitPayload } from './types';
|
|
3
|
+
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
5
|
+
/** 当前分组消息列表 */
|
|
6
|
+
messages: Message[];
|
|
7
|
+
/** 自定义回答类型 parser */
|
|
8
|
+
parsers?: AnswerParser<any>[];
|
|
9
|
+
/** 后端基础地址 */
|
|
10
|
+
baseURL?: string;
|
|
11
|
+
/** 自定义文件地址解析函数 */
|
|
12
|
+
getFileUrl?: (fileId: string) => string;
|
|
13
|
+
/** 历史消息是否加载中 */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** 流式回答是否进行中 */
|
|
16
|
+
talking?: boolean;
|
|
17
|
+
/** 会话 token;为空时禁用输入 */
|
|
18
|
+
session?: string;
|
|
19
|
+
/** 输入框文本 */
|
|
20
|
+
question?: string;
|
|
21
|
+
/** 提问是否携带之前对话上下文 */
|
|
22
|
+
incPrevQuestion?: "Y" | "N";
|
|
23
|
+
/** 智能体列表 */
|
|
24
|
+
agentList?: ChatAgentItem[];
|
|
25
|
+
/** 当前选中的智能体 */
|
|
26
|
+
currentAgent?: ChatAgentItem;
|
|
27
|
+
/** 输入框占位文案 */
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/** 是否还有更早历史可加载 */
|
|
30
|
+
hasMore?: boolean;
|
|
31
|
+
/** 空态主标题 */
|
|
32
|
+
emptyTitle?: string;
|
|
33
|
+
/** 空态描述文案 */
|
|
34
|
+
emptyDescription?: string;
|
|
35
|
+
/** 是否禁用输入区 */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
}>, {
|
|
38
|
+
parsers: () => any[];
|
|
39
|
+
baseURL: string;
|
|
40
|
+
getFileUrl: any;
|
|
41
|
+
loading: boolean;
|
|
42
|
+
talking: boolean;
|
|
43
|
+
session: string;
|
|
44
|
+
question: string;
|
|
45
|
+
incPrevQuestion: string;
|
|
46
|
+
agentList: () => any[];
|
|
47
|
+
currentAgent: any;
|
|
48
|
+
placeholder: string;
|
|
49
|
+
hasMore: boolean;
|
|
50
|
+
emptyTitle: string;
|
|
51
|
+
emptyDescription: string;
|
|
52
|
+
disabled: boolean;
|
|
53
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
54
|
+
"update:question": (value: string) => void;
|
|
55
|
+
"update:incPrevQuestion": (value: "Y" | "N") => void;
|
|
56
|
+
submit: (payload: ChatSubmitPayload) => void;
|
|
57
|
+
stop: () => void;
|
|
58
|
+
selectAgent: (agent: ChatAgentItem) => void;
|
|
59
|
+
loadOlder: () => void;
|
|
60
|
+
updateThinkingExpanded: (message: AssistantMessage, expanded: boolean) => void;
|
|
61
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
62
|
+
/** 当前分组消息列表 */
|
|
63
|
+
messages: Message[];
|
|
64
|
+
/** 自定义回答类型 parser */
|
|
65
|
+
parsers?: AnswerParser<any>[];
|
|
66
|
+
/** 后端基础地址 */
|
|
67
|
+
baseURL?: string;
|
|
68
|
+
/** 自定义文件地址解析函数 */
|
|
69
|
+
getFileUrl?: (fileId: string) => string;
|
|
70
|
+
/** 历史消息是否加载中 */
|
|
71
|
+
loading?: boolean;
|
|
72
|
+
/** 流式回答是否进行中 */
|
|
73
|
+
talking?: boolean;
|
|
74
|
+
/** 会话 token;为空时禁用输入 */
|
|
75
|
+
session?: string;
|
|
76
|
+
/** 输入框文本 */
|
|
77
|
+
question?: string;
|
|
78
|
+
/** 提问是否携带之前对话上下文 */
|
|
79
|
+
incPrevQuestion?: "Y" | "N";
|
|
80
|
+
/** 智能体列表 */
|
|
81
|
+
agentList?: ChatAgentItem[];
|
|
82
|
+
/** 当前选中的智能体 */
|
|
83
|
+
currentAgent?: ChatAgentItem;
|
|
84
|
+
/** 输入框占位文案 */
|
|
85
|
+
placeholder?: string;
|
|
86
|
+
/** 是否还有更早历史可加载 */
|
|
87
|
+
hasMore?: boolean;
|
|
88
|
+
/** 空态主标题 */
|
|
89
|
+
emptyTitle?: string;
|
|
90
|
+
/** 空态描述文案 */
|
|
91
|
+
emptyDescription?: string;
|
|
92
|
+
/** 是否禁用输入区 */
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
}>, {
|
|
95
|
+
parsers: () => any[];
|
|
96
|
+
baseURL: string;
|
|
97
|
+
getFileUrl: any;
|
|
98
|
+
loading: boolean;
|
|
99
|
+
talking: boolean;
|
|
100
|
+
session: string;
|
|
101
|
+
question: string;
|
|
102
|
+
incPrevQuestion: string;
|
|
103
|
+
agentList: () => any[];
|
|
104
|
+
currentAgent: any;
|
|
105
|
+
placeholder: string;
|
|
106
|
+
hasMore: boolean;
|
|
107
|
+
emptyTitle: string;
|
|
108
|
+
emptyDescription: string;
|
|
109
|
+
disabled: boolean;
|
|
110
|
+
}>>> & {
|
|
111
|
+
onSubmit?: (payload: ChatSubmitPayload) => any;
|
|
112
|
+
onLoadOlder?: () => any;
|
|
113
|
+
onUpdateThinkingExpanded?: (message: AssistantMessage, expanded: boolean) => any;
|
|
114
|
+
onStop?: () => any;
|
|
115
|
+
onSelectAgent?: (agent: ChatAgentItem) => any;
|
|
116
|
+
"onUpdate:incPrevQuestion"?: (value: "Y" | "N") => any;
|
|
117
|
+
"onUpdate:question"?: (value: string) => any;
|
|
118
|
+
}, {
|
|
119
|
+
parsers: AnswerParser<any>[];
|
|
120
|
+
question: string;
|
|
121
|
+
baseURL: string;
|
|
122
|
+
incPrevQuestion: "Y" | "N";
|
|
123
|
+
loading: boolean;
|
|
124
|
+
getFileUrl: (fileId: string) => string;
|
|
125
|
+
placeholder: string;
|
|
126
|
+
emptyTitle: string;
|
|
127
|
+
emptyDescription: string;
|
|
128
|
+
disabled: boolean;
|
|
129
|
+
talking: boolean;
|
|
130
|
+
agentList: ChatAgentItem[];
|
|
131
|
+
currentAgent: ChatAgentItem;
|
|
132
|
+
session: string;
|
|
133
|
+
hasMore: boolean;
|
|
134
|
+
}, {}>, {
|
|
135
|
+
messages?(_: {}): any;
|
|
136
|
+
"above-input"?(_: {}): any;
|
|
137
|
+
}>;
|
|
138
|
+
export default _default;
|
|
139
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
140
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
141
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
142
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
143
|
+
} : {
|
|
144
|
+
type: import('vue').PropType<T[K]>;
|
|
145
|
+
required: true;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
type __VLS_WithDefaults<P, D> = {
|
|
149
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
150
|
+
default: D[K];
|
|
151
|
+
}> : P[K];
|
|
152
|
+
};
|
|
153
|
+
type __VLS_Prettify<T> = {
|
|
154
|
+
[K in keyof T]: T[K];
|
|
155
|
+
} & {};
|
|
156
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
157
|
+
new (): {
|
|
158
|
+
$slots: S;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AnswerParser, AssistantMessage, Message } from 'wi-chat/parser';
|
|
2
|
+
|
|
3
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
/** 当前分组消息列表 */
|
|
5
|
+
messages: Message[];
|
|
6
|
+
/** 自定义回答类型 parser(component 字段会注册进共享 contentMap) */
|
|
7
|
+
parsers?: AnswerParser[];
|
|
8
|
+
/** 后端基础地址,用于附件预览与下载 */
|
|
9
|
+
baseURL?: string;
|
|
10
|
+
/** 自定义文件地址解析函数 */
|
|
11
|
+
getFileUrl?: (fileId: string) => string;
|
|
12
|
+
/** 历史消息是否加载中 */
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/** 空态主标题 */
|
|
15
|
+
emptyTitle?: string;
|
|
16
|
+
/** 空态描述文案 */
|
|
17
|
+
emptyDescription?: string;
|
|
18
|
+
}>, {
|
|
19
|
+
parsers: () => any[];
|
|
20
|
+
baseURL: string;
|
|
21
|
+
getFileUrl: any;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
emptyTitle: string;
|
|
24
|
+
emptyDescription: string;
|
|
25
|
+
}>, {
|
|
26
|
+
/** 强制滚动到底部 */
|
|
27
|
+
forceScrollToBottom: () => Promise<void>;
|
|
28
|
+
/** 自动滚动开启时请求滚动到底部 */
|
|
29
|
+
requestScrollToBottom: () => Promise<void>;
|
|
30
|
+
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
31
|
+
loadOlder: () => void;
|
|
32
|
+
updateThinkingExpanded: (message: AssistantMessage, expanded: boolean) => void;
|
|
33
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
34
|
+
/** 当前分组消息列表 */
|
|
35
|
+
messages: Message[];
|
|
36
|
+
/** 自定义回答类型 parser(component 字段会注册进共享 contentMap) */
|
|
37
|
+
parsers?: AnswerParser[];
|
|
38
|
+
/** 后端基础地址,用于附件预览与下载 */
|
|
39
|
+
baseURL?: string;
|
|
40
|
+
/** 自定义文件地址解析函数 */
|
|
41
|
+
getFileUrl?: (fileId: string) => string;
|
|
42
|
+
/** 历史消息是否加载中 */
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
/** 空态主标题 */
|
|
45
|
+
emptyTitle?: string;
|
|
46
|
+
/** 空态描述文案 */
|
|
47
|
+
emptyDescription?: string;
|
|
48
|
+
}>, {
|
|
49
|
+
parsers: () => any[];
|
|
50
|
+
baseURL: string;
|
|
51
|
+
getFileUrl: any;
|
|
52
|
+
loading: boolean;
|
|
53
|
+
emptyTitle: string;
|
|
54
|
+
emptyDescription: string;
|
|
55
|
+
}>>> & {
|
|
56
|
+
onLoadOlder?: () => any;
|
|
57
|
+
onUpdateThinkingExpanded?: (message: AssistantMessage, expanded: boolean) => any;
|
|
58
|
+
}, {
|
|
59
|
+
parsers: AnswerParser[];
|
|
60
|
+
baseURL: string;
|
|
61
|
+
loading: boolean;
|
|
62
|
+
getFileUrl: (fileId: string) => string;
|
|
63
|
+
emptyTitle: string;
|
|
64
|
+
emptyDescription: string;
|
|
65
|
+
}, {}>;
|
|
66
|
+
export default _default;
|
|
67
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
68
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
69
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
70
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
71
|
+
} : {
|
|
72
|
+
type: import('vue').PropType<T[K]>;
|
|
73
|
+
required: true;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
type __VLS_WithDefaults<P, D> = {
|
|
77
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
78
|
+
default: D[K];
|
|
79
|
+
}> : P[K];
|
|
80
|
+
};
|
|
81
|
+
type __VLS_Prettify<T> = {
|
|
82
|
+
[K in keyof T]: T[K];
|
|
83
|
+
} & {};
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +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;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
export { default as Inputbox } from './inputbox/Inputbox.vue';
|
|
3
|
+
export { default as AttachmentList } from './attach/AttachmentList.vue';
|
|
4
|
+
export { default as AttachmentCard } from './attach/AttachmentCard.vue';
|
|
5
|
+
export type { AttachmentItem, AttachmentType, FileAttachContent } from './attach/types';
|
|
6
|
+
export { default as ChatMessagesView } from './chat/ChatMessagesView.vue';
|
|
7
|
+
export { default as ChatContainer } from './chat/ChatContainer.vue';
|
|
8
|
+
export type { ChatAgentItem, ChatSubmitPayload } from './chat/types';
|
|
9
|
+
export { default as RecordsetTable } from './recordset/RecordsetTable.vue';
|
|
10
|
+
export { createWebAnswerContentMap } from './recordset/webAnswerContentMap';
|
|
11
|
+
export { default as EnvSwitch } from './envswitch/EnvSwitch.vue';
|
|
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';
|