listpage-next 0.0.283 → 0.0.284
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/features/ChatClient/ui/Markdown/StyledMarkdown.d.ts +1 -0
- package/dist/features/ChatClient/ui/Markdown/StyledMarkdown.js +183 -0
- package/dist/features/ChatClient/ui/Markdown/components/SectionComponent.d.ts +2 -0
- package/dist/features/ChatClient/ui/Markdown/components/SectionComponent.js +12 -0
- package/dist/features/ChatClient/ui/Markdown/components/ThinkConponent.d.ts +1 -1
- package/dist/features/ChatClient/ui/Markdown/components/ThinkConponent.js +4 -1
- package/dist/features/ChatClient/ui/Markdown/index.d.ts +1 -1
- package/dist/features/ChatClient/ui/Markdown/index.js +19 -186
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StyledMarkdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("@ant-design/x-markdown").XMarkdownProps, never>> & string & Omit<import("react").FC<import("@ant-design/x-markdown").XMarkdownProps>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
import x_markdown from "@ant-design/x-markdown";
|
|
3
|
+
const StyledMarkdown = styled_components(x_markdown)`
|
|
4
|
+
h1 {
|
|
5
|
+
font-size: 18px;
|
|
6
|
+
}
|
|
7
|
+
h2 {
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
}
|
|
10
|
+
p {
|
|
11
|
+
margin: 3px !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* 表格美化样式,仅作用于当前气泡内容内的表格 */
|
|
15
|
+
table {
|
|
16
|
+
width: 100% !important;
|
|
17
|
+
border-collapse: separate;
|
|
18
|
+
border-spacing: 0;
|
|
19
|
+
background: #fff;
|
|
20
|
+
border-radius: 12px;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
23
|
+
margin: 12px 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
thead th {
|
|
27
|
+
background: #f6f8fa;
|
|
28
|
+
color: #1f2937;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
border-bottom: 1px solid #e5e7eb;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
th,
|
|
34
|
+
td {
|
|
35
|
+
padding: 10px 14px;
|
|
36
|
+
border-bottom: 1px solid #eef2f7;
|
|
37
|
+
text-align: left;
|
|
38
|
+
color: #111827;
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
line-height: 20px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
tbody tr:nth-child(odd) {
|
|
44
|
+
background: #fafbfc;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
tbody tr:hover {
|
|
48
|
+
background: #f0f7ff;
|
|
49
|
+
transition: background 0.18s ease;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* 圆角收尾,避免最后一行下边框露出 */
|
|
53
|
+
tbody tr:last-child td {
|
|
54
|
+
border-bottom: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* 当表格较宽时,允许横向滚动 */
|
|
58
|
+
& {
|
|
59
|
+
overflow-x: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
caption {
|
|
63
|
+
caption-side: top;
|
|
64
|
+
padding: 8px 0;
|
|
65
|
+
color: #6b7280;
|
|
66
|
+
font-size: 13px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* 链接与代码在表格内的细节优化 */
|
|
70
|
+
td a {
|
|
71
|
+
color: #2563eb;
|
|
72
|
+
text-decoration: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
td a:hover {
|
|
76
|
+
text-decoration: underline;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* 列表样式优化 */
|
|
80
|
+
ul,
|
|
81
|
+
ol {
|
|
82
|
+
margin: 10px 0 12px;
|
|
83
|
+
padding-left: 35px;
|
|
84
|
+
color: #1f2937;
|
|
85
|
+
line-height: 1.6;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
ul {
|
|
89
|
+
list-style-type: disc;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
ol {
|
|
93
|
+
list-style-type: decimal;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
li {
|
|
97
|
+
margin: 6px 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
li::marker {
|
|
101
|
+
color: #2563eb;
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* 嵌套列表缩进更柔和 */
|
|
106
|
+
li > ul,
|
|
107
|
+
li > ol {
|
|
108
|
+
margin-top: 6px;
|
|
109
|
+
margin-bottom: 6px;
|
|
110
|
+
padding-left: 1rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* 引用块样式优化 */
|
|
114
|
+
blockquote {
|
|
115
|
+
margin: 12px 0;
|
|
116
|
+
padding: 10px 14px;
|
|
117
|
+
border-left: 4px solid #bfdbfe; /* 蓝色系强调 */
|
|
118
|
+
background: #f8fbff;
|
|
119
|
+
color: #374151;
|
|
120
|
+
border-radius: 8px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
blockquote p {
|
|
124
|
+
margin: 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* 标题样式优化 */
|
|
128
|
+
h1,
|
|
129
|
+
h2,
|
|
130
|
+
h3,
|
|
131
|
+
h4,
|
|
132
|
+
h5,
|
|
133
|
+
h6 {
|
|
134
|
+
color: #0f172a;
|
|
135
|
+
margin: 14px 0 10px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
h1 {
|
|
139
|
+
font-size: 24px;
|
|
140
|
+
line-height: 32px;
|
|
141
|
+
font-weight: 700;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
h2 {
|
|
145
|
+
font-size: 20px;
|
|
146
|
+
line-height: 28px;
|
|
147
|
+
font-weight: 700;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
h3 {
|
|
151
|
+
font-size: 18px;
|
|
152
|
+
line-height: 26px;
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
h4 {
|
|
157
|
+
font-size: 16px;
|
|
158
|
+
line-height: 24px;
|
|
159
|
+
font-weight: 600;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
h5 {
|
|
163
|
+
font-size: 14px;
|
|
164
|
+
line-height: 22px;
|
|
165
|
+
font-weight: 600;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
h6 {
|
|
169
|
+
font-size: 13px;
|
|
170
|
+
line-height: 20px;
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
color: #374151;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* 分割线样式优化 */
|
|
176
|
+
hr {
|
|
177
|
+
border: none;
|
|
178
|
+
height: 1px;
|
|
179
|
+
margin: 16px 0;
|
|
180
|
+
background: linear-gradient(to right, #e5e7eb, #cbd5e1, #e5e7eb);
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
export { StyledMarkdown };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Think } from "./ThinkConponent.js";
|
|
3
|
+
const SectionComponent = (props)=>{
|
|
4
|
+
const { 'data-component': component, ...rest } = props;
|
|
5
|
+
if ('think' === component) return /*#__PURE__*/ jsx(Think, {
|
|
6
|
+
...rest
|
|
7
|
+
});
|
|
8
|
+
return /*#__PURE__*/ jsx("section", {
|
|
9
|
+
...rest
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { SectionComponent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentProps } from '@ant-design/x-markdown';
|
|
2
2
|
export declare const Think: import("react").MemoExoticComponent<({ streamStatus, children }: ComponentProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import x_markdown from "@ant-design/x-markdown";
|
|
2
3
|
import { memo, useEffect, useState } from "react";
|
|
3
4
|
import { Reasoning } from "../base/Reasoning.js";
|
|
4
5
|
import { styled } from "styled-components";
|
|
@@ -12,7 +13,9 @@ const Think = /*#__PURE__*/ memo(({ streamStatus, children })=>{
|
|
|
12
13
|
return /*#__PURE__*/ jsx(ReasoningContainer, {
|
|
13
14
|
children: /*#__PURE__*/ jsx(Reasoning, {
|
|
14
15
|
thinking: loading,
|
|
15
|
-
children:
|
|
16
|
+
children: /*#__PURE__*/ jsx(x_markdown, {
|
|
17
|
+
children: children
|
|
18
|
+
})
|
|
16
19
|
})
|
|
17
20
|
});
|
|
18
21
|
});
|
|
@@ -3,5 +3,5 @@ import '@ant-design/x-markdown/themes/light.css';
|
|
|
3
3
|
export interface MarkdownProps extends XMarkdownProps {
|
|
4
4
|
hasNextChunk?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare const Markdown: ({ hasNextChunk, ...props }: MarkdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const Markdown: ({ hasNextChunk, children, ...props }: MarkdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export { Reasoning } from './base/Reasoning';
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import x_markdown from "@ant-design/x-markdown";
|
|
4
|
-
import "@ant-design/x-markdown/themes/light.css";
|
|
2
|
+
import { StyledMarkdown } from "./StyledMarkdown.js";
|
|
5
3
|
import { Placeholder } from "./components/PlaceholderComponent.js";
|
|
6
|
-
import { Think } from "./components/ThinkConponent.js";
|
|
7
4
|
import { Code } from "./components/CodeComponent.js";
|
|
8
5
|
import { ErrorComponent } from "./components/ErrorComponent.js";
|
|
6
|
+
import { SectionComponent } from "./components/SectionComponent.js";
|
|
7
|
+
import "@ant-design/x-markdown/themes/light.css";
|
|
9
8
|
import { Reasoning } from "./base/Reasoning.js";
|
|
10
|
-
const
|
|
9
|
+
const processContent = (content)=>{
|
|
10
|
+
let newContent = content.replace(/(<think>)([\s\S]*?)(?:(<\/think>)(?![\s\S]*<\/think>)|$)/g, (_, start, inner, end)=>{
|
|
11
|
+
const cleanInner = inner.replace(/<\/?(think)[^>]*>/gi, '');
|
|
12
|
+
return `<think>${cleanInner}</think>`;
|
|
13
|
+
});
|
|
14
|
+
newContent = newContent.replace(/<think>/g, '<section data-component="think">');
|
|
15
|
+
newContent = newContent.replace(/<\/think>/g, '</section>\n');
|
|
16
|
+
return newContent;
|
|
17
|
+
};
|
|
18
|
+
const Markdown = ({ hasNextChunk, children, ...props })=>{
|
|
19
|
+
let content = props.content || children || '';
|
|
20
|
+
content = 'string' == typeof content ? processContent(content) : content;
|
|
21
|
+
return /*#__PURE__*/ jsx(StyledMarkdown, {
|
|
11
22
|
...props,
|
|
23
|
+
content: content,
|
|
12
24
|
components: {
|
|
25
|
+
section: SectionComponent,
|
|
13
26
|
placeholder: Placeholder,
|
|
14
|
-
think: Think,
|
|
15
27
|
code: Code,
|
|
16
28
|
error: ErrorComponent,
|
|
17
29
|
...props.components
|
|
@@ -26,184 +38,5 @@ const Markdown = ({ hasNextChunk, ...props })=>/*#__PURE__*/ jsx(MarkdownBody, {
|
|
|
26
38
|
},
|
|
27
39
|
openLinksInNewTab: true
|
|
28
40
|
});
|
|
29
|
-
|
|
30
|
-
h1 {
|
|
31
|
-
font-size: 18px;
|
|
32
|
-
}
|
|
33
|
-
h2 {
|
|
34
|
-
font-size: 16px;
|
|
35
|
-
}
|
|
36
|
-
p {
|
|
37
|
-
margin: 3px !important;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/* 表格美化样式,仅作用于当前气泡内容内的表格 */
|
|
41
|
-
table {
|
|
42
|
-
width: 100% !important;
|
|
43
|
-
border-collapse: separate;
|
|
44
|
-
border-spacing: 0;
|
|
45
|
-
background: #fff;
|
|
46
|
-
border-radius: 12px;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
49
|
-
margin: 12px 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
thead th {
|
|
53
|
-
background: #f6f8fa;
|
|
54
|
-
color: #1f2937;
|
|
55
|
-
font-weight: 600;
|
|
56
|
-
border-bottom: 1px solid #e5e7eb;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
th,
|
|
60
|
-
td {
|
|
61
|
-
padding: 10px 14px;
|
|
62
|
-
border-bottom: 1px solid #eef2f7;
|
|
63
|
-
text-align: left;
|
|
64
|
-
color: #111827;
|
|
65
|
-
font-size: 14px;
|
|
66
|
-
line-height: 20px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
tbody tr:nth-child(odd) {
|
|
70
|
-
background: #fafbfc;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
tbody tr:hover {
|
|
74
|
-
background: #f0f7ff;
|
|
75
|
-
transition: background 0.18s ease;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/* 圆角收尾,避免最后一行下边框露出 */
|
|
79
|
-
tbody tr:last-child td {
|
|
80
|
-
border-bottom: none;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/* 当表格较宽时,允许横向滚动 */
|
|
84
|
-
& {
|
|
85
|
-
overflow-x: auto;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
caption {
|
|
89
|
-
caption-side: top;
|
|
90
|
-
padding: 8px 0;
|
|
91
|
-
color: #6b7280;
|
|
92
|
-
font-size: 13px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/* 链接与代码在表格内的细节优化 */
|
|
96
|
-
td a {
|
|
97
|
-
color: #2563eb;
|
|
98
|
-
text-decoration: none;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
td a:hover {
|
|
102
|
-
text-decoration: underline;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/* 列表样式优化 */
|
|
106
|
-
ul,
|
|
107
|
-
ol {
|
|
108
|
-
margin: 10px 0 12px;
|
|
109
|
-
padding-left: 35px;
|
|
110
|
-
color: #1f2937;
|
|
111
|
-
line-height: 1.6;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
ul {
|
|
115
|
-
list-style-type: disc;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
ol {
|
|
119
|
-
list-style-type: decimal;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
li {
|
|
123
|
-
margin: 6px 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
li::marker {
|
|
127
|
-
color: #2563eb;
|
|
128
|
-
font-weight: 600;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* 嵌套列表缩进更柔和 */
|
|
132
|
-
li > ul,
|
|
133
|
-
li > ol {
|
|
134
|
-
margin-top: 6px;
|
|
135
|
-
margin-bottom: 6px;
|
|
136
|
-
padding-left: 1rem;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* 引用块样式优化 */
|
|
140
|
-
blockquote {
|
|
141
|
-
margin: 12px 0;
|
|
142
|
-
padding: 10px 14px;
|
|
143
|
-
border-left: 4px solid #bfdbfe; /* 蓝色系强调 */
|
|
144
|
-
background: #f8fbff;
|
|
145
|
-
color: #374151;
|
|
146
|
-
border-radius: 8px;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
blockquote p {
|
|
150
|
-
margin: 0;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/* 标题样式优化 */
|
|
154
|
-
h1,
|
|
155
|
-
h2,
|
|
156
|
-
h3,
|
|
157
|
-
h4,
|
|
158
|
-
h5,
|
|
159
|
-
h6 {
|
|
160
|
-
color: #0f172a;
|
|
161
|
-
margin: 14px 0 10px;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
h1 {
|
|
165
|
-
font-size: 24px;
|
|
166
|
-
line-height: 32px;
|
|
167
|
-
font-weight: 700;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
h2 {
|
|
171
|
-
font-size: 20px;
|
|
172
|
-
line-height: 28px;
|
|
173
|
-
font-weight: 700;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
h3 {
|
|
177
|
-
font-size: 18px;
|
|
178
|
-
line-height: 26px;
|
|
179
|
-
font-weight: 700;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
h4 {
|
|
183
|
-
font-size: 16px;
|
|
184
|
-
line-height: 24px;
|
|
185
|
-
font-weight: 600;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
h5 {
|
|
189
|
-
font-size: 14px;
|
|
190
|
-
line-height: 22px;
|
|
191
|
-
font-weight: 600;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
h6 {
|
|
195
|
-
font-size: 13px;
|
|
196
|
-
line-height: 20px;
|
|
197
|
-
font-weight: 600;
|
|
198
|
-
color: #374151;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/* 分割线样式优化 */
|
|
202
|
-
hr {
|
|
203
|
-
border: none;
|
|
204
|
-
height: 1px;
|
|
205
|
-
margin: 16px 0;
|
|
206
|
-
background: linear-gradient(to right, #e5e7eb, #cbd5e1, #e5e7eb);
|
|
207
|
-
}
|
|
208
|
-
`;
|
|
41
|
+
};
|
|
209
42
|
export { Markdown, Reasoning };
|