@lobehub/lobehub 2.0.0-next.182 → 2.0.0-next.184
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/CHANGELOG.md +50 -0
- package/changelog/v1.json +14 -0
- package/package.json +1 -1
- package/packages/builtin-tool-local-system/package.json +10 -0
- package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +81 -0
- package/packages/builtin-tool-local-system/src/client/Inspector/GlobLocalFiles/index.tsx +73 -0
- package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +73 -0
- package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +81 -0
- package/packages/builtin-tool-local-system/src/client/Inspector/RunCommand/index.tsx +80 -0
- package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +71 -0
- package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Inspector/index.ts +1 -2
- package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/index.ts +1 -2
- package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ListFiles/Result.tsx +2 -1
- package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/index.ts +1 -2
- package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Streaming/index.ts +1 -2
- package/packages/builtin-tool-local-system/src/client/index.ts +20 -0
- package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/index.tsx +3 -3
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/index.tsx +3 -3
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/index.tsx +3 -3
- package/src/app/[variants]/(main)/home/features/RecentPage/index.tsx +3 -2
- package/src/app/[variants]/(main)/home/features/RecentResource/index.tsx +3 -2
- package/src/app/[variants]/(main)/home/features/RecentTopic/index.tsx +3 -3
- package/src/components/NeuralNetworkLoading/index.tsx +181 -0
- package/src/libs/swr/index.ts +1 -8
- package/src/store/chat/slices/topic/action.test.ts +154 -0
- package/src/store/chat/slices/topic/action.ts +48 -4
- package/src/tools/inspectors.ts +6 -5
- package/src/tools/interventions.ts +5 -4
- package/src/tools/placeholders.ts +9 -7
- package/src/tools/renders.ts +5 -3
- package/src/tools/streamings.ts +6 -5
- package/src/tools/local-system/Inspector/EditLocalFile/index.tsx +0 -55
- package/src/tools/local-system/Inspector/GlobLocalFiles/index.tsx +0 -59
- package/src/tools/local-system/Inspector/GrepContent/index.tsx +0 -59
- package/src/tools/local-system/Inspector/ReadLocalFile/index.tsx +0 -55
- package/src/tools/local-system/Inspector/RunCommand/index.tsx +0 -66
- package/src/tools/local-system/Inspector/SearchLocalFiles/index.tsx +0 -59
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/EditLocalFile/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/MoveLocalFiles/MoveFileItem.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/MoveLocalFiles/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/RunCommand/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Intervention/WriteFile/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Placeholder/ListFiles.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Placeholder/SearchFiles.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/EditLocalFile/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ListFiles/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/MoveLocalFiles/MoveFileItem.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/MoveLocalFiles/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ReadLocalFile/ReadFileSkeleton.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ReadLocalFile/ReadFileView.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/ReadLocalFile/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/RenameLocalFile/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/RunCommand/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/Result.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/SearchQuery/SearchView.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/SearchQuery/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/SearchFiles/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Render/WriteFile/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Streaming/RunCommand/index.tsx +0 -0
- /package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/components/FileItem.tsx +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.184](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.183...v2.0.0-next.184)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2026-01-01**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: Improve loading and local-system render.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: Improve loading and local-system render, closes [#11087](https://github.com/lobehub/lobe-chat/issues/11087) ([44630bc](https://github.com/lobehub/lobe-chat/commit/44630bc))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## [Version 2.0.0-next.183](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.182...v2.0.0-next.183)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2025-12-31**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **store**: Clear new key data when switchTopic to new state.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **store**: Clear new key data when switchTopic to new state, closes [#11078](https://github.com/lobehub/lobe-chat/issues/11078) ([180ea14](https://github.com/lobehub/lobe-chat/commit/180ea14))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 2.0.0-next.182](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.181...v2.0.0-next.182)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2025-12-31**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"improvements": [
|
|
5
|
+
"Improve loading and local-system render."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2026-01-01",
|
|
9
|
+
"version": "2.0.0-next.184"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {},
|
|
13
|
+
"date": "2025-12-31",
|
|
14
|
+
"version": "2.0.0-next.183"
|
|
15
|
+
},
|
|
2
16
|
{
|
|
3
17
|
"children": {
|
|
4
18
|
"features": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.184",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
7
|
+
"./client": "./src/client/index.ts",
|
|
7
8
|
"./executionRuntime": "./src/ExecutionRuntime/index.ts"
|
|
8
9
|
},
|
|
9
10
|
"main": "./src/index.ts",
|
|
@@ -12,5 +13,14 @@
|
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
14
15
|
"@lobechat/types": "workspace:*"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@lobehub/ui": "^4",
|
|
19
|
+
"antd": "^6",
|
|
20
|
+
"antd-style": "*",
|
|
21
|
+
"lucide-react": "*",
|
|
22
|
+
"path-browserify-esm": "*",
|
|
23
|
+
"react": "*",
|
|
24
|
+
"react-i18next": "*"
|
|
15
25
|
}
|
|
16
26
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type EditLocalFileParams } from '@lobechat/electron-client-ipc';
|
|
4
|
+
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { Check, X } from 'lucide-react';
|
|
7
|
+
import path from 'path-browserify-esm';
|
|
8
|
+
import { memo } from 'react';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
|
+
|
|
11
|
+
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
12
|
+
|
|
13
|
+
import { type EditLocalFileState } from '../../../types';
|
|
14
|
+
|
|
15
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
16
|
+
root: css`
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
display: -webkit-box;
|
|
19
|
+
-webkit-box-orient: vertical;
|
|
20
|
+
-webkit-line-clamp: 1;
|
|
21
|
+
|
|
22
|
+
color: ${cssVar.colorTextSecondary};
|
|
23
|
+
`,
|
|
24
|
+
statusIcon: css`
|
|
25
|
+
margin-block-end: -2px;
|
|
26
|
+
margin-inline-start: 4px;
|
|
27
|
+
`,
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
export const EditLocalFileInspector = memo<
|
|
31
|
+
BuiltinInspectorProps<EditLocalFileParams, EditLocalFileState>
|
|
32
|
+
>(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
|
|
33
|
+
const { t } = useTranslation('plugin');
|
|
34
|
+
|
|
35
|
+
// Show filename with parent directory for context
|
|
36
|
+
const filePath = args?.file_path || partialArgs?.file_path || '';
|
|
37
|
+
let displayPath = '';
|
|
38
|
+
if (filePath) {
|
|
39
|
+
const { base, dir } = path.parse(filePath);
|
|
40
|
+
const parentDir = path.basename(dir);
|
|
41
|
+
displayPath = parentDir ? `${parentDir}/${base}` : base;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// During argument streaming
|
|
45
|
+
if (isArgumentsStreaming) {
|
|
46
|
+
if (!displayPath)
|
|
47
|
+
return (
|
|
48
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
49
|
+
<span>{t('builtins.lobe-local-system.apiName.editLocalFile')}</span>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
55
|
+
<span>{t('builtins.lobe-local-system.apiName.editLocalFile')}: </span>
|
|
56
|
+
<span className={highlightTextStyles.primary}>{displayPath}</span>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Check if edit was successful (has replacements count)
|
|
62
|
+
const isSuccess = pluginState?.replacements !== undefined && pluginState.replacements >= 0;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
66
|
+
<span style={{ marginInlineStart: 2 }}>
|
|
67
|
+
<span>{t('builtins.lobe-local-system.apiName.editLocalFile')}: </span>
|
|
68
|
+
{displayPath && <span className={highlightTextStyles.primary}>{displayPath}</span>}
|
|
69
|
+
{isLoading ? null : pluginState ? (
|
|
70
|
+
isSuccess ? (
|
|
71
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
72
|
+
) : (
|
|
73
|
+
<X className={styles.statusIcon} color={cssVar.colorError} size={14} />
|
|
74
|
+
)
|
|
75
|
+
) : null}
|
|
76
|
+
</span>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
EditLocalFileInspector.displayName = 'EditLocalFileInspector';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type GlobFilesParams } from '@lobechat/electron-client-ipc';
|
|
4
|
+
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { Check, X } from 'lucide-react';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
11
|
+
|
|
12
|
+
import { type GlobFilesState } from '../../..';
|
|
13
|
+
|
|
14
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
+
root: css`
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
display: -webkit-box;
|
|
18
|
+
-webkit-box-orient: vertical;
|
|
19
|
+
-webkit-line-clamp: 1;
|
|
20
|
+
|
|
21
|
+
color: ${cssVar.colorTextSecondary};
|
|
22
|
+
`,
|
|
23
|
+
statusIcon: css`
|
|
24
|
+
margin-block-end: -2px;
|
|
25
|
+
margin-inline-start: 4px;
|
|
26
|
+
`,
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
export const GlobLocalFilesInspector = memo<BuiltinInspectorProps<GlobFilesParams, GlobFilesState>>(
|
|
30
|
+
({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
|
|
31
|
+
const { t } = useTranslation('plugin');
|
|
32
|
+
|
|
33
|
+
const pattern = args?.pattern || partialArgs?.pattern || '';
|
|
34
|
+
|
|
35
|
+
// During argument streaming
|
|
36
|
+
if (isArgumentsStreaming) {
|
|
37
|
+
if (!pattern)
|
|
38
|
+
return (
|
|
39
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
40
|
+
<span>{t('builtins.lobe-local-system.apiName.globLocalFiles')}</span>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
46
|
+
<span>{t('builtins.lobe-local-system.apiName.globLocalFiles')}: </span>
|
|
47
|
+
<span className={highlightTextStyles.primary}>{pattern}</span>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Check if glob was successful
|
|
53
|
+
const isSuccess = pluginState?.result?.success;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
57
|
+
<span style={{ marginInlineStart: 2 }}>
|
|
58
|
+
<span>{t('builtins.lobe-local-system.apiName.globLocalFiles')}: </span>
|
|
59
|
+
{pattern && <span className={highlightTextStyles.primary}>{pattern}</span>}
|
|
60
|
+
{isLoading ? null : pluginState?.result ? (
|
|
61
|
+
isSuccess ? (
|
|
62
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
63
|
+
) : (
|
|
64
|
+
<X className={styles.statusIcon} color={cssVar.colorError} size={14} />
|
|
65
|
+
)
|
|
66
|
+
) : null}
|
|
67
|
+
</span>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
GlobLocalFilesInspector.displayName = 'GlobLocalFilesInspector';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type GrepContentParams } from '@lobechat/electron-client-ipc';
|
|
4
|
+
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { Check, X } from 'lucide-react';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
11
|
+
|
|
12
|
+
import { type GrepContentState } from '../../..';
|
|
13
|
+
|
|
14
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
+
root: css`
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
display: -webkit-box;
|
|
18
|
+
-webkit-box-orient: vertical;
|
|
19
|
+
-webkit-line-clamp: 1;
|
|
20
|
+
|
|
21
|
+
color: ${cssVar.colorTextSecondary};
|
|
22
|
+
`,
|
|
23
|
+
statusIcon: css`
|
|
24
|
+
margin-block-end: -2px;
|
|
25
|
+
margin-inline-start: 4px;
|
|
26
|
+
`,
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
export const GrepContentInspector = memo<
|
|
30
|
+
BuiltinInspectorProps<GrepContentParams, GrepContentState>
|
|
31
|
+
>(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
|
|
32
|
+
const { t } = useTranslation('plugin');
|
|
33
|
+
|
|
34
|
+
const pattern = args?.pattern || partialArgs?.pattern || '';
|
|
35
|
+
|
|
36
|
+
// During argument streaming
|
|
37
|
+
if (isArgumentsStreaming) {
|
|
38
|
+
if (!pattern)
|
|
39
|
+
return (
|
|
40
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
41
|
+
<span>{t('builtins.lobe-local-system.apiName.grepContent')}</span>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
47
|
+
<span>{t('builtins.lobe-local-system.apiName.grepContent')}: </span>
|
|
48
|
+
<span className={highlightTextStyles.primary}>{pattern}</span>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Check if grep was successful
|
|
54
|
+
const isSuccess = pluginState?.result?.success;
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
58
|
+
<span style={{ marginInlineStart: 2 }}>
|
|
59
|
+
<span>{t('builtins.lobe-local-system.apiName.grepContent')}: </span>
|
|
60
|
+
{pattern && <span className={highlightTextStyles.primary}>{pattern}</span>}
|
|
61
|
+
{isLoading ? null : pluginState?.result ? (
|
|
62
|
+
isSuccess ? (
|
|
63
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
64
|
+
) : (
|
|
65
|
+
<X className={styles.statusIcon} color={cssVar.colorError} size={14} />
|
|
66
|
+
)
|
|
67
|
+
) : null}
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
GrepContentInspector.displayName = 'GrepContentInspector';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type LocalReadFileParams } from '@lobechat/electron-client-ipc';
|
|
4
|
+
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { Check, X } from 'lucide-react';
|
|
7
|
+
import path from 'path-browserify-esm';
|
|
8
|
+
import { memo } from 'react';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
|
+
|
|
11
|
+
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
12
|
+
|
|
13
|
+
import { type LocalReadFileState } from '../../..';
|
|
14
|
+
|
|
15
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
16
|
+
root: css`
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
display: -webkit-box;
|
|
19
|
+
-webkit-box-orient: vertical;
|
|
20
|
+
-webkit-line-clamp: 1;
|
|
21
|
+
|
|
22
|
+
color: ${cssVar.colorTextSecondary};
|
|
23
|
+
`,
|
|
24
|
+
statusIcon: css`
|
|
25
|
+
margin-block-end: -2px;
|
|
26
|
+
margin-inline-start: 4px;
|
|
27
|
+
`,
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
export const ReadLocalFileInspector = memo<
|
|
31
|
+
BuiltinInspectorProps<LocalReadFileParams, LocalReadFileState>
|
|
32
|
+
>(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
|
|
33
|
+
const { t } = useTranslation('plugin');
|
|
34
|
+
|
|
35
|
+
// Show filename with parent directory for context
|
|
36
|
+
const filePath = args?.path || partialArgs?.path || '';
|
|
37
|
+
let displayPath = '';
|
|
38
|
+
if (filePath) {
|
|
39
|
+
const { base, dir } = path.parse(filePath);
|
|
40
|
+
const parentDir = path.basename(dir);
|
|
41
|
+
displayPath = parentDir ? `${parentDir}/${base}` : base;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// During argument streaming
|
|
45
|
+
if (isArgumentsStreaming) {
|
|
46
|
+
if (!displayPath)
|
|
47
|
+
return (
|
|
48
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
49
|
+
<span>{t('builtins.lobe-local-system.apiName.readLocalFile')}</span>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
55
|
+
<span>{t('builtins.lobe-local-system.apiName.readLocalFile')}: </span>
|
|
56
|
+
<span className={highlightTextStyles.primary}>{displayPath}</span>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Check if file was read successfully (has content)
|
|
62
|
+
const hasContent = !!pluginState?.fileContent;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
66
|
+
<span style={{ marginInlineStart: 2 }}>
|
|
67
|
+
<span>{t('builtins.lobe-local-system.apiName.readLocalFile')}: </span>
|
|
68
|
+
{displayPath && <span className={highlightTextStyles.primary}>{displayPath}</span>}
|
|
69
|
+
{isLoading ? null : pluginState ? (
|
|
70
|
+
hasContent ? (
|
|
71
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
72
|
+
) : (
|
|
73
|
+
<X className={styles.statusIcon} color={cssVar.colorError} size={14} />
|
|
74
|
+
)
|
|
75
|
+
) : null}
|
|
76
|
+
</span>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
ReadLocalFileInspector.displayName = 'ReadLocalFileInspector';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type RunCommandParams, type RunCommandResult } from '@lobechat/electron-client-ipc';
|
|
4
|
+
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { Check, X } from 'lucide-react';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
11
|
+
|
|
12
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
13
|
+
root: css`
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
display: -webkit-box;
|
|
16
|
+
-webkit-box-orient: vertical;
|
|
17
|
+
-webkit-line-clamp: 1;
|
|
18
|
+
|
|
19
|
+
color: ${cssVar.colorTextSecondary};
|
|
20
|
+
`,
|
|
21
|
+
statusIcon: css`
|
|
22
|
+
margin-block-end: -2px;
|
|
23
|
+
margin-inline-start: 4px;
|
|
24
|
+
`,
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
interface RunCommandState {
|
|
28
|
+
message: string;
|
|
29
|
+
result: RunCommandResult;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const RunCommandInspector = memo<BuiltinInspectorProps<RunCommandParams, RunCommandState>>(
|
|
33
|
+
({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
|
|
34
|
+
const { t } = useTranslation('plugin');
|
|
35
|
+
|
|
36
|
+
// Show description if available, otherwise show command
|
|
37
|
+
const description = args?.description || partialArgs?.description || args?.command || '';
|
|
38
|
+
|
|
39
|
+
// During argument streaming
|
|
40
|
+
if (isArgumentsStreaming) {
|
|
41
|
+
if (!description)
|
|
42
|
+
return (
|
|
43
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
44
|
+
<span>{t('builtins.lobe-local-system.apiName.runCommand')}</span>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
50
|
+
<span>{t('builtins.lobe-local-system.apiName.runCommand')}: </span>
|
|
51
|
+
<span className={highlightTextStyles.primary}>{description}</span>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Get execution result from pluginState
|
|
57
|
+
const result = pluginState?.result;
|
|
58
|
+
const isSuccess = result?.success && result?.exit_code === 0;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
62
|
+
<span style={{ marginInlineStart: 2 }}>
|
|
63
|
+
<span>{t('builtins.lobe-local-system.apiName.runCommand')}: </span>
|
|
64
|
+
{description && <span className={highlightTextStyles.primary}>{description}</span>}
|
|
65
|
+
{isLoading ? null : result?.success !== undefined ? (
|
|
66
|
+
isSuccess ? (
|
|
67
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
68
|
+
) : (
|
|
69
|
+
<X className={styles.statusIcon} color={cssVar.colorError} size={14} />
|
|
70
|
+
)
|
|
71
|
+
) : null}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
RunCommandInspector.displayName = 'RunCommandInspector';
|
|
79
|
+
|
|
80
|
+
export default RunCommandInspector;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { type LocalSearchFilesParams } from '@lobechat/electron-client-ipc';
|
|
4
|
+
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
5
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
6
|
+
import { Check } from 'lucide-react';
|
|
7
|
+
import { memo } from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
|
|
10
|
+
import { highlightTextStyles, shinyTextStyles } from '@/styles';
|
|
11
|
+
|
|
12
|
+
import { type LocalFileSearchState } from '../../..';
|
|
13
|
+
|
|
14
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
+
root: css`
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
display: -webkit-box;
|
|
18
|
+
-webkit-box-orient: vertical;
|
|
19
|
+
-webkit-line-clamp: 1;
|
|
20
|
+
|
|
21
|
+
color: ${cssVar.colorTextSecondary};
|
|
22
|
+
`,
|
|
23
|
+
statusIcon: css`
|
|
24
|
+
margin-block-end: -2px;
|
|
25
|
+
margin-inline-start: 4px;
|
|
26
|
+
`,
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
export const SearchLocalFilesInspector = memo<
|
|
30
|
+
BuiltinInspectorProps<LocalSearchFilesParams, LocalFileSearchState>
|
|
31
|
+
>(({ args, partialArgs, isArgumentsStreaming, pluginState, isLoading }) => {
|
|
32
|
+
const { t } = useTranslation('plugin');
|
|
33
|
+
|
|
34
|
+
const keywords = args?.keywords || partialArgs?.keywords || '';
|
|
35
|
+
|
|
36
|
+
// During argument streaming
|
|
37
|
+
if (isArgumentsStreaming) {
|
|
38
|
+
if (!keywords)
|
|
39
|
+
return (
|
|
40
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
41
|
+
<span>{t('builtins.lobe-local-system.apiName.searchLocalFiles')}</span>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
47
|
+
<span>{t('builtins.lobe-local-system.apiName.searchLocalFiles')}: </span>
|
|
48
|
+
<span className={highlightTextStyles.primary}>{keywords}</span>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Check if search returned results
|
|
54
|
+
const hasResults = pluginState?.searchResults && pluginState.searchResults.length >= 0;
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
58
|
+
<span style={{ marginInlineStart: 2 }}>
|
|
59
|
+
<span>{t('builtins.lobe-local-system.apiName.searchLocalFiles')}: </span>
|
|
60
|
+
{keywords && <span className={highlightTextStyles.primary}>{keywords}</span>}
|
|
61
|
+
{isLoading ? null : pluginState?.searchResults ? (
|
|
62
|
+
hasResults ? (
|
|
63
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
64
|
+
) : null
|
|
65
|
+
) : null}
|
|
66
|
+
</span>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
SearchLocalFilesInspector.displayName = 'SearchLocalFilesInspector';
|
package/{src/tools/local-system → packages/builtin-tool-local-system/src/client}/Inspector/index.ts
RENAMED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { LocalSystemApiName } from '
|
|
2
|
-
|
|
1
|
+
import { LocalSystemApiName } from '../..';
|
|
3
2
|
import { EditLocalFileInspector } from './EditLocalFile';
|
|
4
3
|
import { GlobLocalFilesInspector } from './GlobLocalFiles';
|
|
5
4
|
import { GrepContentInspector } from './GrepContent';
|
|
@@ -5,7 +5,8 @@ import { memo } from 'react';
|
|
|
5
5
|
|
|
6
6
|
import { useChatStore } from '@/store/chat';
|
|
7
7
|
import { chatToolSelectors } from '@/store/chat/selectors';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
import FileItem from '../../components/FileItem';
|
|
9
10
|
|
|
10
11
|
interface SearchFilesProps {
|
|
11
12
|
listResults?: LocalFileItem[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Inspector components (customized tool call headers)
|
|
2
|
+
export { LocalSystemInspectors } from './Inspector';
|
|
3
|
+
|
|
4
|
+
// Render components (read-only snapshots)
|
|
5
|
+
export { LocalSystemRenders } from './Render';
|
|
6
|
+
|
|
7
|
+
// Intervention components (approval dialogs)
|
|
8
|
+
export { LocalSystemInterventions } from './Intervention';
|
|
9
|
+
|
|
10
|
+
// Streaming components
|
|
11
|
+
export { LocalSystemStreamings } from './Streaming';
|
|
12
|
+
|
|
13
|
+
// Placeholder components
|
|
14
|
+
export { ListFiles as LocalSystemListFilesPlaceholder } from './Placeholder/ListFiles';
|
|
15
|
+
export { default as LocalSystemSearchFilesPlaceholder } from './Placeholder/SearchFiles';
|
|
16
|
+
|
|
17
|
+
// Re-export types and manifest for convenience
|
|
18
|
+
export { LocalSystemManifest } from '../manifest';
|
|
19
|
+
export { LocalSystemIdentifier } from '../types';
|
|
20
|
+
export * from '../types';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { AccordionItem,
|
|
4
|
-
import { Loader2Icon } from 'lucide-react';
|
|
3
|
+
import { AccordionItem, Dropdown, Flexbox, Text } from '@lobehub/ui';
|
|
5
4
|
import React, { Suspense, memo } from 'react';
|
|
6
5
|
import { useTranslation } from 'react-i18next';
|
|
7
6
|
|
|
7
|
+
import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
|
|
8
8
|
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
|
|
9
9
|
import { useFetchTopics } from '@/hooks/useFetchTopics';
|
|
10
10
|
import { useChatStore } from '@/store/chat';
|
|
@@ -45,7 +45,7 @@ const Topic = memo<TopicProps>(({ itemKey }) => {
|
|
|
45
45
|
<Text ellipsis fontSize={12} type={'secondary'} weight={500}>
|
|
46
46
|
{`${t('title')} ${topicCount > 0 ? topicCount : ''}`}
|
|
47
47
|
</Text>
|
|
48
|
-
{isRevalidating && <
|
|
48
|
+
{isRevalidating && <NeuralNetworkLoading size={14} />}
|
|
49
49
|
</Flexbox>
|
|
50
50
|
}
|
|
51
51
|
>
|