Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🌐 chore: translate non-English comments to English in src/features/Conversation (#12410)

LobeHub Bot01e13959d176
diff --git a/src/features/Conversation/ChatInput/index.tsx b/src/features/Conversation/ChatInput/index.tsx
index d38804ed40c..03d8d17cd80 100644
--- a/src/features/Conversation/ChatInput/index.tsx
+++ b/src/features/Conversation/ChatInput/index.tsx
@@ -71,7 +71,7 @@ export interface ChatInputProps {
*/
sendMenu?: MenuProps;
/**
- * 与 ChatList 共同挨在一起的时候,将一点间距去掉
+ * Remove a small margin when placed adjacent to the ChatList
*/
skipScrollMarginWithList?: boolean;
}
diff --git a/src/features/Conversation/ChatList/components/AutoScroll/DebugInspector.tsx b/src/features/Conversation/ChatList/components/AutoScroll/DebugInspector.tsx
index 52c915d17d4..56a83d6b054 100644
--- a/src/features/Conversation/ChatList/components/AutoScroll/DebugInspector.tsx
+++ b/src/features/Conversation/ChatList/components/AutoScroll/DebugInspector.tsx
@@ -7,8 +7,8 @@ import { messageStateSelectors, useConversationStore, virtuaListSelectors } from
import { AT_BOTTOM_THRESHOLD } from './const';
/**
- * 是否开启调试面板
- * 设为 true 可以显示滚动位置调试信息
+ * Whether to enable the debug panel
+ * Set to true to display scroll position debug information
*/
export const OPEN_DEV_INSPECTOR = false;
@@ -23,7 +23,7 @@ const DebugInspector = memo(() => {
const scrollSize = virtuaScrollMethods?.getScrollSize?.() ?? 0;
const viewportSize = virtuaScrollMethods?.getViewportSize?.() ?? 0;
const distanceToBottom = scrollSize - scrollOffset - viewportSize;
- // 可视化计算
+ // Visual calculation
const visualHeight = 120;
const scale = scrollSize > 0 ? visualHeight / scrollSize : 0;
const viewportVisualHeight = Math.max(viewportSize * scale, 10);
@@ -46,7 +46,7 @@ const DebugInspector = memo(() => {
zIndex: 9999,
}}
>
- {/* 滚动条可视化 */}
+ {/* Scroll bar visualization */}
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
<div style={{ color: '#9ca3af', fontSize: 10 }}>Scroll Position</div>
<div
@@ -58,7 +58,7 @@ const DebugInspector = memo(() => {
width: 24,
}}
>
- {/* threshold 区域 (底部 200px) */}
+ {/* Threshold area (bottom 200px) */}
<div
style={{
background: atBottom ? 'rgba(34, 197, 94, 0.3)' : 'rgba(239, 68, 68, 0.3)',
@@ -70,7 +70,7 @@ const DebugInspector = memo(() => {
right: 0,
}}
/>
- {/* 当前视口位置 */}
+ {/* Current viewport position */}
<div
style={{
background: atBottom ? '#22c55e' : '#3b82f6',
@@ -83,7 +83,7 @@ const DebugInspector = memo(() => {
transition: 'top 0.1s',
}}
/>
- {/* threshold 线 */}
+ {/* Threshold line */}
<div
style={{
background: '#f59e0b',
@@ -100,7 +100,7 @@ const DebugInspector = memo(() => {
</div>
</div>
- {/* 数值信息 */}
+ {/* Numeric information */}
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
<div style={{ color: '#9ca3af', fontSize: 10 }}>
scrollSize: <span style={{ color: 'white' }}>{Math.round(scrollSize)}px</span>
diff --git a/src/features/Conversation/ChatList/components/AutoScroll/const.ts b/src/features/Conversation/ChatList/components/AutoScroll/const.ts
index 9513856d52a..4c2c44a3776 100644
--- a/src/features/Conversation/ChatList/components/AutoScroll/const.ts
+++ b/src/features/Conversation/ChatList/components/AutoScroll/const.ts
@@ -1,5 +1,5 @@
/**
- * 判断是否在底部的阈值(单位:px)
- * 当距离底部小于等于此值时,认为在底部
+ * Threshold for determining if at the bottom (unit: px)
+ * When the distance to the bottom is less than or equal to this value, considered at the bottom
*/
export const AT_BOTTOM_THRESHOLD = 100;
diff --git a/src/features/Conversation/ChatList/components/AutoScroll/index.tsx b/src/features/Conversation/ChatList/components/AutoScroll/index.tsx
index f5273cc4420..8f5717d0f57 100644
--- a/src/features/Conversation/ChatList/components/AutoScroll/index.tsx
+++ b/src/features/Conversation/ChatList/components/AutoScroll/index.tsx
@@ -27,7 +27,7 @@ const AutoScroll = memo(() => {
const shouldAutoScroll = isAutoScrollEnabled && atBottom && isGenerating && !isScrolling;
- // 获取最后一条消息的 content 长度,用于监听流式输出
+ // Get the content length of the last message to monitor streaming output
const lastMessage = dbMessages.at(-1);
const lastMessageContentLength =
typeof lastMessage?.content === 'string' ? lastMessage.content.length : 0;
diff --git a/src/features/Conversation/ChatList/components/BackBottom/index.tsx b/src/features/Conversation/ChatList/components/BackBottom/index.tsx
index d7d3dc9adfd..fb3c018c544 100644
--- a/src/features/Conversation/ChatList/components/BackBottom/index.tsx
+++ b/src/features/Conversation/ChatList/components/BackBottom/index.tsx
@@ -19,7 +19,7 @@ const BackBottom = memo<BackBottomProps>(({ visible, atBottom, onScrollToBottom
return (
<>
- {/* Debug: 底部指示线 */}
+ {/* Debug: bottom indicator line */}
{OPEN_DEV_INSPECTOR && (
<div
style={{
@@ -30,7 +30,7 @@ const BackBottom = memo<BackBottomProps>(({ visible, atBottom, onScrollToBottom
right: 0,
}}
>
- {/* Threshold 区域顶部边界线 */}
+ {/* Threshold area top boundary line */}
<div
style={{
background: atBottom ? '#22c55e' : '#ef4444',
@@ -43,7 +43,7 @@ const BackBottom = memo<BackBottomProps>(({ visible, atBottom, onScrollToBottom
}}
/>
- {/* Threshold 区域 mask - 显示在指示线上方 */}
+ {/* Threshold area mask - displayed above the indicator line */}
<div
style={{
background: atBottom
@@ -57,7 +57,7 @@ const BackBottom = memo<BackBottomProps>(({ visible, atBottom, onScrollToBottom
}}
/>
- {/* AutoScroll 位置指示线(底部) */}
+ {/* AutoScroll position indicator line (bottom) */}
<div
style={{
background: atBottom ? '#22c55e' : '#ef4444',
diff --git a/src/features/Conversation/ChatList/components/VirtualizedList.tsx b/src/features/Conversation/ChatList/components/VirtualizedList.tsx
index 6be93fc6f4d..08172cf8f9b 100644
--- a/src/features/Conversation/ChatList/components/VirtualizedList.tsx
+++ b/src/features/Conversation/ChatList/components/VirtualizedList.tsx
@@ -139,7 +139,7 @@ const VirtualizedList = memo<VirtualizedListProps>(({ dataSource, itemContent })
return (
<div style={{ height: '100%', position: 'relative' }}>
- {/* Debug Inspector - 放在 VList 外面,不会被虚拟列表回收 */}
+ {/* Debug Inspector - placed outside VList so it won't be recycled by the virtual list */}
{OPEN_DEV_INSPECTOR && <DebugInspector />}
<VList
bufferSize={typeof window !== 'undefined' ? window.innerHeight : 0}
@@ -159,7 +159,7 @@ const VirtualizedList = memo<VirtualizedListProps>(({ dataSource, itemContent })
return (
<div key={messageId} style={{ position: 'relative', width: '100%' }}>
{content}
- {/* AutoScroll 放在最后一个 Item 里面,这样只有当最后一个 Item 可见时才会触发自动滚动 */}
+ {/* AutoScroll is placed inside the last Item so it only triggers when the last Item is visible */}
{isLastItem && <AutoScroll />}
</div>
);
@@ -168,13 +168,13 @@ const VirtualizedList = memo<VirtualizedListProps>(({ dataSource, itemContent })
return (
<WideScreenContainer key={messageId} style={{ position: 'relative' }}>
{content}
- {/* AutoScroll 放在最后一个 Item 里面,这样只有当最后一个 Item 可见时才会触发自动滚动 */}
+ {/* AutoScroll is placed inside the last Item so it only triggers when the last Item is visible */}
{isLastItem && <AutoScroll />}
</WideScreenContainer>
);
}}
</VList>
- {/* BackBottom 放在 VList 外面,这样无论滚动到哪里都能看到 */}
+ {/* BackBottom is placed outside VList so it remains visible regardless of scroll position */}
<BackBottom
atBottom={atBottom}
visible={!atBottom}
diff --git a/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx b/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx
index afa490c198f..e1d1f7cbc1d 100644
--- a/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx
+++ b/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx
@@ -7,7 +7,7 @@ import { useConversationStore } from '@/features/Conversation/store';
import BaseErrorForm from '../BaseErrorForm';
-// TODO: 优化 Ollama setup 的流程,isDesktop 模式下可以直接做到端到端检测
+// TODO: Optimize the Ollama setup flow - in isDesktop mode, end-to-end detection can be done directly
const OllamaDesktopSetupGuide = memo<{ id?: string }>(({ id }) => {
const { t } = useTranslation('components');
diff --git a/src/features/Conversation/Markdown/plugins/LobeArtifact/rehypePlugin.ts b/src/features/Conversation/Markdown/plugins/LobeArtifact/rehypePlugin.ts
index b5e53251e19..a6b18f28fd1 100644
--- a/src/features/Conversation/Markdown/plugins/LobeArtifact/rehypePlugin.ts
+++ b/src/features/Conversation/Markdown/plugins/LobeArtifact/rehypePlugin.ts
@@ -8,7 +8,7 @@ function rehypeAntArtifact() {
if (node.type === 'element' && node.tagName === 'p' && node.children.length > 0) {
const firstChild = node.children[0];
if (firstChild.type === 'raw' && firstChild.value.startsWith(`<${ARTIFACT_TAG}`)) {
- // 提取 lobeArtifact 的属性
+ // Extract lobeArtifact attributes
const attributes: Record<string, string> = {};
const attributeRegex = /(\w+)="([^"]*)"/g;
let match;
@@ -16,7 +16,7 @@ function rehypeAntArtifact() {
attributes[match[1]] = match[2];
}
- // 创建新的 lobeArtifact 节点
+ // Create new lobeArtifact node
const newNode = {
children: [
{
@@ -42,20 +42,20 @@ function rehypeAntArtifact() {
type: 'element',
};
- // 替换原来的 p 节点
+ // Replace the original p node
parent.children.splice(index, 1, newNode);
return [SKIP, index];
}
}
- // 如果字符串是 <lobeArtifact identifier="ai-new-interpretation" type="image/svg+xml" title="人工智能新解释">
- // 得到的节点就是:
+ // If the string is <lobeArtifact identifier="ai-new-interpretation" type="image/svg+xml" title="New AI Interpretation">
+ // The resulting node is:
// {
// type: 'raw',
// value:
- // '<lobeArtifact identifier="ai-new-interpretation" type="image/svg+xml" title="人工智能新解释">',
+ // '<lobeArtifact identifier="ai-new-interpretation" type="image/svg+xml" title="New AI Interpretation">',
// }
else if (node.type === 'raw' && node.value.startsWith(`<${ARTIFACT_TAG}`)) {
- // 创建新的 lobeArtifact 节点
+ // Create new lobeArtifact node
const newNode = {
children: [],
properties: {},
@@ -63,7 +63,7 @@ function rehypeAntArtifact() {
type: 'element',
};
- // 替换原来的 p 节点
+ // Replace the original p node
parent.children.splice(index, 1, newNode);
return [SKIP, index];
}
diff --git a/src/features/Conversation/Markdown/plugins/LocalFile/Render/index.tsx b/src/features/Conversation/Markdown/plugins/LocalFile/Render/index.tsx
index 79eadb91ad2..088888a2687 100644
--- a/src/features/Conversation/Markdown/plugins/LocalFile/Render/index.tsx
+++ b/src/features/Conversation/Markdown/plugins/LocalFile/Render/index.tsx
@@ -12,16 +12,16 @@ interface LocalFileProps {
}
const Render = memo<MarkdownElementProps<LocalFileProps>>(({ node }) => {
- // 从 node.properties 中提取属性
+ // Extract properties from node.properties
const { name, path, isDirectory } = node?.properties || {};
if (!name || !path) {
- // 如果缺少必要属性,可以选择渲染错误提示或 null
+ // If required properties are missing, render an error or null
console.error('LocalFile Render component missing required properties:', node?.properties);
- return null; // 或者返回一个错误占位符
+ return null; // Or return an error placeholder
}
- // isDirectory 属性可能为 true (来自插件) 或 undefined,我们需要确保它是 boolean
+ // isDirectory may be true (from plugin) or undefined; ensure it is a boolean
const isDir = isDirectory === true;
return <LocalFile isDirectory={isDir} name={name} path={path} />;
diff --git a/src/features/Conversation/Markdown/plugins/LocalFile/index.ts b/src/features/Conversation/Markdown/plugins/LocalFile/index.ts
index deb4f4137c3..b68691e1bd8 100644
--- a/src/features/Conversation/Markdown/plugins/LocalFile/index.ts
+++ b/src/features/Conversation/Markdown/plugins/LocalFile/index.ts
@@ -6,7 +6,7 @@ import { createRemarkSelfClosingTagPlugin } from '../remarkPlugins/createRemarkS
import { type MarkdownElement, type MarkdownElementProps } from '../type';
import RenderComponent from './Render';
-// 定义此元素的标签名
+// Define the tag name for this element
const LocalFileElement: MarkdownElement = {
Component: RenderComponent as FC<MarkdownElementProps>,
diff --git a/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkCustomTagPlugin.ts b/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkCustomTagPlugin.ts
index ae95f2a797c..ba5bb3f6470 100644
--- a/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkCustomTagPlugin.ts
+++ b/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkCustomTagPlugin.ts
@@ -10,7 +10,7 @@ export const createRemarkCustomTagPlugin = (tag: string) => () => {
let endIndex = startIndex + 1;
let hasCloseTag = false;
- // 查找闭合标签
+ // Find the closing tag
while (endIndex < parent.children.length) {
const sibling = parent.children[endIndex];
if (sibling.type === 'html' && sibling.value === `</${tag}>`) {
@@ -20,22 +20,22 @@ export const createRemarkCustomTagPlugin = (tag: string) => () => {
endIndex++;
}
- // 计算需要删除的节点范围
+ // Calculate the range of nodes to delete
const deleteCount = hasCloseTag
? endIndex - startIndex + 1
: parent.children.length - startIndex;
- // 提取内容节点
+ // Extract content nodes
const contentNodes = parent.children.slice(
startIndex + 1,
hasCloseTag ? endIndex : undefined,
);
- // 转换为 Markdown 字符串
+ // Convert to Markdown string
const content = treeNodeToString(contentNodes);
- // 创建自定义节点
+ // Create custom node
const customNode = {
data: {
hChildren: [{ type: 'text', value: content }],
@@ -45,10 +45,10 @@ export const createRemarkCustomTagPlugin = (tag: string) => () => {
type: `${tag}Block`,
};
- // 替换原始节点
+ // Replace the original nodes
parent.children.splice(startIndex, deleteCount, customNode);
- // 跳过已处理的节点
+ // Skip already-processed nodes
return [SKIP, startIndex + 1];
}
});
diff --git a/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkSelfClosingTagPlugin.ts b/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkSelfClosingTagPlugin.ts
index 763e6f201e0..bfa5f02b56a 100644
--- a/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkSelfClosingTagPlugin.ts
+++ b/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkSelfClosingTagPlugin.ts
@@ -2,7 +2,7 @@ import debug from 'debug';
import { type Plugin } from 'unified';
import { SKIP, visit } from 'unist-util-visit';
-// 创建 debugger 实例
+// Create debugger instance
const log = debug('lobe-markdown:remark-plugin:self-closing');
const escapeRegExp = (str: string) => str.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&');
diff --git a/src/features/Conversation/Markdown/plugins/remarkPlugins/getNodeContent.ts b/src/features/Conversation/Markdown/plugins/remarkPlugins/getNodeContent.ts
index d7e030af9c8..9269df9ade0 100644
--- a/src/features/Conversation/Markdown/plugins/remarkPlugins/getNodeContent.ts
+++ b/src/features/Conversation/Markdown/plugins/remarkPlugins/getNodeContent.ts
@@ -2,7 +2,7 @@ import { toMarkdown } from 'mdast-util-to-markdown';
import { type Parent } from 'unist';
const processNode = (node: any): string => {
- // 处理数学公式节点
+ // Handle math formula nodes
if (node.type === 'inlineMath') {
return `$${node.value}$`;
}
@@ -13,16 +13,16 @@ const processNode = (node: any): string => {
return `[${text}](${node.url})`;
}
- // 处理带有子节点的容器
+ // Handle containers with child nodes
if (node.children) {
const content = node.children.map((element: Parent) => processNode(element)).join('');
- // 处理列表的特殊换行逻辑
+ // Handle special line-break logic for lists
if (node.type === 'list') {
return `\n${content}\n`;
}
- // 处理列表项的前缀
+ // Handle list item prefixes
if (node.type === 'listItem') {
const prefix = node.checked !== null ? `[${node.checked ? 'x' : ' '}] ` : '';
return `${prefix}${content}`;
@@ -31,20 +31,20 @@ const processNode = (node: any): string => {
return content;
}
- // 处理文本节点
+ // Handle text nodes
if (node.value) {
- // 保留原始空白字符处理逻辑
+ // Preserve original whitespace handling logic
return node.value.replaceAll(/^\s+|\s+$/g, ' ');
}
- // 兜底使用标准转换
+ // Fall back to standard conversion
return toMarkdown(node);
};
export const treeNodeToString = (nodes: Parent[]) => {
return nodes
.map((node) => {
- // 处理列表的缩进问题
+ // Handle list indentation
if (node.type === 'list') {
return node.children
.map((item, index) => {
diff --git a/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/AnimatedNumber.tsx b/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/AnimatedNumber.tsx
index 020d780f857..eaa9d9dc121 100644
--- a/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/AnimatedNumber.tsx
+++ b/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/AnimatedNumber.tsx
@@ -26,7 +26,7 @@ const AnimatedNumber = memo<AnimatedNumberProps>(({ value, duration = 3000, form
const elapsed = currentTime - startTimeRef.current;
const progress = Math.min(elapsed / duration, 1);
- // 使用 easeOutCubic 缓动函数
+ // Apply easeOutCubic easing function
const easeProgress = 1 - (1 - progress) ** 3;
const current = startValue + diff * easeProgress;
diff --git a/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/index.tsx b/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/index.tsx
index e77d5224550..8591b412984 100644
--- a/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/index.tsx
+++ b/src/features/Conversation/Messages/components/Extras/Usage/UsageDetail/index.tsx
@@ -28,7 +28,7 @@ interface TokenDetailProps {
const TokenDetail = memo<TokenDetailProps>(({ usage, performance, model, provider }) => {
const { t } = useTranslation('chat');
- // 使用 systemStatus 管理短格式显示状态
+ // Use systemStatus to manage short-format display state
const isShortFormat = useGlobalStore(systemStatusSelectors.tokenDisplayFormatShort);
const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
@@ -221,7 +221,7 @@ const TokenDetail = memo<TokenDetailProps>(({ usage, performance, model, provide
gap={2}
style={{ cursor: 'pointer' }}
onClick={(e) => {
- // 阻止 Popover 并切换格式
+ // Prevent Popover from closing and toggle the format
e.preventDefault();
e.stopPropagation();
updateSystemStatus({ tokenDisplayFormatShort: !isShortFormat });
diff --git a/src/features/Conversation/Messages/components/SearchGrounding.tsx b/src/features/Conversation/Messages/components/SearchGrounding.tsx
index 56ee197420c..afba157be6a 100644
--- a/src/features/Conversation/Messages/components/SearchGrounding.tsx
+++ b/src/features/Conversation/Messages/components/SearchGrounding.tsx
@@ -111,7 +111,7 @@ const SearchGrounding = memo<GroundingSearch>(({ searchQueries, citations }) =>
style={{ overflow: 'hidden', width: '100%' }}
transition={{
duration: 0.2,
- ease: [0.4, 0, 0.2, 1], // 使用 ease-out 缓动函数
+ ease: [0.4, 0, 0.2, 1], // Using ease-out easing function
}}
variants={{
collapsed: { height: 0, opacity: 0, width: 'auto' },
diff --git a/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx b/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx
index f715d21fbef..22e613b44b7 100644
--- a/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx
+++ b/src/features/Conversation/components/ShareMessageModal/ShareImage/index.tsx
@@ -29,7 +29,7 @@ const ShareImage = memo<{ message: UIChatMessage; mobile?: boolean; uniqueId?: s
const [fieldValue, setFieldValue] = useState<FieldType>(DEFAULT_FIELD_VALUE);
const { t } = useTranslation(['chat', 'common']);
- // 生成唯一的预览ID,避免DOM冲突
+ // Generate a unique preview ID to avoid DOM conflicts
const previewId = uniqueId ? `preview-${uniqueId}` : 'preview';
const { loading, onDownload, title } = useScreenshot({
diff --git a/src/features/Conversation/types/ui.ts b/src/features/Conversation/types/ui.ts
index 3a5c3830c79..7155d16bae5 100644
--- a/src/features/Conversation/types/ui.ts
+++ b/src/features/Conversation/types/ui.ts
@@ -85,7 +85,7 @@ export interface ListItemProps {
};
/**
- * @description 是否显示聊天项的名称
+ * @description Whether to show the chat item title
* @default false
*/
showTitle?: boolean;
diff --git a/src/features/Conversation/utils/markdown.ts b/src/features/Conversation/utils/markdown.ts
index ae359f16205..3ba76b99207 100644
--- a/src/features/Conversation/utils/markdown.ts
+++ b/src/features/Conversation/utils/markdown.ts
@@ -59,17 +59,17 @@ export const processWithArtifact = (input: string = '') => {
return output;
};
-// 预处理函数:确保 think 标签前后有两个换行符
+// Preprocessing function: ensure two newlines before and after think tags
export const normalizeThinkTags = (input: string) => {
return (
input
- // 确保 <think> 标签前后有两个换行符
+ // Ensure two newlines before and after <think> tags
.replaceAll(/([^\n])\s*<think>/g, '$1\n\n<think>')
.replaceAll(/<think>\s*([^\n])/g, '<think>\n\n$1')
- // 确保 </think> 标签前后有两个换行符
+ // Ensure two newlines before and after </think> tags
.replaceAll(/([^\n])\s*<\/think>/g, '$1\n\n</think>')
.replaceAll(/<\/think>\s*([^\n])/g, '</think>\n\n$1')
- // 处理可能产生的多余换行符
+ // Remove excess newlines that may have been introduced
.replaceAll(/\n{3,}/g, '\n\n')
);
};