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.

💄 style: update readFile content (#11485)

Arvin Xu050499b8a9fd
diff --git a/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx b/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx
index 139d4be3f62..1e6b2972d65 100644
--- a/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx
+++ b/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx
@@ -2,8 +2,8 @@
import { type LocalReadFileParams } from '@lobechat/electron-client-ipc';
import { type BuiltinInspectorProps } from '@lobechat/types';
-import { cx } from 'antd-style';
-import { memo } from 'react';
+import { createStaticStyles, cx } from 'antd-style';
+import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { inspectorTextStyles, shinyTextStyles } from '@/styles';
@@ -11,12 +11,28 @@ import { inspectorTextStyles, shinyTextStyles } from '@/styles';
import { type LocalReadFileState } from '../../..';
import { FilePathDisplay } from '../../components/FilePathDisplay';
+const styles = createStaticStyles(({ css }) => ({
+ lineRange: css`
+ flex-shrink: 0;
+ margin-inline-start: 4px;
+ opacity: 0.7;
+ `,
+}));
+
export const ReadLocalFileInspector = memo<
BuiltinInspectorProps<LocalReadFileParams, LocalReadFileState>
>(({ args, partialArgs, isArgumentsStreaming, isLoading }) => {
const { t } = useTranslation('plugin');
const filePath = args?.path || partialArgs?.path || '';
+ const loc = args?.loc || partialArgs?.loc;
+
+ // Format line range display, e.g., "L1-L200"
+ const lineRangeText = useMemo(() => {
+ if (!loc || loc.length !== 2) return null;
+ const [start, end] = loc;
+ return `L${start + 1}-L${end}`;
+ }, [loc]);
// During argument streaming
if (isArgumentsStreaming) {
@@ -31,6 +47,7 @@ export const ReadLocalFileInspector = memo<
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
<span>{t('builtins.lobe-local-system.apiName.readLocalFile')}: </span>
<FilePathDisplay filePath={filePath} />
+ {lineRangeText && <span className={styles.lineRange}>{lineRangeText}</span>}
</div>
);
}
@@ -39,6 +56,7 @@ export const ReadLocalFileInspector = memo<
<div className={cx(inspectorTextStyles.root, isLoading && shinyTextStyles.shinyText)}>
<span>{t('builtins.lobe-local-system.apiName.readLocalFile')}: </span>
<FilePathDisplay filePath={filePath} />
+ {lineRangeText && <span className={styles.lineRange}>{lineRangeText}</span>}
</div>
);
});