@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/src/tools/streamings.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CloudSandboxManifest,
|
|
3
3
|
CloudSandboxStreamings,
|
|
4
4
|
} from '@lobechat/builtin-tool-cloud-sandbox/client';
|
|
5
5
|
import {
|
|
@@ -7,11 +7,12 @@ import {
|
|
|
7
7
|
GroupManagementStreamings,
|
|
8
8
|
} from '@lobechat/builtin-tool-group-management/client';
|
|
9
9
|
import { GTDManifest, GTDStreamings } from '@lobechat/builtin-tool-gtd/client';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
LocalSystemManifest,
|
|
12
|
+
LocalSystemStreamings,
|
|
13
|
+
} from '@lobechat/builtin-tool-local-system/client';
|
|
11
14
|
import { type BuiltinStreaming } from '@lobechat/types';
|
|
12
15
|
|
|
13
|
-
import { LocalSystemStreamings } from './local-system/Streaming';
|
|
14
|
-
|
|
15
16
|
/**
|
|
16
17
|
* Builtin tools streaming renderer registry
|
|
17
18
|
* Organized by toolset (identifier) -> API name
|
|
@@ -21,7 +22,7 @@ import { LocalSystemStreamings } from './local-system/Streaming';
|
|
|
21
22
|
* The component should fetch streaming content from store internally.
|
|
22
23
|
*/
|
|
23
24
|
const BuiltinToolStreamings: Record<string, Record<string, BuiltinStreaming>> = {
|
|
24
|
-
[
|
|
25
|
+
[CloudSandboxManifest.identifier]: CloudSandboxStreamings as Record<string, BuiltinStreaming>,
|
|
25
26
|
[GroupManagementManifest.identifier]: GroupManagementStreamings as Record<
|
|
26
27
|
string,
|
|
27
28
|
BuiltinStreaming
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type EditLocalFileState } from '@lobechat/builtin-tool-local-system';
|
|
4
|
-
import { type EditLocalFileParams } from '@lobechat/electron-client-ipc';
|
|
5
|
-
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
6
|
-
import { Icon } from '@lobehub/ui';
|
|
7
|
-
import { createStaticStyles, cx } from 'antd-style';
|
|
8
|
-
import { ChevronRight } from 'lucide-react';
|
|
9
|
-
import path from 'path-browserify-esm';
|
|
10
|
-
import { memo } from 'react';
|
|
11
|
-
import { useTranslation } from 'react-i18next';
|
|
12
|
-
|
|
13
|
-
import { shinyTextStyles } from '@/styles';
|
|
14
|
-
|
|
15
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
16
|
-
content: css`
|
|
17
|
-
font-family: ${cssVar.fontFamilyCode};
|
|
18
|
-
`,
|
|
19
|
-
root: css`
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
display: -webkit-box;
|
|
22
|
-
-webkit-box-orient: vertical;
|
|
23
|
-
-webkit-line-clamp: 1;
|
|
24
|
-
|
|
25
|
-
color: ${cssVar.colorTextDescription};
|
|
26
|
-
`,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
export const EditLocalFileInspector = memo<
|
|
30
|
-
BuiltinInspectorProps<EditLocalFileParams, EditLocalFileState>
|
|
31
|
-
>(({ args, isLoading }) => {
|
|
32
|
-
const { t } = useTranslation('plugin');
|
|
33
|
-
|
|
34
|
-
// Show filename with parent directory for context
|
|
35
|
-
let displayPath = '';
|
|
36
|
-
if (args?.file_path) {
|
|
37
|
-
const { base, dir } = path.parse(args.file_path);
|
|
38
|
-
const parentDir = path.basename(dir);
|
|
39
|
-
displayPath = parentDir ? `${parentDir}/${base}` : base;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
44
|
-
<span>{t('builtins.lobe-local-system.apiName.editLocalFile')}</span>
|
|
45
|
-
{displayPath && (
|
|
46
|
-
<>
|
|
47
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
48
|
-
<span className={styles.content}>{displayPath}</span>
|
|
49
|
-
</>
|
|
50
|
-
)}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
EditLocalFileInspector.displayName = 'EditLocalFileInspector';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type GlobFilesState } from '@lobechat/builtin-tool-local-system';
|
|
4
|
-
import { type GlobFilesParams } from '@lobechat/electron-client-ipc';
|
|
5
|
-
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
6
|
-
import { Icon } from '@lobehub/ui';
|
|
7
|
-
import { createStaticStyles, cx } from 'antd-style';
|
|
8
|
-
import { ChevronRight } from 'lucide-react';
|
|
9
|
-
import { memo } from 'react';
|
|
10
|
-
import { useTranslation } from 'react-i18next';
|
|
11
|
-
|
|
12
|
-
import { shinyTextStyles } from '@/styles';
|
|
13
|
-
|
|
14
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
-
content: css`
|
|
16
|
-
font-family: ${cssVar.fontFamilyCode};
|
|
17
|
-
`,
|
|
18
|
-
root: css`
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
display: -webkit-box;
|
|
21
|
-
-webkit-box-orient: vertical;
|
|
22
|
-
-webkit-line-clamp: 1;
|
|
23
|
-
|
|
24
|
-
color: ${cssVar.colorTextDescription};
|
|
25
|
-
`,
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
export const GlobLocalFilesInspector = memo<BuiltinInspectorProps<GlobFilesParams, GlobFilesState>>(
|
|
29
|
-
({ args, isLoading }) => {
|
|
30
|
-
const { t } = useTranslation('plugin');
|
|
31
|
-
|
|
32
|
-
const pattern = args?.pattern || '';
|
|
33
|
-
|
|
34
|
-
// When loading, show "本地系统 > 匹配搜索文件"
|
|
35
|
-
if (isLoading) {
|
|
36
|
-
return (
|
|
37
|
-
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
38
|
-
<span>{t('builtins.lobe-local-system.title')}</span>
|
|
39
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
40
|
-
<span>{t('builtins.lobe-local-system.apiName.globLocalFiles')}</span>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className={styles.root}>
|
|
47
|
-
<span>{t('builtins.lobe-local-system.apiName.globLocalFiles')}</span>
|
|
48
|
-
{pattern && (
|
|
49
|
-
<>
|
|
50
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
51
|
-
<span className={styles.content}>{pattern}</span>
|
|
52
|
-
</>
|
|
53
|
-
)}
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
GlobLocalFilesInspector.displayName = 'GlobLocalFilesInspector';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type GrepContentState } from '@lobechat/builtin-tool-local-system';
|
|
4
|
-
import { type GrepContentParams } from '@lobechat/electron-client-ipc';
|
|
5
|
-
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
6
|
-
import { Icon } from '@lobehub/ui';
|
|
7
|
-
import { createStaticStyles, cx } from 'antd-style';
|
|
8
|
-
import { ChevronRight } from 'lucide-react';
|
|
9
|
-
import { memo } from 'react';
|
|
10
|
-
import { useTranslation } from 'react-i18next';
|
|
11
|
-
|
|
12
|
-
import { shinyTextStyles } from '@/styles';
|
|
13
|
-
|
|
14
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
-
content: css`
|
|
16
|
-
font-family: ${cssVar.fontFamilyCode};
|
|
17
|
-
`,
|
|
18
|
-
root: css`
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
display: -webkit-box;
|
|
21
|
-
-webkit-box-orient: vertical;
|
|
22
|
-
-webkit-line-clamp: 1;
|
|
23
|
-
|
|
24
|
-
color: ${cssVar.colorTextDescription};
|
|
25
|
-
`,
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
export const GrepContentInspector = memo<
|
|
29
|
-
BuiltinInspectorProps<GrepContentParams, GrepContentState>
|
|
30
|
-
>(({ args, isLoading }) => {
|
|
31
|
-
const { t } = useTranslation('plugin');
|
|
32
|
-
|
|
33
|
-
const pattern = args?.pattern || '';
|
|
34
|
-
|
|
35
|
-
// When loading, show "本地系统 > 搜索内容"
|
|
36
|
-
if (isLoading) {
|
|
37
|
-
return (
|
|
38
|
-
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
39
|
-
<span>{t('builtins.lobe-local-system.title')}</span>
|
|
40
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
41
|
-
<span>{t('builtins.lobe-local-system.apiName.grepContent')}</span>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div className={styles.root}>
|
|
48
|
-
<span>{t('builtins.lobe-local-system.apiName.grepContent')}</span>
|
|
49
|
-
{pattern && (
|
|
50
|
-
<>
|
|
51
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
52
|
-
<span className={styles.content}>{pattern}</span>
|
|
53
|
-
</>
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
GrepContentInspector.displayName = 'GrepContentInspector';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import type { LocalReadFileState } from '@lobechat/builtin-tool-local-system';
|
|
4
|
-
import { type LocalReadFileParams } from '@lobechat/electron-client-ipc';
|
|
5
|
-
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
6
|
-
import { Icon } from '@lobehub/ui';
|
|
7
|
-
import { createStaticStyles, cx } from 'antd-style';
|
|
8
|
-
import { ChevronRight } from 'lucide-react';
|
|
9
|
-
import path from 'path-browserify-esm';
|
|
10
|
-
import { memo } from 'react';
|
|
11
|
-
import { useTranslation } from 'react-i18next';
|
|
12
|
-
|
|
13
|
-
import { shinyTextStyles } from '@/styles';
|
|
14
|
-
|
|
15
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
16
|
-
content: css`
|
|
17
|
-
font-family: ${cssVar.fontFamilyCode};
|
|
18
|
-
`,
|
|
19
|
-
root: css`
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
display: -webkit-box;
|
|
22
|
-
-webkit-box-orient: vertical;
|
|
23
|
-
-webkit-line-clamp: 1;
|
|
24
|
-
|
|
25
|
-
color: ${cssVar.colorTextDescription};
|
|
26
|
-
`,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
export const ReadLocalFileInspector = memo<
|
|
30
|
-
BuiltinInspectorProps<LocalReadFileParams, LocalReadFileState>
|
|
31
|
-
>(({ args, isLoading }) => {
|
|
32
|
-
const { t } = useTranslation('plugin');
|
|
33
|
-
|
|
34
|
-
// Show filename with parent directory for context
|
|
35
|
-
let displayPath = '';
|
|
36
|
-
if (args?.path) {
|
|
37
|
-
const { base, dir } = path.parse(args.path);
|
|
38
|
-
const parentDir = path.basename(dir);
|
|
39
|
-
displayPath = parentDir ? `${parentDir}/${base}` : base;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div className={cx(styles.root, isLoading && shinyTextStyles.shinyText)}>
|
|
44
|
-
<span>{t('builtins.lobe-local-system.apiName.readLocalFile')}</span>
|
|
45
|
-
{displayPath && (
|
|
46
|
-
<>
|
|
47
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
48
|
-
<span className={styles.content}>{displayPath}</span>
|
|
49
|
-
</>
|
|
50
|
-
)}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
ReadLocalFileInspector.displayName = 'ReadLocalFileInspector';
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type RunCommandParams, type RunCommandResult } from '@lobechat/electron-client-ipc';
|
|
4
|
-
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
5
|
-
import { Icon } from '@lobehub/ui';
|
|
6
|
-
import { createStaticStyles, cx } from 'antd-style';
|
|
7
|
-
import { ChevronRight } from 'lucide-react';
|
|
8
|
-
import { memo } from 'react';
|
|
9
|
-
import { useTranslation } from 'react-i18next';
|
|
10
|
-
|
|
11
|
-
import { shinyTextStyles } from '@/styles';
|
|
12
|
-
|
|
13
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
14
|
-
content: css`
|
|
15
|
-
font-family: ${cssVar.fontFamilyCode};
|
|
16
|
-
`,
|
|
17
|
-
root: css`
|
|
18
|
-
overflow: hidden;
|
|
19
|
-
display: -webkit-box;
|
|
20
|
-
-webkit-box-orient: vertical;
|
|
21
|
-
-webkit-line-clamp: 1;
|
|
22
|
-
|
|
23
|
-
color: ${cssVar.colorTextDescription};
|
|
24
|
-
`,
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
interface RunCommandState {
|
|
28
|
-
message: string;
|
|
29
|
-
result: RunCommandResult;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const RunCommandInspector = memo<BuiltinInspectorProps<RunCommandParams, RunCommandState>>(
|
|
33
|
-
({ args, isLoading }) => {
|
|
34
|
-
const { t } = useTranslation('plugin');
|
|
35
|
-
|
|
36
|
-
// Show description if available, otherwise show command
|
|
37
|
-
const displayText = args?.description || args?.command || '';
|
|
38
|
-
|
|
39
|
-
// When loading, show "Local System > 执行命令"
|
|
40
|
-
if (isLoading) {
|
|
41
|
-
return (
|
|
42
|
-
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
43
|
-
<span>{t('builtins.lobe-local-system.title')}</span>
|
|
44
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
45
|
-
<span>{t('builtins.lobe-local-system.apiName.runCommand')}</span>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div className={styles.root}>
|
|
52
|
-
<span>{t('builtins.lobe-local-system.apiName.runCommand')}</span>
|
|
53
|
-
{displayText && (
|
|
54
|
-
<>
|
|
55
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
56
|
-
<span className={styles.content}>{displayText}</span>
|
|
57
|
-
</>
|
|
58
|
-
)}
|
|
59
|
-
</div>
|
|
60
|
-
);
|
|
61
|
-
},
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
RunCommandInspector.displayName = 'RunCommandInspector';
|
|
65
|
-
|
|
66
|
-
export default RunCommandInspector;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { type LocalFileSearchState } from '@lobechat/builtin-tool-local-system';
|
|
4
|
-
import { type LocalSearchFilesParams } from '@lobechat/electron-client-ipc';
|
|
5
|
-
import { type BuiltinInspectorProps } from '@lobechat/types';
|
|
6
|
-
import { Icon } from '@lobehub/ui';
|
|
7
|
-
import { createStaticStyles, cx } from 'antd-style';
|
|
8
|
-
import { ChevronRight } from 'lucide-react';
|
|
9
|
-
import { memo } from 'react';
|
|
10
|
-
import { useTranslation } from 'react-i18next';
|
|
11
|
-
|
|
12
|
-
import { shinyTextStyles } from '@/styles';
|
|
13
|
-
|
|
14
|
-
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
15
|
-
content: css`
|
|
16
|
-
font-family: ${cssVar.fontFamilyCode};
|
|
17
|
-
`,
|
|
18
|
-
root: css`
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
display: -webkit-box;
|
|
21
|
-
-webkit-box-orient: vertical;
|
|
22
|
-
-webkit-line-clamp: 1;
|
|
23
|
-
|
|
24
|
-
color: ${cssVar.colorTextDescription};
|
|
25
|
-
`,
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
export const SearchLocalFilesInspector = memo<
|
|
29
|
-
BuiltinInspectorProps<LocalSearchFilesParams, LocalFileSearchState>
|
|
30
|
-
>(({ args, isLoading }) => {
|
|
31
|
-
const { t } = useTranslation('plugin');
|
|
32
|
-
|
|
33
|
-
const keywords = args?.keywords || '';
|
|
34
|
-
|
|
35
|
-
// When loading, show "本地系统 > 搜索文件"
|
|
36
|
-
if (isLoading) {
|
|
37
|
-
return (
|
|
38
|
-
<div className={cx(styles.root, shinyTextStyles.shinyText)}>
|
|
39
|
-
<span>{t('builtins.lobe-local-system.title')}</span>
|
|
40
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
41
|
-
<span>{t('builtins.lobe-local-system.apiName.searchLocalFiles')}</span>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div className={styles.root}>
|
|
48
|
-
<span>{t('builtins.lobe-local-system.apiName.searchLocalFiles')}</span>
|
|
49
|
-
{keywords && (
|
|
50
|
-
<>
|
|
51
|
-
<Icon icon={ChevronRight} style={{ marginInline: 4 }} />
|
|
52
|
-
<span className={styles.content}>{keywords}</span>
|
|
53
|
-
</>
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
SearchLocalFilesInspector.displayName = 'SearchLocalFilesInspector';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|