🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🌐 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.tsxindex 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.tsxindex 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 } fromimport { 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 calculationconst 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) */}<divstyle={{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 */}<divstyle={{background: atBottom ? '#22c55e' : '#3b82f6',@@ -83,7 +83,7 @@ const DebugInspector = memo(() => {transition: 'top 0.1s',}}/>- {/* threshold 线 */}+ {/* Threshold line */}<divstyle={{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.tsindex 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.tsxindex 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 outputconst 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.tsxindex 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, onScrollToBottomreturn (<>- {/* Debug: 底部指示线 */}+ {/* Debug: bottom indicator line */}{OPEN_DEV_INSPECTOR && (<divstyle={{@@ -30,7 +30,7 @@ const BackBottom = memo<BackBottomProps>(({ visible, atBottom, onScrollToBottomright: 0,}}>- {/* Threshold 区域顶部边界线 */}+ {/* Threshold area top boundary line */}<divstyle={{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 */}<divstyle={{background: atBottom@@ -57,7 +57,7 @@ const BackBottom = memo<BackBottomProps>(({ visible, atBottom, onScrollToBottom}}/>- {/* AutoScroll 位置指示线(底部) */}+ {/* AutoScroll position indicator line (bottom) */}<divstyle={{background: atBottom ? '#22c55e' : '#ef4444',diff --git a/src/features/Conversation/ChatList/components/VirtualizedList.tsx b/src/features/Conversation/ChatList/components/VirtualizedList.tsxindex 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 />}<VListbufferSize={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 */}<BackBottomatBottom={atBottom}visible={!atBottom}diff --git a/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx b/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsxindex 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 directlyconst 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.tsindex 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 attributesconst 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 nodeconst newNode = {children: [{@@ -42,20 +42,20 @@ function rehypeAntArtifact() {type: 'element',};- // 替换原来的 p 节点+ // Replace the original p nodeparent.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 nodeconst newNode = {children: [],properties: {},@@ -63,7 +63,7 @@ function rehypeAntArtifact() {type: 'element',};- // 替换原来的 p 节点+ // Replace the original p nodeparent.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.tsxindex 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.propertiesconst { name, path, isDirectory } = node?.properties || {};if (!name || !path) {- // 如果缺少必要属性,可以选择渲染错误提示或 null+ // If required properties are missing, render an error or nullconsole.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 booleanconst 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.tsindex 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/createRemarkSimport { type MarkdownElement, type MarkdownElementProps } from '../type';import RenderComponent from './Render';-// 定义此元素的标签名+// Define the tag name for this elementconst 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.tsindex 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 tagwhile (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 deleteconst deleteCount = hasCloseTag? endIndex - startIndex + 1: parent.children.length - startIndex;- // 提取内容节点+ // Extract content nodesconst contentNodes = parent.children.slice(startIndex + 1,hasCloseTag ? endIndex : undefined,);- // 转换为 Markdown 字符串+ // Convert to Markdown stringconst content = treeNodeToString(contentNodes);- // 创建自定义节点+ // Create custom nodeconst customNode = {data: {hChildren: [{ type: 'text', value: content }],@@ -45,10 +45,10 @@ export const createRemarkCustomTagPlugin = (tag: string) => () => {type: `${tag}Block`,};- // 替换原始节点+ // Replace the original nodesparent.children.splice(startIndex, deleteCount, customNode);- // 跳过已处理的节点+ // Skip already-processed nodesreturn [SKIP, startIndex + 1];}});diff --git a/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkSelfClosingTagPlugin.ts b/src/features/Conversation/Markdown/plugins/remarkPlugins/createRemarkSelfClosingTagPlugin.tsindex 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 instanceconst 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.tsindex 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 nodesif (node.type === 'inlineMath') {return `$${node.value}$`;}@@ -13,16 +13,16 @@ const processNode = (node: any): string => {return `[${text}](${node.url})`;}- // 处理带有子节点的容器+ // Handle containers with child nodesif (node.children) {const content = node.children.map((element: Parent) => processNode(element)).join('');- // 处理列表的特殊换行逻辑+ // Handle special line-break logic for listsif (node.type === 'list') {return `\n${content}\n`;}- // 处理列表项的前缀+ // Handle list item prefixesif (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 nodesif (node.value) {- // 保留原始空白字符处理逻辑+ // Preserve original whitespace handling logicreturn node.value.replaceAll(/^\s+|\s+$/g, ' ');}- // 兜底使用标准转换+ // Fall back to standard conversionreturn toMarkdown(node);};export const treeNodeToString = (nodes: Parent[]) => {return nodes.map((node) => {- // 处理列表的缩进问题+ // Handle list indentationif (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.tsxindex 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, formconst elapsed = currentTime - startTimeRef.current;const progress = Math.min(elapsed / duration, 1);- // 使用 easeOutCubic 缓动函数+ // Apply easeOutCubic easing functionconst 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.tsxindex 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 stateconst isShortFormat = useGlobalStore(systemStatusSelectors.tokenDisplayFormatShort);const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);@@ -221,7 +221,7 @@ const TokenDetail = memo<TokenDetailProps>(({ usage, performance, model, providegap={2}style={{ cursor: 'pointer' }}onClick={(e) => {- // 阻止 Popover 并切换格式+ // Prevent Popover from closing and toggle the formate.preventDefault();e.stopPropagation();updateSystemStatus({ tokenDisplayFormatShort: !isShortFormat });diff --git a/src/features/Conversation/Messages/components/SearchGrounding.tsx b/src/features/Conversation/Messages/components/SearchGrounding.tsxindex 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.tsxindex 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?: sconst [fieldValue, setFieldValue] = useState<FieldType>(DEFAULT_FIELD_VALUE);const { t } = useTranslation(['chat', 'common']);- // 生成唯一的预览ID,避免DOM冲突+ // Generate a unique preview ID to avoid DOM conflictsconst 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.tsindex 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.tsindex 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 tagsexport 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'));};