@agentscope-ai/chat 1.1.46 → 1.1.48
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/bin/cli.js +1 -1
- package/components/AgentScopeRuntimeWebUI/core/Chat/hooks/useChatRequest.tsx +2 -1
- package/components/AgentScopeRuntimeWebUI/core/types/IChatAnywhere.ts +14 -2
- package/components/AssetsPreview/Image.tsx +3 -2
- package/components/AssetsPreview/Video.tsx +1 -1
- package/components/AssetsPreview/index.tsx +6 -1
- package/components/AssetsPreview/style.ts +12 -0
- package/components/Markdown/Markdown.tsx +18 -10
- package/components/Markdown/demo/basic.tsx +7 -1
- package/components/Markdown/styles.ts +5 -0
- package/components/OperateCard/demo/rag.tsx +2 -0
- package/components/OperateCard/preset/Rag.tsx +53 -40
- package/components/OperateCard/style.ts +40 -16
- package/lib/AgentScopeRuntimeWebUI/core/Chat/hooks/useChatRequest.js +29 -28
- package/lib/AgentScopeRuntimeWebUI/core/types/IChatAnywhere.d.ts +2 -1
- package/lib/AssetsPreview/Image.js +7 -2
- package/lib/AssetsPreview/Video.js +4 -2
- package/lib/AssetsPreview/index.js +5 -1
- package/lib/AssetsPreview/style.js +1 -1
- package/lib/Markdown/Markdown.js +21 -8
- package/lib/Markdown/styles.js +3 -1
- package/lib/OperateCard/preset/Rag.d.ts +8 -17
- package/lib/OperateCard/preset/Rag.js +64 -31
- package/lib/OperateCard/style.js +10 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ async function startServer() {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
execSync(
|
|
34
|
-
`cd ${__dirname}/starter_webui && npm install && BASE_URL=${
|
|
34
|
+
`cd ${__dirname}/starter_webui && npm install && npx cross-env BASE_URL=${
|
|
35
35
|
options.url || 'BASE_URL'
|
|
36
36
|
} TOKEN=${options.token || 'TOKEN'} npm run dev`,
|
|
37
37
|
{
|
|
@@ -134,7 +134,8 @@ export default function useChatRequest(options: UseChatRequestOptions) {
|
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
const
|
|
137
|
+
const responseParser = apiOptionsRef.current.responseParser || JSON.parse;
|
|
138
|
+
const chunkData = responseParser(chunk.data);
|
|
138
139
|
const res = agentScopeRuntimeResponseBuilder.handle(chunkData);
|
|
139
140
|
|
|
140
141
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { UploadProps } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
IAgentScopeRuntimeMessage,
|
|
4
|
+
IAgentScopeRuntimeResponse,
|
|
5
|
+
IContent,
|
|
6
|
+
} from '../AgentScopeRuntime/types';
|
|
3
7
|
import { IAgentScopeRuntimeWebUISession } from './ISessions';
|
|
4
8
|
|
|
5
9
|
/**
|
|
@@ -23,8 +27,16 @@ export interface IAgentScopeRuntimeWebUIAPIOptions {
|
|
|
23
27
|
* @param data
|
|
24
28
|
* @returns
|
|
25
29
|
*/
|
|
26
|
-
fetch?: (data: {
|
|
30
|
+
fetch?: (data: {
|
|
31
|
+
input: any[];
|
|
32
|
+
biz_params?: IAgentScopeRuntimeWebUIInputData['biz_params'];
|
|
33
|
+
}) => Promise<Response>;
|
|
34
|
+
|
|
27
35
|
enableHistoryMessages?: boolean;
|
|
36
|
+
|
|
37
|
+
responseParser?: (
|
|
38
|
+
response: Response,
|
|
39
|
+
) => IAgentScopeRuntimeResponse | IAgentScopeRuntimeMessage | IContent;
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
/**
|
|
@@ -6,15 +6,16 @@ import { Locale } from "antd/es/locale";
|
|
|
6
6
|
|
|
7
7
|
export default function (props: IImage) {
|
|
8
8
|
const prefixCls = useProviderContext().getPrefixCls('assets-preview-image');
|
|
9
|
+
const { width = 1, height = 1, src } = props;
|
|
9
10
|
|
|
10
11
|
return <div className={prefixCls} style={{
|
|
11
|
-
aspectRatio: `${
|
|
12
|
+
aspectRatio: `${width}/${height}`,
|
|
12
13
|
}}>
|
|
13
14
|
<ConfigProvider
|
|
14
15
|
locale={{
|
|
15
16
|
Image: { preview: '' }
|
|
16
17
|
} as Locale}
|
|
17
|
-
><Image src={
|
|
18
|
+
><Image src={src} width={"100%"} height={"100%"} /></ConfigProvider>
|
|
18
19
|
</div>;
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -7,7 +7,7 @@ import { IconButton } from "@agentscope-ai/design";
|
|
|
7
7
|
|
|
8
8
|
export default function Video(props: IVideo) {
|
|
9
9
|
const prefixCls = useProviderContext().getPrefixCls('assets-preview-video');
|
|
10
|
-
const { width, height, poster, src, ...rest } = props;
|
|
10
|
+
const { width = 1, height = 1, poster, src, ...rest } = props;
|
|
11
11
|
const videoRef = useRef<HTMLVideoElement>(null);
|
|
12
12
|
const [isPlaying, setIsPlaying] = useState(false);
|
|
13
13
|
const [duration, setDuration] = useState(0);
|
|
@@ -8,6 +8,8 @@ import Audio from './Audio';
|
|
|
8
8
|
import { useCallback, useDeferredValue, useEffect, useRef, useState } from 'react';
|
|
9
9
|
import { SparkLeftLine, SparkRightLine } from '@agentscope-ai/icons';
|
|
10
10
|
import { IconButton } from '@agentscope-ai/design';
|
|
11
|
+
import { useUpdate, useSize } from 'ahooks';
|
|
12
|
+
|
|
11
13
|
export interface IAssetsPreviewProps {
|
|
12
14
|
/**
|
|
13
15
|
* @description 类名
|
|
@@ -44,6 +46,7 @@ export interface IAssetsPreviewProps {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
function AssetsPreview(props: IAssetsPreviewProps) {
|
|
49
|
+
const update = useUpdate();
|
|
47
50
|
const prefixCls = useProviderContext().getPrefixCls('assets-preview');
|
|
48
51
|
const ref = useRef<HTMLDivElement>(null);
|
|
49
52
|
const { height = 144 } = props;
|
|
@@ -51,6 +54,7 @@ function AssetsPreview(props: IAssetsPreviewProps) {
|
|
|
51
54
|
const maxWidth = useRef<number>(0);
|
|
52
55
|
const [scrollLeft, setScrollLeft] = useState<number>(0);
|
|
53
56
|
const deferScrollLeft = useDeferredValue(scrollLeft);
|
|
57
|
+
const size = useSize(ref);
|
|
54
58
|
|
|
55
59
|
const onScroll = useCallback((e) => {
|
|
56
60
|
setScrollLeft(e.target.scrollLeft);
|
|
@@ -64,7 +68,8 @@ function AssetsPreview(props: IAssetsPreviewProps) {
|
|
|
64
68
|
if (ref.current && props.type !== 'audio') {
|
|
65
69
|
maxWidth.current = ref.current.scrollWidth - ref.current.clientWidth;
|
|
66
70
|
}
|
|
67
|
-
|
|
71
|
+
update();
|
|
72
|
+
}, [props.data.length, size?.width])
|
|
68
73
|
|
|
69
74
|
|
|
70
75
|
const toArrow = useCallback((direct: 'left' | 'right') => {
|
|
@@ -96,6 +96,18 @@ export default createGlobalStyle`
|
|
|
96
96
|
width: 100%;
|
|
97
97
|
height: 100%;
|
|
98
98
|
object-fit: cover;
|
|
99
|
+
|
|
100
|
+
&:fullscreen {
|
|
101
|
+
object-fit: contain;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:-webkit-full-screen {
|
|
105
|
+
object-fit: contain;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&:-moz-full-screen {
|
|
109
|
+
object-fit: contain;
|
|
110
|
+
}
|
|
99
111
|
}
|
|
100
112
|
|
|
101
113
|
&-overlay {
|
|
@@ -47,7 +47,7 @@ export default memo(function (props: MarkdownProps) {
|
|
|
47
47
|
const prefixCls = useProviderContext().getPrefixCls('markdown');
|
|
48
48
|
const {
|
|
49
49
|
raw = false,
|
|
50
|
-
allowHtml =
|
|
50
|
+
allowHtml = false,
|
|
51
51
|
} = props;
|
|
52
52
|
|
|
53
53
|
const {
|
|
@@ -63,17 +63,13 @@ export default memo(function (props: MarkdownProps) {
|
|
|
63
63
|
img: props.disableImage ? DisabledImage : Media,
|
|
64
64
|
citation: CitationComponent,
|
|
65
65
|
'custom-cursor': CursorComponent,
|
|
66
|
-
|
|
67
66
|
a: Link,
|
|
68
67
|
...props.components,
|
|
69
68
|
}), [props.disableImage, CitationComponent, props.components]);
|
|
70
69
|
|
|
71
|
-
const dompurifyConfig = useMemo(() =>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} : EMPTY_DOMPURIFY_CONFIG
|
|
75
|
-
, [allowHtml]);
|
|
76
|
-
|
|
70
|
+
const dompurifyConfig = useMemo(() => ({
|
|
71
|
+
ADD_TAGS: ['custom-cursor', 'citation']
|
|
72
|
+
}), []);
|
|
77
73
|
|
|
78
74
|
// 使用 useMemo 缓存 extensions 配置
|
|
79
75
|
const { extensions, walkTokens } = useMemo(() => {
|
|
@@ -92,13 +88,25 @@ export default memo(function (props: MarkdownProps) {
|
|
|
92
88
|
const config = useMemo(() => ({
|
|
93
89
|
extensions,
|
|
94
90
|
walkTokens,
|
|
95
|
-
|
|
91
|
+
// 当 allowHtml 为 false 时,转义 HTML 标签使其显示为字符串
|
|
92
|
+
...(!allowHtml && {
|
|
93
|
+
renderer: {
|
|
94
|
+
html(token: { text?: string; raw?: string }) {
|
|
95
|
+
const text = token.text || token.raw || '';
|
|
96
|
+
return text.replace(/</g, '<').replace(/>/g, '>');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}), [extensions, allowHtml]);
|
|
96
101
|
|
|
97
102
|
const fallback = <Raw content={content || ''} baseFontSize={baseFontSize} baseLineHeight={baseLineHeight} />;
|
|
98
103
|
|
|
99
104
|
if (raw || !isSupportsLookbehindAssertions) return fallback;
|
|
100
105
|
|
|
101
|
-
return <ErrorBoundary
|
|
106
|
+
return <ErrorBoundary fallbackRender={(...args) => {
|
|
107
|
+
console.error(args);
|
|
108
|
+
return fallback;
|
|
109
|
+
}}>
|
|
102
110
|
<MarkdownX
|
|
103
111
|
dompurifyConfig={dompurifyConfig}
|
|
104
112
|
cursor={props.cursor}
|
|
@@ -11,6 +11,12 @@ const content = `# 这是一个一级标题
|
|
|
11
11
|
##### 这是一个五级标题
|
|
12
12
|
###### 这是一个六级标题
|
|
13
13
|
|
|
14
|
+
<div>
|
|
15
|
+
????
|
|
16
|
+
<h1>这是一个标题</h1>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
|
|
14
20
|
---
|
|
15
21
|
|
|
16
22
|
这是第一个段落。
|
|
@@ -106,6 +112,6 @@ export default function () {
|
|
|
106
112
|
<Input.TextArea value={value} onChange={(e) => setValue(e.target.value)} autoSize={{ minRows: 30, maxRows: 30 }} />
|
|
107
113
|
</Modal>
|
|
108
114
|
</div>
|
|
109
|
-
<Markdown content={value} />
|
|
115
|
+
<Markdown content={value} allowHtml={false} disableImage={true} />
|
|
110
116
|
</>;
|
|
111
117
|
}
|
|
@@ -45,6 +45,11 @@ export default createGlobalStyle`
|
|
|
45
45
|
.${(p) => p.theme.prefixCls}-mermaid-graph,
|
|
46
46
|
.${(p) => p.theme.prefixCls}-codeHighlighter-code {
|
|
47
47
|
border: none;
|
|
48
|
+
background-color: ${(p) => p.theme.colorBgBase};
|
|
49
|
+
|
|
50
|
+
* {
|
|
51
|
+
background-color: transparent !important;
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
|
|
@@ -5,6 +5,7 @@ export default function () {
|
|
|
5
5
|
return <Flex vertical gap={16}>
|
|
6
6
|
<Rag
|
|
7
7
|
query='GPT-5技术博客、行业分析、技术特性 AI原生 GPT-5技术博客、行业分析、技术特性 AI原生'
|
|
8
|
+
filters='[{"name": "来源", "value": "文档库"}]'
|
|
8
9
|
subTitle="GPT-5技术博客、行业分析、技术特性"
|
|
9
10
|
images={[
|
|
10
11
|
'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
|
|
@@ -12,6 +13,7 @@ export default function () {
|
|
|
12
13
|
]}
|
|
13
14
|
list={[
|
|
14
15
|
{
|
|
16
|
+
score: 0.8,
|
|
15
17
|
title: '【文档库】GPT-5 技术博客', content: 'Aliyun Bailianis a product offered by Alibaba Cloud, which is the cloud computing arm of Alibaba Group. Bailian is a high-performance AI development platform designed to help users build, deploy, and manage machine learning models and AI applications more efficiently.', footer: '来源文档:(真)拟定稿。GPT 的制度研究',
|
|
16
18
|
images: [
|
|
17
19
|
'https://gw.alicdn.com/imgextra/i1/O1CN01n7R7cy1MkE5OYeXV9_!!6000000001472-55-tps-24-24.svg',
|
|
@@ -3,6 +3,7 @@ import { Empty, IconButton, Tag } from '@agentscope-ai/design';
|
|
|
3
3
|
import { SparkBookLine, SparkDownLine, SparkUpLine, SparkWarningCircleFill } from '@agentscope-ai/icons';
|
|
4
4
|
import { ConfigProvider, Flex, Image } from 'antd';
|
|
5
5
|
import { Locale } from "antd/es/locale";
|
|
6
|
+
import React from 'react';
|
|
6
7
|
import { ReactNode, useState } from 'react';
|
|
7
8
|
|
|
8
9
|
export interface IRagProps {
|
|
@@ -18,23 +19,8 @@ export interface IRagProps {
|
|
|
18
19
|
* @default ''
|
|
19
20
|
*/
|
|
20
21
|
subTitle?: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* @descriptionEn Query
|
|
24
|
-
*/
|
|
25
|
-
query: string;
|
|
26
|
-
/**
|
|
27
|
-
* @description 检索词前缀
|
|
28
|
-
* @descriptionEn Query Title
|
|
29
|
-
* @default '检索 Query:'
|
|
30
|
-
*/
|
|
31
|
-
queryTitle?: string;
|
|
32
|
-
/**
|
|
33
|
-
* @description 检索图片列表
|
|
34
|
-
* @descriptionEn Query Images
|
|
35
|
-
* @default []
|
|
36
|
-
*/
|
|
37
|
-
images?: string[];
|
|
22
|
+
|
|
23
|
+
|
|
38
24
|
/**
|
|
39
25
|
* @description 召回知识列表
|
|
40
26
|
* @descriptionEn RAG List
|
|
@@ -60,6 +46,16 @@ export interface IRagProps {
|
|
|
60
46
|
* @default '暂无数据'
|
|
61
47
|
*/
|
|
62
48
|
placeholder?: string;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
query: string;
|
|
52
|
+
/**
|
|
53
|
+
* @description 检索图片列表
|
|
54
|
+
* @descriptionEn Query Images
|
|
55
|
+
* @default []
|
|
56
|
+
*/
|
|
57
|
+
images?: string[];
|
|
58
|
+
filters?: string;
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
function Images({ images }: { images: string[] }) {
|
|
@@ -94,7 +90,9 @@ function Item({ item }) {
|
|
|
94
90
|
</span>
|
|
95
91
|
<span style={{ flex: 1 }}></span>
|
|
96
92
|
{
|
|
97
|
-
item.score
|
|
93
|
+
item.score ? <Tag color="mauve" size="small" className={`${prefixCls}-rag-item-score`}>
|
|
94
|
+
得分 <b>{item.score}</b>
|
|
95
|
+
</Tag> : null
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
<IconButton
|
|
@@ -134,23 +132,49 @@ export default function (props: IRagProps) {
|
|
|
134
132
|
subTitle,
|
|
135
133
|
defaultOpen = true,
|
|
136
134
|
placeholder = '未查询到与提问相关知识库',
|
|
137
|
-
query,
|
|
138
|
-
queryTitle = '检索 Query:',
|
|
139
135
|
images,
|
|
136
|
+
query,
|
|
137
|
+
filters
|
|
140
138
|
} = props;
|
|
141
139
|
const { getPrefixCls } = useProviderContext();
|
|
142
140
|
const prefixCls = getPrefixCls('operate-card');
|
|
143
141
|
|
|
142
|
+
const children = <OperateCard.LineBody>
|
|
143
|
+
|
|
144
|
+
<div>
|
|
145
|
+
<div className={`${prefixCls}-rag-group-title`}>检索 Query</div>
|
|
146
|
+
<div className={`${prefixCls}-rag-group-content`}>{query}</div>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
{
|
|
150
|
+
images?.length ? <div>
|
|
151
|
+
<div className={`${prefixCls}-rag-group-title`}>检索图片</div>
|
|
152
|
+
<div className={`${prefixCls}-rag-group-content ${prefixCls}-rag-group-content-images`}>
|
|
153
|
+
<Images images={images} />
|
|
154
|
+
</div>
|
|
155
|
+
</div> : null
|
|
156
|
+
}
|
|
144
157
|
|
|
145
|
-
const children = props.list.length ? <OperateCard.LineBody>
|
|
146
158
|
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
filters ? <div>
|
|
160
|
+
<div className={`${prefixCls}-rag-group-title`}>过滤条件</div>
|
|
161
|
+
<div className={`${prefixCls}-rag-group-content`}>{filters}</div>
|
|
162
|
+
</div> : null
|
|
150
163
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
{props.list.length ? <div><div className={`${prefixCls}-rag-group-title`}>Output</div>
|
|
168
|
+
{
|
|
169
|
+
props.list.map((item, index) => {
|
|
170
|
+
return <Item key={index} item={item} />
|
|
171
|
+
})
|
|
172
|
+
}</div> : <>
|
|
173
|
+
<div className={`${prefixCls}-rag-group-title`}>Output</div>
|
|
174
|
+
<Flex align="center" justify="center" gap={8} className={`${prefixCls}-rag-empty-placeholder`}>
|
|
175
|
+
<SparkWarningCircleFill /><span>{placeholder}</span>
|
|
176
|
+
</Flex></>}
|
|
177
|
+
</OperateCard.LineBody>;
|
|
154
178
|
|
|
155
179
|
return <OperateCard
|
|
156
180
|
header={{
|
|
@@ -160,20 +184,9 @@ export default function (props: IRagProps) {
|
|
|
160
184
|
}}
|
|
161
185
|
body={{
|
|
162
186
|
defaultOpen,
|
|
163
|
-
children:
|
|
164
|
-
{
|
|
165
|
-
query ? <div className={`${prefixCls}-rag-query`}>
|
|
166
|
-
<span className={`${prefixCls}-rag-query-title`}>{queryTitle}</span>
|
|
167
|
-
{query}
|
|
168
|
-
</div> : null
|
|
169
|
-
}
|
|
170
|
-
{
|
|
171
|
-
images?.length ? <div className={`${prefixCls}-rag-query-images`}>
|
|
172
|
-
<Images images={images} />
|
|
173
|
-
</div> : null
|
|
174
|
-
}
|
|
187
|
+
children: <div className={`${prefixCls}-rag-children`}>
|
|
175
188
|
{children}
|
|
176
|
-
|
|
189
|
+
</div>
|
|
177
190
|
}}
|
|
178
191
|
/>
|
|
179
192
|
}
|
|
@@ -190,7 +190,6 @@ export default createGlobalStyle`
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
&-content {
|
|
193
|
-
|
|
194
193
|
width: 100%;
|
|
195
194
|
display: flex;
|
|
196
195
|
justify-content: space-between;
|
|
@@ -211,9 +210,6 @@ export default createGlobalStyle`
|
|
|
211
210
|
overflow: hidden;
|
|
212
211
|
border: 1px solid ${(p) => p.theme.colorBorderSecondary};
|
|
213
212
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
213
|
}
|
|
218
214
|
|
|
219
215
|
&-rag-empty-placeholder {
|
|
@@ -227,39 +223,67 @@ export default createGlobalStyle`
|
|
|
227
223
|
margin: 0 12px 12px 12px;
|
|
228
224
|
}
|
|
229
225
|
|
|
230
|
-
&-rag-
|
|
231
|
-
|
|
232
|
-
|
|
226
|
+
&-rag-children .${(p) => p.theme.prefixCls}-operate-card-line-body {
|
|
227
|
+
display: flex;
|
|
228
|
+
flex-direction: column;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&-rag-group-title {
|
|
232
|
+
margin: 16px 0 4px 16px;
|
|
233
233
|
font-size: 12px;
|
|
234
|
+
font-weight: 500;
|
|
234
235
|
color: ${(p) => p.theme.colorTextSecondary};
|
|
235
236
|
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
&:first-child {
|
|
238
|
+
margin-top: 8px;
|
|
238
239
|
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
&-rag-group-content {
|
|
244
|
+
margin-left: 16px;
|
|
245
|
+
border-radius: 6px;
|
|
246
|
+
font-size: 12px;
|
|
247
|
+
color: ${(p) => p.theme.colorTextSecondary};
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
cursor: pointer;
|
|
239
251
|
|
|
240
252
|
&-images {
|
|
241
|
-
margin: 0 12px 8px 12px;
|
|
242
|
-
display: flex;
|
|
243
253
|
gap: 8px;
|
|
244
254
|
}
|
|
245
255
|
}
|
|
246
256
|
|
|
257
|
+
|
|
247
258
|
&-rag-item {
|
|
248
259
|
margin-left: 16px;
|
|
260
|
+
border-radius: 6px;
|
|
261
|
+
overflow: hidden;
|
|
262
|
+
margin-bottom: 4px;
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
&-score {
|
|
266
|
+
margin-right: 0;
|
|
267
|
+
|
|
268
|
+
b {
|
|
269
|
+
font-weight: 500;
|
|
270
|
+
color: ${(p) => p.theme.colorPrimary};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
249
273
|
|
|
250
274
|
&-title {
|
|
251
275
|
font-size: 12px;
|
|
252
|
-
color: ${(p) => p.theme.
|
|
253
|
-
|
|
254
|
-
|
|
276
|
+
color: ${(p) => p.theme.colorTextSecondary};
|
|
277
|
+
height: 28px;
|
|
278
|
+
padding: 0 4px 0 12px;
|
|
255
279
|
display: flex;
|
|
256
280
|
align-items: center;
|
|
257
281
|
cursor: pointer;
|
|
282
|
+
background-color: ${(p) => p.theme.colorFillTertiary};
|
|
258
283
|
}
|
|
259
284
|
|
|
260
285
|
&-content {
|
|
261
|
-
padding:
|
|
262
|
-
border-radius: 6px;
|
|
286
|
+
padding: 0 12px 12px 12px;
|
|
263
287
|
background-color: ${(p) => p.theme.colorFillTertiary};
|
|
264
288
|
|
|
265
289
|
&-text {
|
|
@@ -102,7 +102,7 @@ export default function useChatRequest(options) {
|
|
|
102
102
|
}(), []);
|
|
103
103
|
var request = useCallback( /*#__PURE__*/function () {
|
|
104
104
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(historyMessages, biz_params) {
|
|
105
|
-
var currentApiOptions, _currentApiOptions$en, enableHistoryMessages, response, agentScopeRuntimeResponseBuilder, _iteratorAbruptCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, chunk, _currentQARef$current, _res$output, _currentQARef$current2, chunkData, res;
|
|
105
|
+
var currentApiOptions, _currentApiOptions$en, enableHistoryMessages, response, agentScopeRuntimeResponseBuilder, _iteratorAbruptCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, chunk, _currentQARef$current, _res$output, _currentQARef$current2, responseParser, chunkData, res;
|
|
106
106
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
107
107
|
while (1) switch (_context2.prev = _context2.next) {
|
|
108
108
|
case 0:
|
|
@@ -149,7 +149,7 @@ export default function useChatRequest(options) {
|
|
|
149
149
|
_context2.t1 = _context2["catch"](2);
|
|
150
150
|
case 17:
|
|
151
151
|
if (!(response && response.body)) {
|
|
152
|
-
_context2.next =
|
|
152
|
+
_context2.next = 66;
|
|
153
153
|
break;
|
|
154
154
|
}
|
|
155
155
|
agentScopeRuntimeResponseBuilder = new AgentScopeRuntimeResponseBuilder({
|
|
@@ -192,7 +192,7 @@ export default function useChatRequest(options) {
|
|
|
192
192
|
return _iterator2.next();
|
|
193
193
|
case 29:
|
|
194
194
|
if (!(_iteratorAbruptCompletion2 = !(_step2 = _context2.sent).done)) {
|
|
195
|
-
_context2.next =
|
|
195
|
+
_context2.next = 45;
|
|
196
196
|
break;
|
|
197
197
|
}
|
|
198
198
|
chunk = _step2.value;
|
|
@@ -206,16 +206,17 @@ export default function useChatRequest(options) {
|
|
|
206
206
|
data: agentScopeRuntimeResponseBuilder.cancel()
|
|
207
207
|
}];
|
|
208
208
|
updateMessage(currentQARef.current.response);
|
|
209
|
-
return _context2.abrupt("break",
|
|
209
|
+
return _context2.abrupt("break", 45);
|
|
210
210
|
case 36:
|
|
211
|
-
|
|
211
|
+
responseParser = apiOptionsRef.current.responseParser || JSON.parse;
|
|
212
|
+
chunkData = responseParser(chunk.data);
|
|
212
213
|
res = agentScopeRuntimeResponseBuilder.handle(chunkData); // 跳过空内容
|
|
213
214
|
if (!(res.status !== AgentScopeRuntimeRunStatus.Failed && !((_res$output = res.output) !== null && _res$output !== void 0 && (_res$output = _res$output[0]) !== null && _res$output !== void 0 && (_res$output = _res$output.content) !== null && _res$output !== void 0 && _res$output.length))) {
|
|
214
|
-
_context2.next =
|
|
215
|
+
_context2.next = 41;
|
|
215
216
|
break;
|
|
216
217
|
}
|
|
217
|
-
return _context2.abrupt("continue",
|
|
218
|
-
case
|
|
218
|
+
return _context2.abrupt("continue", 42);
|
|
219
|
+
case 41:
|
|
219
220
|
if (currentQARef.current.response) {
|
|
220
221
|
currentQARef.current.response.cards = [{
|
|
221
222
|
code: 'AgentScopeRuntimeResponseCard',
|
|
@@ -227,50 +228,50 @@ export default function useChatRequest(options) {
|
|
|
227
228
|
updateMessage(currentQARef.current.response);
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
|
-
case
|
|
231
|
+
case 42:
|
|
231
232
|
_iteratorAbruptCompletion2 = false;
|
|
232
233
|
_context2.next = 27;
|
|
233
234
|
break;
|
|
234
|
-
case
|
|
235
|
-
_context2.next =
|
|
235
|
+
case 45:
|
|
236
|
+
_context2.next = 51;
|
|
236
237
|
break;
|
|
237
|
-
case
|
|
238
|
-
_context2.prev =
|
|
238
|
+
case 47:
|
|
239
|
+
_context2.prev = 47;
|
|
239
240
|
_context2.t2 = _context2["catch"](25);
|
|
240
241
|
_didIteratorError2 = true;
|
|
241
242
|
_iteratorError2 = _context2.t2;
|
|
242
|
-
case
|
|
243
|
-
_context2.prev = 50;
|
|
243
|
+
case 51:
|
|
244
244
|
_context2.prev = 51;
|
|
245
|
+
_context2.prev = 52;
|
|
245
246
|
if (!(_iteratorAbruptCompletion2 && _iterator2.return != null)) {
|
|
246
|
-
_context2.next =
|
|
247
|
+
_context2.next = 56;
|
|
247
248
|
break;
|
|
248
249
|
}
|
|
249
|
-
_context2.next =
|
|
250
|
+
_context2.next = 56;
|
|
250
251
|
return _iterator2.return();
|
|
251
|
-
case
|
|
252
|
-
_context2.prev =
|
|
252
|
+
case 56:
|
|
253
|
+
_context2.prev = 56;
|
|
253
254
|
if (!_didIteratorError2) {
|
|
254
|
-
_context2.next =
|
|
255
|
+
_context2.next = 59;
|
|
255
256
|
break;
|
|
256
257
|
}
|
|
257
258
|
throw _iteratorError2;
|
|
258
|
-
case 58:
|
|
259
|
-
return _context2.finish(55);
|
|
260
259
|
case 59:
|
|
261
|
-
return _context2.finish(
|
|
260
|
+
return _context2.finish(56);
|
|
262
261
|
case 60:
|
|
263
|
-
_context2.
|
|
262
|
+
return _context2.finish(51);
|
|
263
|
+
case 61:
|
|
264
|
+
_context2.next = 66;
|
|
264
265
|
break;
|
|
265
|
-
case
|
|
266
|
-
_context2.prev =
|
|
266
|
+
case 63:
|
|
267
|
+
_context2.prev = 63;
|
|
267
268
|
_context2.t3 = _context2["catch"](22);
|
|
268
269
|
console.error(_context2.t3);
|
|
269
|
-
case
|
|
270
|
+
case 66:
|
|
270
271
|
case "end":
|
|
271
272
|
return _context2.stop();
|
|
272
273
|
}
|
|
273
|
-
}, _callee2, null, [[2, 15], [22,
|
|
274
|
+
}, _callee2, null, [[2, 15], [22, 63], [25, 47, 51, 61], [52,, 56, 60]]);
|
|
274
275
|
}));
|
|
275
276
|
return function (_x2, _x3) {
|
|
276
277
|
return _ref2.apply(this, arguments);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { UploadProps } from 'antd';
|
|
3
|
-
import { IAgentScopeRuntimeResponse } from '../AgentScopeRuntime/types';
|
|
3
|
+
import { IAgentScopeRuntimeMessage, IAgentScopeRuntimeResponse, IContent } from '../AgentScopeRuntime/types';
|
|
4
4
|
import { IAgentScopeRuntimeWebUISession } from './ISessions';
|
|
5
5
|
/**
|
|
6
6
|
* @description API 配置选项
|
|
@@ -28,6 +28,7 @@ export interface IAgentScopeRuntimeWebUIAPIOptions {
|
|
|
28
28
|
biz_params?: IAgentScopeRuntimeWebUIInputData['biz_params'];
|
|
29
29
|
}) => Promise<Response>;
|
|
30
30
|
enableHistoryMessages?: boolean;
|
|
31
|
+
responseParser?: (response: Response) => IAgentScopeRuntimeResponse | IAgentScopeRuntimeMessage | IContent;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* @description 主题配置选项
|
|
@@ -3,10 +3,15 @@ import { Image, ConfigProvider } from 'antd';
|
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export default function (props) {
|
|
5
5
|
var prefixCls = useProviderContext().getPrefixCls('assets-preview-image');
|
|
6
|
+
var _props$width = props.width,
|
|
7
|
+
width = _props$width === void 0 ? 1 : _props$width,
|
|
8
|
+
_props$height = props.height,
|
|
9
|
+
height = _props$height === void 0 ? 1 : _props$height,
|
|
10
|
+
src = props.src;
|
|
6
11
|
return /*#__PURE__*/_jsx("div", {
|
|
7
12
|
className: prefixCls,
|
|
8
13
|
style: {
|
|
9
|
-
aspectRatio: "".concat(
|
|
14
|
+
aspectRatio: "".concat(width, "/").concat(height)
|
|
10
15
|
},
|
|
11
16
|
children: /*#__PURE__*/_jsx(ConfigProvider, {
|
|
12
17
|
locale: {
|
|
@@ -15,7 +20,7 @@ export default function (props) {
|
|
|
15
20
|
}
|
|
16
21
|
},
|
|
17
22
|
children: /*#__PURE__*/_jsx(Image, {
|
|
18
|
-
src:
|
|
23
|
+
src: src,
|
|
19
24
|
width: "100%",
|
|
20
25
|
height: "100%"
|
|
21
26
|
})
|
|
@@ -22,8 +22,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
22
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
export default function Video(props) {
|
|
24
24
|
var prefixCls = useProviderContext().getPrefixCls('assets-preview-video');
|
|
25
|
-
var width = props.width,
|
|
26
|
-
|
|
25
|
+
var _props$width = props.width,
|
|
26
|
+
width = _props$width === void 0 ? 1 : _props$width,
|
|
27
|
+
_props$height = props.height,
|
|
28
|
+
height = _props$height === void 0 ? 1 : _props$height,
|
|
27
29
|
poster = props.poster,
|
|
28
30
|
src = props.src,
|
|
29
31
|
rest = _objectWithoutProperties(props, _excluded);
|
|
@@ -19,11 +19,13 @@ import Audio from "./Audio";
|
|
|
19
19
|
import { useCallback, useDeferredValue, useEffect, useRef, useState } from 'react';
|
|
20
20
|
import { SparkLeftLine, SparkRightLine } from '@agentscope-ai/icons';
|
|
21
21
|
import { IconButton } from '@agentscope-ai/design';
|
|
22
|
+
import { useUpdate, useSize } from 'ahooks';
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
26
|
function AssetsPreview(props) {
|
|
26
27
|
var _props$classNames;
|
|
28
|
+
var update = useUpdate();
|
|
27
29
|
var prefixCls = useProviderContext().getPrefixCls('assets-preview');
|
|
28
30
|
var ref = useRef(null);
|
|
29
31
|
var _props$height = props.height,
|
|
@@ -38,6 +40,7 @@ function AssetsPreview(props) {
|
|
|
38
40
|
scrollLeft = _useState4[0],
|
|
39
41
|
setScrollLeft = _useState4[1];
|
|
40
42
|
var deferScrollLeft = useDeferredValue(scrollLeft);
|
|
43
|
+
var size = useSize(ref);
|
|
41
44
|
var onScroll = useCallback(function (e) {
|
|
42
45
|
setScrollLeft(e.target.scrollLeft);
|
|
43
46
|
}, []);
|
|
@@ -48,7 +51,8 @@ function AssetsPreview(props) {
|
|
|
48
51
|
if (ref.current && props.type !== 'audio') {
|
|
49
52
|
maxWidth.current = ref.current.scrollWidth - ref.current.clientWidth;
|
|
50
53
|
}
|
|
51
|
-
|
|
54
|
+
update();
|
|
55
|
+
}, [props.data.length, size === null || size === void 0 ? void 0 : size.width]);
|
|
52
56
|
var toArrow = useCallback(function (direct) {
|
|
53
57
|
var width = 200;
|
|
54
58
|
ref.current.scrollLeft = ref.current.scrollLeft + width * (direct === 'left' ? -1 : 1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createGlobalStyle } from 'antd-style';
|
|
4
|
-
export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-assets-preview {\n position: relative;\n\n &-left-edge,\n &-right-edge {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 128px;\n pointer-events: none;\n }\n\n &-left-edge {\n left: 0;\n background: linear-gradient(to right, ", ", rgba(0, 0, 0, 0));\n }\n\n &-right-edge {\n right: 0;\n background: linear-gradient(to left, ", ", rgba(0, 0, 0, 0));\n }\n\n &-arrow {\n position: absolute;\n bottom: 0;\n }\n\n &-left-arrow {\n left: 10px;\n }\n\n &-right-arrow {\n right: 10px;\n }\n\n &-container {\n display: flex;\n padding: 8px;\n gap: 8px;\n overflow-x: auto;\n justify-content: safe center;\n background-color: ", ";\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE/Edge */\n &::-webkit-scrollbar {\n display: none; /* Chrome/Safari/Opera */\n }\n }\n\n\n &-image {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n\n .anticon-eye {\n font-size: 20px;\n margin: 0 !important;\n }\n }\n\n &-video {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n\n &-enlarge {\n display: none;\n position: absolute;\n top: 6px;\n right: 6px;\n z-index: 1;\n border-radius: 4px;\n background-color: ", ";\n\n button {\n display: flex;\n }\n }\n\n video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n\n &:hover {\n .", "-assets-preview-video-enlarge {\n display: block;\n }\n }\n\n &-playing {\n opacity: 0;\n &:hover {\n opacity: 1;\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-paused {\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-play-btn {\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n transition: transform 0.2s ease;\n font-size: 40px;\n \n\n &:hover {\n transform: scale(1.1);\n }\n }\n\n &-duration {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n bottom: 8px;\n left: 0px;\n height: 28px;\n bottom: 0;\n right: 0;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n\n &-overlay {\n &:hover {\n ~ .", "-assets-preview-video-duration {\n background: transparent;\n }\n }\n }\n\n &-playing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n }\n \n &-audio {\n display: flex;\n align-items: center;\n gap: 8px;\n background-color: ", ";\n border-radius: 8px;\n border: 1px solid ", ";\n height: 40px;\n padding: 0 8px;\n\n &-time {\n font-size: 12px;\n color: ", ";\n line-height: 1;\n }\n\n &-progress {\n flex: 1;\n height: 8px;\n background-color: ", ";\n border-radius: 4px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n\n &-bar {\n height: 100%;\n background-color: ", ";\n border-radius: 4px;\n transition: width 0.1s linear;\n }\n }\n }\n}\n"])), function (p) {
|
|
4
|
+
export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-assets-preview {\n position: relative;\n\n &-left-edge,\n &-right-edge {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 128px;\n pointer-events: none;\n }\n\n &-left-edge {\n left: 0;\n background: linear-gradient(to right, ", ", rgba(0, 0, 0, 0));\n }\n\n &-right-edge {\n right: 0;\n background: linear-gradient(to left, ", ", rgba(0, 0, 0, 0));\n }\n\n &-arrow {\n position: absolute;\n bottom: 0;\n }\n\n &-left-arrow {\n left: 10px;\n }\n\n &-right-arrow {\n right: 10px;\n }\n\n &-container {\n display: flex;\n padding: 8px;\n gap: 8px;\n overflow-x: auto;\n justify-content: safe center;\n background-color: ", ";\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE/Edge */\n &::-webkit-scrollbar {\n display: none; /* Chrome/Safari/Opera */\n }\n }\n\n\n &-image {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n\n .anticon-eye {\n font-size: 20px;\n margin: 0 !important;\n }\n }\n\n &-video {\n height: 100%;\n flex-basis: auto;\n flex-shrink: 0;\n border-radius: 8px;\n overflow: hidden;\n position: relative;\n cursor: pointer;\n\n &-enlarge {\n display: none;\n position: absolute;\n top: 6px;\n right: 6px;\n z-index: 1;\n border-radius: 4px;\n background-color: ", ";\n\n button {\n display: flex;\n }\n }\n\n video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n\n &:fullscreen {\n object-fit: contain;\n }\n\n &:-webkit-full-screen {\n object-fit: contain;\n }\n\n &:-moz-full-screen {\n object-fit: contain;\n }\n }\n\n &-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-radius: 8px;\n\n &:hover {\n .", "-assets-preview-video-enlarge {\n display: block;\n }\n }\n\n &-playing {\n opacity: 0;\n &:hover {\n opacity: 1;\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-paused {\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n }\n\n &-play-btn {\n width: 40px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n transition: transform 0.2s ease;\n font-size: 40px;\n \n\n &:hover {\n transform: scale(1.1);\n }\n }\n\n &-duration {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n bottom: 8px;\n left: 0px;\n height: 28px;\n bottom: 0;\n right: 0;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);\n background: linear-gradient(180deg, rgba(111, 111, 111, 0.27) 0%, rgba(38, 36, 76, 0.83) 100%);\n }\n\n &-overlay {\n &:hover {\n ~ .", "-assets-preview-video-duration {\n background: transparent;\n }\n }\n }\n\n &-playing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n }\n \n &-audio {\n display: flex;\n align-items: center;\n gap: 8px;\n background-color: ", ";\n border-radius: 8px;\n border: 1px solid ", ";\n height: 40px;\n padding: 0 8px;\n\n &-time {\n font-size: 12px;\n color: ", ";\n line-height: 1;\n }\n\n &-progress {\n flex: 1;\n height: 8px;\n background-color: ", ";\n border-radius: 4px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n\n &-bar {\n height: 100%;\n background-color: ", ";\n border-radius: 4px;\n transition: width 0.1s linear;\n }\n }\n }\n}\n"])), function (p) {
|
|
5
5
|
return p.theme.prefixCls;
|
|
6
6
|
}, function (p) {
|
|
7
7
|
return p.theme.colorBgLayout;
|
package/lib/Markdown/Markdown.js
CHANGED
|
@@ -59,7 +59,7 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
59
59
|
var _props$raw = props.raw,
|
|
60
60
|
raw = _props$raw === void 0 ? false : _props$raw,
|
|
61
61
|
_props$allowHtml = props.allowHtml,
|
|
62
|
-
allowHtml = _props$allowHtml === void 0 ?
|
|
62
|
+
allowHtml = _props$allowHtml === void 0 ? false : _props$allowHtml;
|
|
63
63
|
var _useCitationsData = useCitationsData({
|
|
64
64
|
citations: props.citations,
|
|
65
65
|
citationsMap: props.citationsMap
|
|
@@ -79,10 +79,10 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
79
79
|
}, props.components);
|
|
80
80
|
}, [props.disableImage, CitationComponent, props.components]);
|
|
81
81
|
var dompurifyConfig = useMemo(function () {
|
|
82
|
-
return
|
|
82
|
+
return {
|
|
83
83
|
ADD_TAGS: ['custom-cursor', 'citation']
|
|
84
|
-
}
|
|
85
|
-
}, [
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
86
|
|
|
87
87
|
// 使用 useMemo 缓存 extensions 配置
|
|
88
88
|
var _useMemo = useMemo(function () {
|
|
@@ -103,11 +103,18 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
103
103
|
|
|
104
104
|
// // 使用 useMemo 缓存 config 对象
|
|
105
105
|
var config = useMemo(function () {
|
|
106
|
-
return {
|
|
106
|
+
return _objectSpread({
|
|
107
107
|
extensions: extensions,
|
|
108
108
|
walkTokens: walkTokens
|
|
109
|
-
}
|
|
110
|
-
|
|
109
|
+
}, !allowHtml && {
|
|
110
|
+
renderer: {
|
|
111
|
+
html: function html(token) {
|
|
112
|
+
var text = token.text || token.raw || '';
|
|
113
|
+
return text.replace(/</g, '<').replace(/>/g, '>');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}, [extensions, allowHtml]);
|
|
111
118
|
var fallback = /*#__PURE__*/_jsx(Raw, {
|
|
112
119
|
content: content || '',
|
|
113
120
|
baseFontSize: baseFontSize,
|
|
@@ -115,7 +122,13 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
115
122
|
});
|
|
116
123
|
if (raw || !isSupportsLookbehindAssertions) return fallback;
|
|
117
124
|
return /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
118
|
-
|
|
125
|
+
fallbackRender: function fallbackRender() {
|
|
126
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
127
|
+
args[_key] = arguments[_key];
|
|
128
|
+
}
|
|
129
|
+
console.error(args);
|
|
130
|
+
return fallback;
|
|
131
|
+
},
|
|
119
132
|
children: /*#__PURE__*/_jsx(MarkdownX, {
|
|
120
133
|
dompurifyConfig: dompurifyConfig,
|
|
121
134
|
cursor: props.cursor,
|
package/lib/Markdown/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createGlobalStyle } from 'antd-style';
|
|
4
|
-
export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-markdown {\n color: inherit;\n max-width: 100%;\n\n blockquote {\n padding-inline: 0.6em 0;\n padding-block: 0;\n margin: 1em 0;\n border-inline-start: 4px solid ", ";\n opacity: 0.85;\n }\n\n figure {\n margin: 0;\n }\n\n code {\n font-size: 0.8571428571428571em;\n border: 0;\n margin: 0;\n background-color: ", ";\n color: ", ";\n border-radius: ", "px;\n padding: 2px 6px;\n margin-inline: 3px;\n border: 1px solid ", ";\n }\n\n pre code {\n font-size: 0.8571428571428571em;\n background-color: transparent;\n border: none;\n }\n\n .", "-mermaid,\n .", "-codeHighlighter {\n border: 1px solid ", ";\n border-radius: ", "px;\n \n }\n\n .", "-mermaid-graph,\n .", "-codeHighlighter-code {\n border: none;\n }\n\n\n .", "-code-header {\n display: flex;\n justify-content: space-between;\n background: ", ";\n border-bottom: 1px solid ", ";\n height: 28px;\n line-height: 28px;\n align-items: center;\n user-select: none;\n position: relative;\n padding: 0 12px;\n\n &-lang {\n font-weight: bold;\n }\n\n &-icon {\n font-size: 16px;\n cursor: pointer;\n }\n\n &-copied {\n color: ", ";\n cursor: pointer;\n font-size: 16px;\n }\n }\n\n\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0.5714285714285714em;\n margin-bottom: 0.5714285714285714em;\n font-weight: 500;\n line-height: 1.7777;\n color: inherit;\n }\n\n p {\n margin-bottom: 0.5714285714285714em;\n }\n\n h1 {\n font-size: 1.2857142857142858em;\n }\n\n h2 {\n font-size: 1.1428571428571428em;\n }\n\n h3 {\n font-size: 1em;\n }\n\n h4 {\n font-size: 1em;\n }\n\n h5 {\n font-size: 1em;\n }\n\n h6 {\n font-size: 1em;\n }\n\n hr {\n border-color: ", ";\n border-style: solid;\n border-width: 1px 0 0 0;\n margin: 1em 0;\n }\n\n table {\n border-collapse: collapse;\n display: block;\n width: max-content;\n max-width: 100%;\n overflow: auto;\n }\n\n table th {\n background: ", ";\n text-align: left;\n }\n\n table td,\n table th {\n padding: 0.75em 1.5em;\n border: 1px solid ", ";\n white-space: pre;\n }\n\n .", "-image {\n max-width: 480px;\n overflow: hidden;\n }\n\n .", "-markdown-video {\n position: relative;\n \n &-poster {\n display: flex;\n align-items: center;\n justify-content: center;\n max-width: 480px;\n background-color: #000;\n border-radius: 8px;\n padding: 100px 0;\n cursor: pointer;\n }\n\n &-play {\n color: #ccc;\n font-size: 30px;\n }\n }\n}\n\n.", "-markdown.x-markdown {\n img {\n margin: 0;\n }\n}\n\n\n.", "-markdown > *:last-child {\n margin-bottom: 0 !important;\n}\n\n.", "-markdown > *:first-child {\n margin-top: 0 !important;\n}\n\n.", "-markdown-footnotes {\n > h2 {\n display: none;\n }\n\n > ol {\n margin: 0 0 0 1em;\n }\n\n [data-footnote-backref] {\n display: none;\n }\n\n}\n\n\n.", "-markdown-footnote {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 16px;\n padding: 0 4px;\n height: 16px;\n margin-inline: 2px;\n font-size: 10px;\n color: ", ";\n text-align: center;\n background: ", ";\n border-radius: 4px;\n transition: all 100ms ", ";\n cursor: pointer;\n line-height: 1;\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n}\n"])), function (p) {
|
|
4
|
+
export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-markdown {\n color: inherit;\n max-width: 100%;\n\n blockquote {\n padding-inline: 0.6em 0;\n padding-block: 0;\n margin: 1em 0;\n border-inline-start: 4px solid ", ";\n opacity: 0.85;\n }\n\n figure {\n margin: 0;\n }\n\n code {\n font-size: 0.8571428571428571em;\n border: 0;\n margin: 0;\n background-color: ", ";\n color: ", ";\n border-radius: ", "px;\n padding: 2px 6px;\n margin-inline: 3px;\n border: 1px solid ", ";\n }\n\n pre code {\n font-size: 0.8571428571428571em;\n background-color: transparent;\n border: none;\n }\n\n .", "-mermaid,\n .", "-codeHighlighter {\n border: 1px solid ", ";\n border-radius: ", "px;\n \n }\n\n .", "-mermaid-graph,\n .", "-codeHighlighter-code {\n border: none;\n background-color: ", ";\n\n * {\n background-color: transparent !important;\n }\n }\n\n\n .", "-code-header {\n display: flex;\n justify-content: space-between;\n background: ", ";\n border-bottom: 1px solid ", ";\n height: 28px;\n line-height: 28px;\n align-items: center;\n user-select: none;\n position: relative;\n padding: 0 12px;\n\n &-lang {\n font-weight: bold;\n }\n\n &-icon {\n font-size: 16px;\n cursor: pointer;\n }\n\n &-copied {\n color: ", ";\n cursor: pointer;\n font-size: 16px;\n }\n }\n\n\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-top: 0.5714285714285714em;\n margin-bottom: 0.5714285714285714em;\n font-weight: 500;\n line-height: 1.7777;\n color: inherit;\n }\n\n p {\n margin-bottom: 0.5714285714285714em;\n }\n\n h1 {\n font-size: 1.2857142857142858em;\n }\n\n h2 {\n font-size: 1.1428571428571428em;\n }\n\n h3 {\n font-size: 1em;\n }\n\n h4 {\n font-size: 1em;\n }\n\n h5 {\n font-size: 1em;\n }\n\n h6 {\n font-size: 1em;\n }\n\n hr {\n border-color: ", ";\n border-style: solid;\n border-width: 1px 0 0 0;\n margin: 1em 0;\n }\n\n table {\n border-collapse: collapse;\n display: block;\n width: max-content;\n max-width: 100%;\n overflow: auto;\n }\n\n table th {\n background: ", ";\n text-align: left;\n }\n\n table td,\n table th {\n padding: 0.75em 1.5em;\n border: 1px solid ", ";\n white-space: pre;\n }\n\n .", "-image {\n max-width: 480px;\n overflow: hidden;\n }\n\n .", "-markdown-video {\n position: relative;\n \n &-poster {\n display: flex;\n align-items: center;\n justify-content: center;\n max-width: 480px;\n background-color: #000;\n border-radius: 8px;\n padding: 100px 0;\n cursor: pointer;\n }\n\n &-play {\n color: #ccc;\n font-size: 30px;\n }\n }\n}\n\n.", "-markdown.x-markdown {\n img {\n margin: 0;\n }\n}\n\n\n.", "-markdown > *:last-child {\n margin-bottom: 0 !important;\n}\n\n.", "-markdown > *:first-child {\n margin-top: 0 !important;\n}\n\n.", "-markdown-footnotes {\n > h2 {\n display: none;\n }\n\n > ol {\n margin: 0 0 0 1em;\n }\n\n [data-footnote-backref] {\n display: none;\n }\n\n}\n\n\n.", "-markdown-footnote {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 16px;\n padding: 0 4px;\n height: 16px;\n margin-inline: 2px;\n font-size: 10px;\n color: ", ";\n text-align: center;\n background: ", ";\n border-radius: 4px;\n transition: all 100ms ", ";\n cursor: pointer;\n line-height: 1;\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n}\n"])), function (p) {
|
|
5
5
|
return p.theme.prefixCls;
|
|
6
6
|
}, function (p) {
|
|
7
7
|
return p.theme.colorBorder;
|
|
@@ -25,6 +25,8 @@ export default createGlobalStyle(_templateObject || (_templateObject = _taggedTe
|
|
|
25
25
|
return p.theme.prefixCls;
|
|
26
26
|
}, function (p) {
|
|
27
27
|
return p.theme.prefixCls;
|
|
28
|
+
}, function (p) {
|
|
29
|
+
return p.theme.colorBgBase;
|
|
28
30
|
}, function (p) {
|
|
29
31
|
return p.theme.prefixCls;
|
|
30
32
|
}, function (p) {
|
|
@@ -12,23 +12,6 @@ export interface IRagProps {
|
|
|
12
12
|
* @default ''
|
|
13
13
|
*/
|
|
14
14
|
subTitle?: string;
|
|
15
|
-
/**
|
|
16
|
-
* @description 检索词
|
|
17
|
-
* @descriptionEn Query
|
|
18
|
-
*/
|
|
19
|
-
query: string;
|
|
20
|
-
/**
|
|
21
|
-
* @description 检索词前缀
|
|
22
|
-
* @descriptionEn Query Title
|
|
23
|
-
* @default '检索 Query:'
|
|
24
|
-
*/
|
|
25
|
-
queryTitle?: string;
|
|
26
|
-
/**
|
|
27
|
-
* @description 检索图片列表
|
|
28
|
-
* @descriptionEn Query Images
|
|
29
|
-
* @default []
|
|
30
|
-
*/
|
|
31
|
-
images?: string[];
|
|
32
15
|
/**
|
|
33
16
|
* @description 召回知识列表
|
|
34
17
|
* @descriptionEn RAG List
|
|
@@ -54,5 +37,13 @@ export interface IRagProps {
|
|
|
54
37
|
* @default '暂无数据'
|
|
55
38
|
*/
|
|
56
39
|
placeholder?: string;
|
|
40
|
+
query: string;
|
|
41
|
+
/**
|
|
42
|
+
* @description 检索图片列表
|
|
43
|
+
* @descriptionEn Query Images
|
|
44
|
+
* @default []
|
|
45
|
+
*/
|
|
46
|
+
images?: string[];
|
|
47
|
+
filters?: string;
|
|
57
48
|
}
|
|
58
49
|
export default function (props: IRagProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,9 +5,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { OperateCard, useProviderContext } from "../..";
|
|
8
|
-
import { IconButton } from '@agentscope-ai/design';
|
|
8
|
+
import { IconButton, Tag } from '@agentscope-ai/design';
|
|
9
9
|
import { SparkBookLine, SparkDownLine, SparkUpLine, SparkWarningCircleFill } from '@agentscope-ai/icons';
|
|
10
10
|
import { ConfigProvider, Flex, Image } from 'antd';
|
|
11
|
+
import React from 'react';
|
|
11
12
|
import { useState } from 'react';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -56,7 +57,14 @@ function Item(_ref2) {
|
|
|
56
57
|
style: {
|
|
57
58
|
flex: 1
|
|
58
59
|
}
|
|
59
|
-
}), item.score
|
|
60
|
+
}), item.score ? /*#__PURE__*/_jsxs(Tag, {
|
|
61
|
+
color: "mauve",
|
|
62
|
+
size: "small",
|
|
63
|
+
className: "".concat(prefixCls, "-rag-item-score"),
|
|
64
|
+
children: ["\u5F97\u5206 ", /*#__PURE__*/_jsx("b", {
|
|
65
|
+
children: item.score
|
|
66
|
+
})]
|
|
67
|
+
}) : null, /*#__PURE__*/_jsx(IconButton, {
|
|
60
68
|
bordered: false,
|
|
61
69
|
size: "small",
|
|
62
70
|
icon: open ? /*#__PURE__*/_jsx(SparkUpLine, {}) : /*#__PURE__*/_jsx(SparkDownLine, {})
|
|
@@ -94,26 +102,61 @@ export default function (props) {
|
|
|
94
102
|
defaultOpen = _props$defaultOpen === void 0 ? true : _props$defaultOpen,
|
|
95
103
|
_props$placeholder = props.placeholder,
|
|
96
104
|
placeholder = _props$placeholder === void 0 ? '未查询到与提问相关知识库' : _props$placeholder,
|
|
105
|
+
images = props.images,
|
|
97
106
|
query = props.query,
|
|
98
|
-
|
|
99
|
-
queryTitle = _props$queryTitle === void 0 ? '检索 Query:' : _props$queryTitle,
|
|
100
|
-
images = props.images;
|
|
107
|
+
filters = props.filters;
|
|
101
108
|
var _useProviderContext3 = useProviderContext(),
|
|
102
109
|
getPrefixCls = _useProviderContext3.getPrefixCls;
|
|
103
110
|
var prefixCls = getPrefixCls('operate-card');
|
|
104
|
-
var children =
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
var children = /*#__PURE__*/_jsxs(OperateCard.LineBody, {
|
|
112
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
113
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
114
|
+
className: "".concat(prefixCls, "-rag-group-title"),
|
|
115
|
+
children: "\u68C0\u7D22 Query"
|
|
116
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
117
|
+
className: "".concat(prefixCls, "-rag-group-content"),
|
|
118
|
+
children: query
|
|
119
|
+
})]
|
|
120
|
+
}), images !== null && images !== void 0 && images.length ? /*#__PURE__*/_jsxs("div", {
|
|
121
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
122
|
+
className: "".concat(prefixCls, "-rag-group-title"),
|
|
123
|
+
children: "\u68C0\u7D22\u56FE\u7247"
|
|
124
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
125
|
+
className: "".concat(prefixCls, "-rag-group-content ").concat(prefixCls, "-rag-group-content-images"),
|
|
126
|
+
children: /*#__PURE__*/_jsx(Images, {
|
|
127
|
+
images: images
|
|
128
|
+
})
|
|
129
|
+
})]
|
|
130
|
+
}) : null, filters ? /*#__PURE__*/_jsxs("div", {
|
|
131
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
132
|
+
className: "".concat(prefixCls, "-rag-group-title"),
|
|
133
|
+
children: "\u8FC7\u6EE4\u6761\u4EF6"
|
|
134
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
135
|
+
className: "".concat(prefixCls, "-rag-group-content"),
|
|
136
|
+
children: filters
|
|
137
|
+
})]
|
|
138
|
+
}) : null, props.list.length ? /*#__PURE__*/_jsxs("div", {
|
|
139
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
140
|
+
className: "".concat(prefixCls, "-rag-group-title"),
|
|
141
|
+
children: "Output"
|
|
142
|
+
}), props.list.map(function (item, index) {
|
|
143
|
+
return /*#__PURE__*/_jsx(Item, {
|
|
144
|
+
item: item
|
|
145
|
+
}, index);
|
|
146
|
+
})]
|
|
147
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
148
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
149
|
+
className: "".concat(prefixCls, "-rag-group-title"),
|
|
150
|
+
children: "Output"
|
|
151
|
+
}), /*#__PURE__*/_jsxs(Flex, {
|
|
152
|
+
align: "center",
|
|
153
|
+
justify: "center",
|
|
154
|
+
gap: 8,
|
|
155
|
+
className: "".concat(prefixCls, "-rag-empty-placeholder"),
|
|
156
|
+
children: [/*#__PURE__*/_jsx(SparkWarningCircleFill, {}), /*#__PURE__*/_jsx("span", {
|
|
157
|
+
children: placeholder
|
|
158
|
+
})]
|
|
159
|
+
})]
|
|
117
160
|
})]
|
|
118
161
|
});
|
|
119
162
|
return /*#__PURE__*/_jsx(OperateCard, {
|
|
@@ -124,19 +167,9 @@ export default function (props) {
|
|
|
124
167
|
},
|
|
125
168
|
body: {
|
|
126
169
|
defaultOpen: defaultOpen,
|
|
127
|
-
children: /*#__PURE__*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
131
|
-
className: "".concat(prefixCls, "-rag-query-title"),
|
|
132
|
-
children: queryTitle
|
|
133
|
-
}), query]
|
|
134
|
-
}) : null, images !== null && images !== void 0 && images.length ? /*#__PURE__*/_jsx("div", {
|
|
135
|
-
className: "".concat(prefixCls, "-rag-query-images"),
|
|
136
|
-
children: /*#__PURE__*/_jsx(Images, {
|
|
137
|
-
images: images
|
|
138
|
-
})
|
|
139
|
-
}) : null, children]
|
|
170
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
171
|
+
className: "".concat(prefixCls, "-rag-children"),
|
|
172
|
+
children: children
|
|
140
173
|
})
|
|
141
174
|
}
|
|
142
175
|
});
|
package/lib/OperateCard/style.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createGlobalStyle } from 'antd-style';
|
|
4
|
-
export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-operate-card {\n width: 100%;\n border-radius: ", "px;\n overflow: hidden;\n background-color: ", ";\n\n &-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 0 12px;\n height: 32px;\n\n &-icon {\n font-size: 16px;\n }\n\n &-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 13px;\n font-weight: 500;\n color: ", ";\n }\n\n &-description {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 12px;\n color: ", ";\n }\n\n &-arrow {\n margin: 0 0 0 auto;\n }\n\n &-has-body {\n cursor: pointer;\n }\n }\n\n &-body {\n opacity: 0;\n animation: ", "-operate-card-body-open 0.2s ease-in-out forwards;\n \n @keyframes ", "-operate-card-body-open {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n \n }\n\n\n &-line-body {\n margin: 0 12px 12px 20px;\n border-left: 1px solid ", ";\n }\n\n &-thinking {\n padding-left: 16px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n opacity: 0.85;\n white-space: pre-wrap;\n }\n\n\n &-todo-list {\n\n &-item {\n height: 32px;\n display: flex;\n align-items: center;\n padding: 0 12px;\n gap: 8px;\n \n color: ", ";\n\n\n &-done {\n color: ", ";\n }\n\n &-icon {\n font-size: 16px;\n }\n\n &-title {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-size: 12px;\n }\n\n &-done {\n \n }\n\n }\n \n }\n\n\n &-web-search-item {\n display: flex;\n height: 32px;\n align-items: center;\n padding: 0 12px;\n gap: 8px;\n color: ", ";\n cursor: pointer;\n\n &-icon {\n display: block;\n width: 16px;\n height: 16px;\n border: 1px solid ", ";\n border-radius: 99px;\n }\n\n &-title {\n font-size: 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n\n &:hover {\n color: ", ";\n \n }\n\n }\n\n &-subTitle {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-left: 1px solid ", ";\n font-size: 12px;\n line-height: 1;\n color: ", ";\n padding-left: 8px;\n margin-left: 4px;\n }\n\n }\n\n\n &-tool-call-block {\n margin-left: 16px;\n margin-top: 8px;\n\n \n &-title {\n font-size: 12px;\n color: ", ";\n line-height: 20px;\n margin-bottom: 4px;\n }\n\n }\n\n\n\n &-device-action {\n height: auto;\n align-items: flex-start;\n\n &-icon {\n margin-top: 6px;\n }\n\n &-time {\n margin-bottom: 4px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n }\n\n &-content {\n
|
|
4
|
+
export default createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-operate-card {\n width: 100%;\n border-radius: ", "px;\n overflow: hidden;\n background-color: ", ";\n\n &-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 0 12px;\n height: 32px;\n\n &-icon {\n font-size: 16px;\n }\n\n &-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 13px;\n font-weight: 500;\n color: ", ";\n }\n\n &-description {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 12px;\n color: ", ";\n }\n\n &-arrow {\n margin: 0 0 0 auto;\n }\n\n &-has-body {\n cursor: pointer;\n }\n }\n\n &-body {\n opacity: 0;\n animation: ", "-operate-card-body-open 0.2s ease-in-out forwards;\n \n @keyframes ", "-operate-card-body-open {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n \n }\n\n\n &-line-body {\n margin: 0 12px 12px 20px;\n border-left: 1px solid ", ";\n }\n\n &-thinking {\n padding-left: 16px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n opacity: 0.85;\n white-space: pre-wrap;\n }\n\n\n &-todo-list {\n\n &-item {\n height: 32px;\n display: flex;\n align-items: center;\n padding: 0 12px;\n gap: 8px;\n \n color: ", ";\n\n\n &-done {\n color: ", ";\n }\n\n &-icon {\n font-size: 16px;\n }\n\n &-title {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-size: 12px;\n }\n\n &-done {\n \n }\n\n }\n \n }\n\n\n &-web-search-item {\n display: flex;\n height: 32px;\n align-items: center;\n padding: 0 12px;\n gap: 8px;\n color: ", ";\n cursor: pointer;\n\n &-icon {\n display: block;\n width: 16px;\n height: 16px;\n border: 1px solid ", ";\n border-radius: 99px;\n }\n\n &-title {\n font-size: 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: ", ";\n\n &:hover {\n color: ", ";\n \n }\n\n }\n\n &-subTitle {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-left: 1px solid ", ";\n font-size: 12px;\n line-height: 1;\n color: ", ";\n padding-left: 8px;\n margin-left: 4px;\n }\n\n }\n\n\n &-tool-call-block {\n margin-left: 16px;\n margin-top: 8px;\n\n \n &-title {\n font-size: 12px;\n color: ", ";\n line-height: 20px;\n margin-bottom: 4px;\n }\n\n }\n\n\n\n &-device-action {\n height: auto;\n align-items: flex-start;\n\n &-icon {\n margin-top: 6px;\n }\n\n &-time {\n margin-bottom: 4px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n }\n\n &-content {\n width: 100%;\n display: flex;\n justify-content: space-between;\n }\n\n &-description {\n width: 0;\n flex: 1;\n margin: 8px 0 6px 0;\n }\n\n &-image {\n margin: 4px 0;\n height: 32px;\n margin-left: 8px;\n display: block;\n border-radius: 6px;\n overflow: hidden;\n border: 1px solid ", ";\n }\n }\n\n &-rag-empty-placeholder {\n padding: 16px 0;\n border: 1px solid ", ";\n border-radius: 6px;\n background-color: ", ";\n line-height: 20px;\n font-size: 12px;\n color: ", ";\n margin: 0 12px 12px 12px;\n }\n\n &-rag-children .", "-operate-card-line-body {\n display: flex;\n flex-direction: column;\n }\n\n &-rag-group-title {\n margin: 16px 0 4px 16px;\n font-size: 12px;\n font-weight: 500;\n color: ", ";\n\n &:first-child {\n margin-top: 8px;\n }\n }\n\n\n &-rag-group-content {\n margin-left: 16px;\n border-radius: 6px;\n font-size: 12px;\n color: ", ";\n display: flex;\n align-items: center;\n cursor: pointer;\n\n &-images {\n gap: 8px;\n }\n }\n\n\n &-rag-item {\n margin-left: 16px;\n border-radius: 6px;\n overflow: hidden;\n margin-bottom: 4px;\n\n\n &-score {\n margin-right: 0;\n\n b {\n font-weight: 500;\n color: ", ";\n }\n }\n\n &-title {\n font-size: 12px;\n color: ", ";\n height: 28px;\n padding: 0 4px 0 12px;\n display: flex;\n align-items: center;\n cursor: pointer;\n background-color: ", ";\n }\n\n &-content {\n padding: 0 12px 12px 12px;\n background-color: ", ";\n\n &-text {\n font-size: 12px;\n line-height: 20px;\n }\n }\n\n &-images {\n margin-top: 8px;\n padding: 8px;\n display: flex;\n gap: 8px;\n background-color: ", ";\n \n }\n\n &-footer {\n display: block;\n margin-top: 8px;\n font-size: 12px;\n line-height: 20px;\n color: ", ";\n }\n\n }\n\n &-rag-item ~ &-rag-item {\n margin-top: 8px;\n }\n}\n"])), function (p) {
|
|
5
5
|
return p.theme.prefixCls;
|
|
6
6
|
}, function (p) {
|
|
7
7
|
return p.theme.borderRadiusLG;
|
|
@@ -47,10 +47,18 @@ export default createGlobalStyle(_templateObject || (_templateObject = _taggedTe
|
|
|
47
47
|
return p.theme.colorBgBase;
|
|
48
48
|
}, function (p) {
|
|
49
49
|
return p.theme.colorTextSecondary;
|
|
50
|
+
}, function (p) {
|
|
51
|
+
return p.theme.prefixCls;
|
|
50
52
|
}, function (p) {
|
|
51
53
|
return p.theme.colorTextSecondary;
|
|
52
54
|
}, function (p) {
|
|
53
|
-
return p.theme.
|
|
55
|
+
return p.theme.colorTextSecondary;
|
|
56
|
+
}, function (p) {
|
|
57
|
+
return p.theme.colorPrimary;
|
|
58
|
+
}, function (p) {
|
|
59
|
+
return p.theme.colorTextSecondary;
|
|
60
|
+
}, function (p) {
|
|
61
|
+
return p.theme.colorFillTertiary;
|
|
54
62
|
}, function (p) {
|
|
55
63
|
return p.theme.colorFillTertiary;
|
|
56
64
|
}, function (p) {
|