@lobehub/lobehub 2.0.0-next.50 → 2.0.0-next.52
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/apps/desktop/src/main/controllers/LocalFileCtr.ts +25 -5
- package/apps/desktop/src/main/controllers/ShellCommandCtr.ts +242 -0
- package/apps/desktop/src/main/controllers/__tests__/LocalFileCtr.test.ts +4 -1
- package/apps/desktop/src/main/controllers/__tests__/ShellCommandCtr.test.ts +499 -0
- package/apps/desktop/src/main/modules/fileSearch/__tests__/macOS.integration.test.ts +357 -0
- package/apps/desktop/src/main/modules/fileSearch/impl/macOS.ts +30 -22
- package/changelog/v1.json +18 -0
- package/locales/ar/chat.json +20 -0
- package/locales/ar/common.json +1 -0
- package/locales/ar/components.json +6 -0
- package/locales/ar/models.json +119 -126
- package/locales/ar/plugin.json +2 -1
- package/locales/bg-BG/chat.json +20 -0
- package/locales/bg-BG/common.json +1 -0
- package/locales/bg-BG/components.json +6 -0
- package/locales/bg-BG/models.json +104 -132
- package/locales/bg-BG/plugin.json +2 -1
- package/locales/de-DE/chat.json +20 -0
- package/locales/de-DE/common.json +1 -0
- package/locales/de-DE/components.json +6 -0
- package/locales/de-DE/models.json +119 -126
- package/locales/de-DE/plugin.json +2 -1
- package/locales/en-US/chat.json +20 -0
- package/locales/en-US/common.json +1 -0
- package/locales/en-US/components.json +6 -0
- package/locales/en-US/models.json +167 -126
- package/locales/en-US/plugin.json +2 -1
- package/locales/es-ES/chat.json +20 -0
- package/locales/es-ES/common.json +1 -0
- package/locales/es-ES/components.json +6 -0
- package/locales/es-ES/models.json +119 -126
- package/locales/es-ES/plugin.json +2 -1
- package/locales/fa-IR/chat.json +20 -0
- package/locales/fa-IR/common.json +1 -0
- package/locales/fa-IR/components.json +6 -0
- package/locales/fa-IR/models.json +119 -126
- package/locales/fa-IR/plugin.json +2 -1
- package/locales/fr-FR/chat.json +20 -0
- package/locales/fr-FR/common.json +1 -0
- package/locales/fr-FR/components.json +6 -0
- package/locales/fr-FR/models.json +119 -126
- package/locales/fr-FR/plugin.json +2 -1
- package/locales/it-IT/chat.json +20 -0
- package/locales/it-IT/common.json +1 -0
- package/locales/it-IT/components.json +6 -0
- package/locales/it-IT/models.json +119 -126
- package/locales/it-IT/plugin.json +2 -1
- package/locales/ja-JP/chat.json +20 -0
- package/locales/ja-JP/common.json +1 -0
- package/locales/ja-JP/components.json +6 -0
- package/locales/ja-JP/models.json +119 -126
- package/locales/ja-JP/plugin.json +2 -1
- package/locales/ko-KR/chat.json +20 -0
- package/locales/ko-KR/common.json +1 -0
- package/locales/ko-KR/components.json +6 -0
- package/locales/ko-KR/models.json +119 -126
- package/locales/ko-KR/plugin.json +2 -1
- package/locales/nl-NL/chat.json +20 -0
- package/locales/nl-NL/common.json +1 -0
- package/locales/nl-NL/components.json +6 -0
- package/locales/nl-NL/models.json +119 -126
- package/locales/nl-NL/plugin.json +2 -1
- package/locales/pl-PL/chat.json +20 -0
- package/locales/pl-PL/common.json +1 -0
- package/locales/pl-PL/components.json +6 -0
- package/locales/pl-PL/models.json +119 -126
- package/locales/pl-PL/plugin.json +2 -1
- package/locales/pt-BR/chat.json +20 -0
- package/locales/pt-BR/common.json +1 -0
- package/locales/pt-BR/components.json +6 -0
- package/locales/pt-BR/models.json +119 -126
- package/locales/pt-BR/plugin.json +2 -1
- package/locales/ru-RU/chat.json +20 -0
- package/locales/ru-RU/common.json +1 -0
- package/locales/ru-RU/components.json +6 -0
- package/locales/ru-RU/models.json +119 -126
- package/locales/ru-RU/plugin.json +2 -1
- package/locales/tr-TR/chat.json +20 -0
- package/locales/tr-TR/common.json +1 -0
- package/locales/tr-TR/components.json +6 -0
- package/locales/tr-TR/models.json +119 -126
- package/locales/tr-TR/plugin.json +2 -1
- package/locales/vi-VN/chat.json +20 -0
- package/locales/vi-VN/common.json +1 -0
- package/locales/vi-VN/components.json +6 -0
- package/locales/vi-VN/models.json +119 -126
- package/locales/vi-VN/plugin.json +2 -1
- package/locales/zh-CN/chat.json +20 -0
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-CN/components.json +6 -0
- package/locales/zh-CN/models.json +173 -80
- package/locales/zh-CN/plugin.json +2 -1
- package/locales/zh-TW/chat.json +20 -0
- package/locales/zh-TW/common.json +1 -0
- package/locales/zh-TW/components.json +6 -0
- package/locales/zh-TW/models.json +119 -126
- package/locales/zh-TW/plugin.json +2 -1
- package/package.json +1 -1
- package/packages/agent-runtime/src/core/InterventionChecker.ts +1 -1
- package/packages/agent-runtime/src/core/__tests__/InterventionChecker.test.ts +23 -23
- package/packages/agent-runtime/src/types/state.ts +7 -1
- package/packages/const/src/settings/tool.ts +1 -5
- package/packages/electron-client-ipc/src/types/localSystem.ts +26 -2
- package/packages/file-loaders/src/loaders/docx/index.ts +1 -1
- package/packages/model-bank/src/aiModels/wenxin.ts +1348 -291
- package/packages/model-runtime/src/core/contextBuilders/openai.test.ts +58 -0
- package/packages/model-runtime/src/core/contextBuilders/openai.ts +24 -10
- package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +3 -2
- package/packages/model-runtime/src/providers/openai/index.test.ts +44 -0
- package/packages/model-runtime/src/providers/wenxin/index.ts +22 -1
- package/packages/model-runtime/src/utils/modelParse.ts +6 -0
- package/packages/types/src/tool/builtin.ts +15 -4
- package/packages/types/src/tool/intervention.ts +32 -2
- package/packages/types/src/user/settings/tool.ts +3 -27
- package/src/config/modelProviders/wenxin.ts +2 -3
- package/src/features/Conversation/MarkdownElements/remarkPlugins/__snapshots__/createRemarkSelfClosingTagPlugin.test.ts.snap +133 -0
- package/src/features/Conversation/MarkdownElements/remarkPlugins/createRemarkSelfClosingTagPlugin.test.ts +48 -0
- package/src/features/Conversation/MarkdownElements/remarkPlugins/createRemarkSelfClosingTagPlugin.ts +2 -1
- package/src/features/Conversation/Messages/Assistant/Tool/Render/LoadingPlaceholder/index.tsx +3 -3
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/Fallback.tsx +98 -0
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ModeSelector.tsx +5 -6
- package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/index.tsx +40 -36
- package/src/features/Conversation/Messages/Group/Tool/Render/LoadingPlaceholder/index.tsx +3 -3
- package/src/features/Conversation/Messages/Group/Tool/Render/index.tsx +25 -18
- package/src/features/LocalFile/LocalFile.tsx +55 -5
- package/src/features/PluginsUI/Render/BuiltinType/index.test.tsx +10 -4
- package/src/features/PluginsUI/Render/BuiltinType/index.tsx +2 -2
- package/src/locales/default/components.ts +6 -0
- package/src/locales/default/plugin.ts +2 -1
- package/src/services/chat/chat.test.ts +1 -0
- package/src/services/electron/localFileService.ts +4 -0
- package/src/store/aiInfra/slices/aiProvider/__tests__/selectors.test.ts +62 -0
- package/src/store/aiInfra/slices/aiProvider/selectors.ts +1 -1
- package/src/store/chat/agents/GeneralChatAgent.ts +26 -1
- package/src/store/chat/agents/__tests__/GeneralChatAgent.test.ts +173 -0
- package/src/store/chat/slices/aiChat/actions/conversationControl.ts +8 -40
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +91 -34
- package/src/store/user/selectors.ts +1 -0
- package/src/store/user/slices/settings/action.ts +12 -0
- package/src/store/user/slices/settings/selectors/__snapshots__/settings.test.ts.snap +0 -7
- package/src/store/user/slices/settings/selectors/index.ts +1 -0
- package/src/store/user/slices/settings/selectors/settings.test.ts +0 -37
- package/src/store/user/slices/settings/selectors/settings.ts +0 -5
- package/src/store/user/slices/settings/selectors/toolIntervention.ts +17 -0
- package/src/tools/code-interpreter/Render/index.tsx +1 -1
- package/src/tools/interventions.ts +32 -0
- package/src/tools/local-system/Intervention/RunCommand/index.tsx +56 -0
- package/src/tools/local-system/Placeholder/ListFiles.tsx +3 -5
- package/src/tools/local-system/Placeholder/SearchFiles.tsx +2 -5
- package/src/tools/local-system/Render/ListFiles/index.tsx +16 -21
- package/src/tools/local-system/Render/RenameLocalFile/index.tsx +15 -20
- package/src/tools/local-system/Render/RunCommand/index.tsx +103 -27
- package/src/tools/local-system/Render/SearchFiles/SearchQuery/index.tsx +0 -1
- package/src/tools/local-system/Render/SearchFiles/index.tsx +15 -20
- package/src/tools/local-system/Render/WriteFile/index.tsx +2 -8
- package/src/tools/local-system/index.ts +184 -4
- package/src/tools/local-system/systemRole.ts +62 -8
- package/src/tools/placeholders.ts +39 -8
- package/src/tools/renders.ts +56 -9
- package/src/tools/web-browsing/Placeholder/{PageContent.tsx → CrawlMultiPages.tsx} +4 -1
- package/src/tools/web-browsing/Placeholder/CrawlSinglePage.tsx +12 -0
- package/src/tools/web-browsing/Placeholder/Search.tsx +4 -4
- package/src/tools/web-browsing/Render/CrawlMultiPages.tsx +15 -0
- package/src/tools/web-browsing/Render/CrawlSinglePage.tsx +15 -0
- package/src/tools/web-browsing/Render/Search/index.tsx +39 -44
- package/packages/database/migrations/0044_add_tool_intervention.sql +0 -1
- package/src/tools/local-system/Placeholder/index.tsx +0 -25
- package/src/tools/local-system/Render/index.tsx +0 -40
- package/src/tools/web-browsing/Placeholder/index.tsx +0 -40
- package/src/tools/web-browsing/Render/index.tsx +0 -57
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
import { BuiltinPlaceholder } from '@lobechat/types';
|
|
2
2
|
|
|
3
|
-
import { LocalSystemManifest } from './local-system';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { LocalSystemApiName, LocalSystemManifest } from './local-system';
|
|
4
|
+
import { ListFiles as LocalSystemListFiles } from './local-system/Placeholder/ListFiles';
|
|
5
|
+
import LocalSystemSearchFiles from './local-system/Placeholder/SearchFiles';
|
|
6
|
+
import { WebBrowsingApiName, WebBrowsingManifest } from './web-browsing';
|
|
7
|
+
import CrawlMultiPages from './web-browsing/Placeholder/CrawlMultiPages';
|
|
8
|
+
import CrawlSinglePage from './web-browsing/Placeholder/CrawlSinglePage';
|
|
9
|
+
import { Search } from './web-browsing/Placeholder/Search';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Builtin tools placeholders registry
|
|
13
|
+
* Organized by toolset (identifier) -> API name
|
|
14
|
+
*/
|
|
15
|
+
export const BuiltinToolPlaceholders: Record<string, Record<string, any>> = {
|
|
16
|
+
[LocalSystemManifest.identifier]: {
|
|
17
|
+
[LocalSystemApiName.searchLocalFiles]: LocalSystemSearchFiles,
|
|
18
|
+
[LocalSystemApiName.listLocalFiles]: LocalSystemListFiles,
|
|
19
|
+
},
|
|
20
|
+
[WebBrowsingManifest.identifier]: {
|
|
21
|
+
[WebBrowsingApiName.search]: Search,
|
|
22
|
+
[WebBrowsingApiName.crawlSinglePage]: CrawlSinglePage,
|
|
23
|
+
[WebBrowsingApiName.crawlMultiPages]: CrawlMultiPages,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get builtin placeholder component for a specific API
|
|
29
|
+
* @param identifier - Tool identifier (e.g., 'lobe-local-system')
|
|
30
|
+
* @param apiName - API name (e.g., 'searchLocalFiles')
|
|
31
|
+
*/
|
|
32
|
+
export const getBuiltinPlaceholder = (
|
|
33
|
+
identifier?: string,
|
|
34
|
+
apiName?: string,
|
|
35
|
+
): BuiltinPlaceholder | undefined => {
|
|
36
|
+
if (!identifier || !apiName) return undefined;
|
|
37
|
+
|
|
38
|
+
const toolset = BuiltinToolPlaceholders[identifier];
|
|
39
|
+
if (!toolset) return undefined;
|
|
40
|
+
|
|
41
|
+
return toolset[apiName];
|
|
11
42
|
};
|
package/src/tools/renders.ts
CHANGED
|
@@ -2,13 +2,60 @@ import { BuiltinRender } from '@lobechat/types';
|
|
|
2
2
|
|
|
3
3
|
import { CodeInterpreterManifest } from './code-interpreter';
|
|
4
4
|
import CodeInterpreterRender from './code-interpreter/Render';
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
// local-system
|
|
6
|
+
import { LocalSystemApiName, LocalSystemManifest } from './local-system';
|
|
7
|
+
import ListFiles from './local-system/Render/ListFiles';
|
|
8
|
+
import ReadLocalFile from './local-system/Render/ReadLocalFile';
|
|
9
|
+
import RenameLocalFile from './local-system/Render/RenameLocalFile';
|
|
10
|
+
import RunCommand from './local-system/Render/RunCommand';
|
|
11
|
+
import SearchFiles from './local-system/Render/SearchFiles';
|
|
12
|
+
import WriteFile from './local-system/Render/WriteFile';
|
|
13
|
+
// web-browsing
|
|
14
|
+
import { WebBrowsingApiName, WebBrowsingManifest } from './web-browsing';
|
|
15
|
+
import CrawlMultiPages from './web-browsing/Render/CrawlMultiPages';
|
|
16
|
+
import CrawlSinglePage from './web-browsing/Render/CrawlSinglePage';
|
|
17
|
+
import Search from './web-browsing/Render/Search';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Builtin tools renders registry
|
|
21
|
+
* Organized by toolset (identifier) -> API name
|
|
22
|
+
*/
|
|
23
|
+
const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
|
|
24
|
+
[LocalSystemManifest.identifier]: {
|
|
25
|
+
[LocalSystemApiName.searchLocalFiles]: SearchFiles as BuiltinRender,
|
|
26
|
+
[LocalSystemApiName.listLocalFiles]: ListFiles as BuiltinRender,
|
|
27
|
+
[LocalSystemApiName.readLocalFile]: ReadLocalFile as BuiltinRender,
|
|
28
|
+
[LocalSystemApiName.renameLocalFile]: RenameLocalFile as BuiltinRender,
|
|
29
|
+
[LocalSystemApiName.writeLocalFile]: WriteFile as BuiltinRender,
|
|
30
|
+
[LocalSystemApiName.runCommand]: RunCommand as BuiltinRender,
|
|
31
|
+
},
|
|
32
|
+
[WebBrowsingManifest.identifier]: {
|
|
33
|
+
[WebBrowsingApiName.search]: Search as BuiltinRender,
|
|
34
|
+
[WebBrowsingApiName.crawlSinglePage]: CrawlSinglePage as BuiltinRender,
|
|
35
|
+
[WebBrowsingApiName.crawlMultiPages]: CrawlMultiPages as BuiltinRender,
|
|
36
|
+
},
|
|
37
|
+
[CodeInterpreterManifest.identifier]: {
|
|
38
|
+
python: CodeInterpreterRender as BuiltinRender,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get builtin render component for a specific API
|
|
44
|
+
* @param identifier - Tool identifier (e.g., 'lobe-local-system')
|
|
45
|
+
* @param apiName - API name (e.g., 'searchLocalFiles')
|
|
46
|
+
*/
|
|
47
|
+
export const getBuiltinRender = (
|
|
48
|
+
identifier?: string,
|
|
49
|
+
apiName?: string,
|
|
50
|
+
): BuiltinRender | undefined => {
|
|
51
|
+
if (!identifier) return undefined;
|
|
52
|
+
|
|
53
|
+
const toolset = BuiltinToolsRenders[identifier];
|
|
54
|
+
if (!toolset) return undefined;
|
|
55
|
+
|
|
56
|
+
if (apiName && toolset[apiName]) {
|
|
57
|
+
return toolset[apiName];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return undefined;
|
|
14
61
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { BuiltinPlaceholderProps } from '@lobechat/types';
|
|
3
4
|
import { ScrollShadow } from '@lobehub/ui';
|
|
4
5
|
import { memo } from 'react';
|
|
5
6
|
|
|
@@ -7,7 +8,9 @@ import { useIsMobile } from '@/hooks/useIsMobile';
|
|
|
7
8
|
|
|
8
9
|
import LoadingCard from '../Render/PageContent/Loading';
|
|
9
10
|
|
|
10
|
-
const PageContent = memo<{ urls: string[] }
|
|
11
|
+
const PageContent = memo<BuiltinPlaceholderProps<{ urls: string[] }>>(({ args }) => {
|
|
12
|
+
const urls = args?.urls;
|
|
13
|
+
|
|
11
14
|
const isMobile = useIsMobile();
|
|
12
15
|
|
|
13
16
|
return (
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { BuiltinPlaceholderProps } from '@lobechat/types';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
|
|
6
|
+
import LoadingCard from '../Render/PageContent/Loading';
|
|
7
|
+
|
|
8
|
+
const CrawlSinglePage = memo<BuiltinPlaceholderProps<{ url: string }>>(({ args }) => {
|
|
9
|
+
return <LoadingCard url={args?.url || ''} />;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export default CrawlSinglePage;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BuiltinPlaceholderProps, SearchQuery } from '@lobechat/types';
|
|
1
2
|
import { Icon } from '@lobehub/ui';
|
|
2
3
|
import { Skeleton } from 'antd';
|
|
3
4
|
import { createStyles } from 'antd-style';
|
|
@@ -29,10 +30,9 @@ const useStyles = createStyles(({ css, token, cx }) => ({
|
|
|
29
30
|
),
|
|
30
31
|
}));
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
query
|
|
34
|
-
|
|
35
|
-
export const Search = memo<SearchProps>(({ query }) => {
|
|
33
|
+
export const Search = memo<BuiltinPlaceholderProps<SearchQuery>>(({ args }) => {
|
|
34
|
+
const { query } = args || {};
|
|
35
|
+
|
|
36
36
|
const isMobile = useIsMobile();
|
|
37
37
|
const { styles } = useStyles();
|
|
38
38
|
return (
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BuiltinRenderProps, CrawlMultiPagesQuery, CrawlPluginState } from '@lobechat/types';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import PageContent from './PageContent';
|
|
5
|
+
|
|
6
|
+
const CrawlSinglePage = memo<BuiltinRenderProps<CrawlMultiPagesQuery, CrawlPluginState>>(
|
|
7
|
+
({ messageId, pluginState = {}, args = {} }) => {
|
|
8
|
+
const { results } = pluginState;
|
|
9
|
+
const { urls } = args;
|
|
10
|
+
|
|
11
|
+
return <PageContent messageId={messageId} results={results} urls={urls} />;
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export default CrawlSinglePage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BuiltinRenderProps, CrawlPluginState, CrawlSinglePageQuery } from '@lobechat/types';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
import PageContent from './PageContent';
|
|
5
|
+
|
|
6
|
+
const MultiPages = memo<BuiltinRenderProps<CrawlSinglePageQuery, CrawlPluginState>>(
|
|
7
|
+
({ messageId, pluginState, args }) => {
|
|
8
|
+
const { results } = pluginState || {};
|
|
9
|
+
const { url } = args || {};
|
|
10
|
+
|
|
11
|
+
return <PageContent messageId={messageId} results={results} urls={[url]} />;
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export default MultiPages;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuiltinRenderProps, SearchQuery, UniformSearchResponse } from '@lobechat/types';
|
|
2
2
|
import { Alert, Highlighter } from '@lobehub/ui';
|
|
3
3
|
import { memo, useState } from 'react';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
@@ -7,54 +7,49 @@ import ConfigForm from './ConfigForm';
|
|
|
7
7
|
import SearchQueryView from './SearchQuery';
|
|
8
8
|
import SearchResult from './SearchResult';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
messageId:
|
|
12
|
-
|
|
13
|
-
searchQuery: SearchQuery;
|
|
14
|
-
searchResponse?: UniformSearchResponse;
|
|
15
|
-
}
|
|
10
|
+
const Search = memo<BuiltinRenderProps<SearchQuery, UniformSearchResponse>>(
|
|
11
|
+
({ messageId, args: searchQuery, pluginState: searchResponse, pluginError }) => {
|
|
12
|
+
const [editing, setEditing] = useState(false);
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (pluginError) {
|
|
15
|
+
if (pluginError?.type === 'PluginSettingsInvalid') {
|
|
16
|
+
return <ConfigForm id={messageId} provider={pluginError.body?.provider} />;
|
|
17
|
+
}
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return (
|
|
20
|
+
<Alert
|
|
21
|
+
extra={
|
|
22
|
+
<Flexbox>
|
|
23
|
+
<Highlighter actionIconSize={'small'} language={'json'} variant={'borderless'}>
|
|
24
|
+
{JSON.stringify(pluginError.body?.data || pluginError.body, null, 2)}
|
|
25
|
+
</Highlighter>
|
|
26
|
+
</Flexbox>
|
|
27
|
+
}
|
|
28
|
+
message={pluginError?.message}
|
|
29
|
+
type={'error'}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
return (
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
<Flexbox gap={8}>
|
|
36
|
+
<SearchQueryView
|
|
37
|
+
args={searchQuery}
|
|
38
|
+
editing={editing}
|
|
39
|
+
messageId={messageId}
|
|
40
|
+
pluginState={searchResponse}
|
|
41
|
+
setEditing={setEditing}
|
|
42
|
+
/>
|
|
43
|
+
<SearchResult
|
|
44
|
+
args={searchQuery}
|
|
45
|
+
editing={editing}
|
|
46
|
+
messageId={messageId}
|
|
47
|
+
pluginState={searchResponse}
|
|
48
|
+
setEditing={setEditing}
|
|
49
|
+
/>
|
|
50
|
+
</Flexbox>
|
|
37
51
|
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Flexbox gap={8}>
|
|
42
|
-
<SearchQueryView
|
|
43
|
-
args={searchQuery}
|
|
44
|
-
editing={editing}
|
|
45
|
-
messageId={messageId}
|
|
46
|
-
pluginState={searchResponse}
|
|
47
|
-
setEditing={setEditing}
|
|
48
|
-
/>
|
|
49
|
-
<SearchResult
|
|
50
|
-
args={searchQuery}
|
|
51
|
-
editing={editing}
|
|
52
|
-
messageId={messageId}
|
|
53
|
-
pluginState={searchResponse}
|
|
54
|
-
setEditing={setEditing}
|
|
55
|
-
/>
|
|
56
|
-
</Flexbox>
|
|
57
|
-
);
|
|
58
|
-
});
|
|
52
|
+
},
|
|
53
|
+
);
|
|
59
54
|
|
|
60
55
|
export default Search;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE "message_plugins" ADD COLUMN "intervention" jsonb;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BuiltinPlaceholderProps } from '@lobechat/types';
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
|
|
4
|
-
import { LocalSystemApiName } from '@/tools/local-system';
|
|
5
|
-
|
|
6
|
-
import ReadLocalFile from '../Render/ReadLocalFile/ReadFileSkeleton';
|
|
7
|
-
import { ListFiles } from './ListFiles';
|
|
8
|
-
import SearchFiles from './SearchFiles';
|
|
9
|
-
|
|
10
|
-
const RenderMap = {
|
|
11
|
-
[LocalSystemApiName.searchLocalFiles]: SearchFiles,
|
|
12
|
-
[LocalSystemApiName.listLocalFiles]: ListFiles,
|
|
13
|
-
[LocalSystemApiName.readLocalFile]: ReadLocalFile,
|
|
14
|
-
// [LocalSystemApiName.renameLocalFile]: RenameLocalFile,
|
|
15
|
-
// [LocalSystemApiName.writeLocalFile]: WriteFile,
|
|
16
|
-
};
|
|
17
|
-
const Placeholder = memo<BuiltinPlaceholderProps>(({ apiName, args }) => {
|
|
18
|
-
const Render = RenderMap[apiName as any];
|
|
19
|
-
|
|
20
|
-
if (!Render) return;
|
|
21
|
-
|
|
22
|
-
return <Render args={(args || {}) as any} />;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export default Placeholder;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { LocalFileItem } from '@lobechat/electron-client-ipc';
|
|
2
|
-
import { BuiltinRenderProps } from '@lobechat/types';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
import { LocalSystemApiName } from '@/tools/local-system';
|
|
6
|
-
|
|
7
|
-
import ListFiles from './ListFiles';
|
|
8
|
-
import ReadLocalFile from './ReadLocalFile';
|
|
9
|
-
import RenameLocalFile from './RenameLocalFile';
|
|
10
|
-
import SearchFiles from './SearchFiles';
|
|
11
|
-
import WriteFile from './WriteFile';
|
|
12
|
-
|
|
13
|
-
const RenderMap = {
|
|
14
|
-
[LocalSystemApiName.searchLocalFiles]: SearchFiles,
|
|
15
|
-
[LocalSystemApiName.listLocalFiles]: ListFiles,
|
|
16
|
-
[LocalSystemApiName.readLocalFile]: ReadLocalFile,
|
|
17
|
-
[LocalSystemApiName.renameLocalFile]: RenameLocalFile,
|
|
18
|
-
[LocalSystemApiName.writeLocalFile]: WriteFile,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const LocalFilesRender = memo<BuiltinRenderProps<LocalFileItem[]>>(
|
|
22
|
-
({ pluginState, apiName, messageId, pluginError, args }) => {
|
|
23
|
-
const Render = RenderMap[apiName as any];
|
|
24
|
-
|
|
25
|
-
if (!Render) return;
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Render
|
|
29
|
-
args={args}
|
|
30
|
-
messageId={messageId}
|
|
31
|
-
pluginError={pluginError}
|
|
32
|
-
pluginState={pluginState}
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
LocalFilesRender.displayName = 'LocalFilesRender';
|
|
39
|
-
|
|
40
|
-
export default LocalFilesRender;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BuiltinPlaceholderProps,
|
|
3
|
-
CrawlMultiPagesQuery,
|
|
4
|
-
CrawlSinglePageQuery,
|
|
5
|
-
SearchQuery,
|
|
6
|
-
} from '@lobechat/types';
|
|
7
|
-
import { Skeleton } from 'antd';
|
|
8
|
-
import { memo } from 'react';
|
|
9
|
-
|
|
10
|
-
import { WebBrowsingApiName } from '@/tools/web-browsing';
|
|
11
|
-
|
|
12
|
-
import PageContent from './PageContent';
|
|
13
|
-
import { Search } from './Search';
|
|
14
|
-
|
|
15
|
-
const Placeholder = memo<BuiltinPlaceholderProps>(({ apiName, args }) => {
|
|
16
|
-
switch (apiName) {
|
|
17
|
-
case WebBrowsingApiName.search: {
|
|
18
|
-
const { query } = args as SearchQuery;
|
|
19
|
-
return <Search query={query} />;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
case WebBrowsingApiName.crawlSinglePage: {
|
|
23
|
-
const { url } = args as CrawlSinglePageQuery;
|
|
24
|
-
|
|
25
|
-
return <PageContent urls={[url]} />;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
case WebBrowsingApiName.crawlMultiPages: {
|
|
29
|
-
const { urls } = args as CrawlMultiPagesQuery;
|
|
30
|
-
|
|
31
|
-
return <PageContent urls={urls} />;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
default: {
|
|
35
|
-
return <Skeleton.Button />;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export default Placeholder;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BuiltinRenderProps,
|
|
3
|
-
CrawlMultiPagesQuery,
|
|
4
|
-
CrawlPluginState,
|
|
5
|
-
CrawlSinglePageQuery,
|
|
6
|
-
SearchContent,
|
|
7
|
-
SearchQuery,
|
|
8
|
-
UniformSearchResponse,
|
|
9
|
-
} from '@lobechat/types';
|
|
10
|
-
import { memo } from 'react';
|
|
11
|
-
|
|
12
|
-
import { WebBrowsingApiName } from '@/tools/web-browsing';
|
|
13
|
-
import PageContent from '@/tools/web-browsing/Render/PageContent';
|
|
14
|
-
|
|
15
|
-
import Search from './Search';
|
|
16
|
-
|
|
17
|
-
const WebBrowsing = memo<BuiltinRenderProps<SearchContent[]>>(
|
|
18
|
-
({ messageId, args, pluginState, pluginError, apiName }) => {
|
|
19
|
-
switch (apiName) {
|
|
20
|
-
case WebBrowsingApiName.search:
|
|
21
|
-
case 'searchWithSearXNG': {
|
|
22
|
-
return (
|
|
23
|
-
<Search
|
|
24
|
-
messageId={messageId}
|
|
25
|
-
pluginError={pluginError}
|
|
26
|
-
searchQuery={(args as SearchQuery) || {}}
|
|
27
|
-
searchResponse={pluginState as UniformSearchResponse}
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
case WebBrowsingApiName.crawlSinglePage: {
|
|
33
|
-
return (
|
|
34
|
-
<PageContent
|
|
35
|
-
messageId={messageId}
|
|
36
|
-
results={(pluginState as CrawlPluginState)?.results}
|
|
37
|
-
urls={[(args as CrawlSinglePageQuery)?.url]}
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
case WebBrowsingApiName.crawlMultiPages: {
|
|
43
|
-
return (
|
|
44
|
-
<PageContent
|
|
45
|
-
messageId={messageId}
|
|
46
|
-
results={(pluginState as CrawlPluginState)?.results}
|
|
47
|
-
urls={(args as CrawlMultiPagesQuery)?.urls}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
WebBrowsing.displayName = 'WebBrowsing';
|
|
56
|
-
|
|
57
|
-
export default WebBrowsing;
|