@lobehub/chat 1.66.5 → 1.67.0
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/changelog/v1.json +18 -0
- package/locales/ar/models.json +9 -3
- package/locales/ar/plugin.json +12 -0
- package/locales/bg-BG/models.json +9 -3
- package/locales/bg-BG/plugin.json +12 -0
- package/locales/de-DE/models.json +9 -3
- package/locales/de-DE/plugin.json +12 -0
- package/locales/en-US/models.json +9 -3
- package/locales/en-US/plugin.json +12 -0
- package/locales/es-ES/models.json +9 -3
- package/locales/es-ES/plugin.json +12 -0
- package/locales/fa-IR/models.json +9 -3
- package/locales/fa-IR/plugin.json +12 -0
- package/locales/fr-FR/models.json +9 -3
- package/locales/fr-FR/plugin.json +12 -0
- package/locales/it-IT/models.json +9 -3
- package/locales/it-IT/plugin.json +12 -0
- package/locales/ja-JP/models.json +9 -3
- package/locales/ja-JP/plugin.json +12 -0
- package/locales/ko-KR/models.json +9 -3
- package/locales/ko-KR/plugin.json +12 -0
- package/locales/nl-NL/models.json +9 -3
- package/locales/nl-NL/plugin.json +12 -0
- package/locales/pl-PL/models.json +9 -3
- package/locales/pl-PL/plugin.json +12 -0
- package/locales/pt-BR/models.json +9 -3
- package/locales/pt-BR/plugin.json +12 -0
- package/locales/ru-RU/models.json +9 -3
- package/locales/ru-RU/plugin.json +12 -0
- package/locales/tr-TR/models.json +9 -3
- package/locales/tr-TR/plugin.json +12 -0
- package/locales/vi-VN/models.json +9 -3
- package/locales/vi-VN/plugin.json +12 -0
- package/locales/zh-CN/models.json +9 -3
- package/locales/zh-CN/plugin.json +12 -0
- package/locales/zh-TW/models.json +9 -3
- package/locales/zh-TW/plugin.json +12 -0
- package/package.json +10 -6
- package/packages/web-crawler/README.md +34 -0
- package/packages/web-crawler/package.json +13 -0
- package/packages/web-crawler/src/crawImpl/browserless.ts +62 -0
- package/packages/web-crawler/src/crawImpl/index.ts +11 -0
- package/packages/web-crawler/src/crawImpl/jina.ts +37 -0
- package/packages/web-crawler/src/crawImpl/naive.ts +84 -0
- package/packages/web-crawler/src/crawler.ts +66 -0
- package/packages/web-crawler/src/index.ts +2 -0
- package/packages/web-crawler/src/type.ts +42 -0
- package/packages/web-crawler/src/urlRules.ts +34 -0
- package/packages/web-crawler/src/utils/__snapshots__/htmlToMarkdown.test.ts.snap +638 -0
- package/packages/web-crawler/src/utils/appUrlRules.test.ts +26 -0
- package/packages/web-crawler/src/utils/appUrlRules.ts +40 -0
- package/packages/web-crawler/src/utils/errorType.ts +12 -0
- package/packages/web-crawler/src/utils/html/terms.html +1222 -0
- package/packages/web-crawler/src/utils/html/yingchao.html +1001 -0
- package/packages/web-crawler/src/utils/htmlToMarkdown.test.ts +35 -0
- package/packages/web-crawler/src/utils/htmlToMarkdown.ts +45 -0
- package/packages/web-crawler/tsconfig.json +20 -0
- package/pnpm-workspace.yaml +3 -0
- package/src/config/aiModels/openai.ts +29 -5
- package/src/database/server/models/__tests__/message.test.ts +2 -2
- package/src/features/Conversation/Messages/Assistant/Tool/Render/CustomRender.tsx +4 -35
- package/src/features/Conversation/Messages/Assistant/Tool/Render/index.tsx +1 -1
- package/src/features/PluginsUI/Render/BuiltinType/index.tsx +3 -0
- package/src/features/PluginsUI/Render/index.tsx +1 -0
- package/src/features/Portal/Plugins/Body/ToolRender.tsx +1 -0
- package/src/locales/default/plugin.ts +12 -0
- package/src/server/routers/tools/search.ts +23 -0
- package/src/services/search.ts +8 -0
- package/src/store/chat/slices/builtinTool/actions/searXNG.ts +50 -0
- package/src/store/chat/slices/builtinTool/initialState.ts +1 -0
- package/src/tools/web-browsing/Portal/PageContent/index.tsx +190 -0
- package/src/tools/web-browsing/Portal/PageContents/index.tsx +23 -0
- package/src/tools/web-browsing/Portal/{ResultList → Search/ResultList}/SearchItem/Video.tsx +1 -1
- package/src/tools/web-browsing/Portal/Search/index.tsx +69 -0
- package/src/tools/web-browsing/Portal/index.tsx +28 -64
- package/src/tools/web-browsing/Render/PageContent/Loading.tsx +57 -0
- package/src/tools/web-browsing/Render/PageContent/Result.tsx +142 -0
- package/src/tools/web-browsing/Render/PageContent/index.tsx +41 -0
- package/src/tools/web-browsing/Render/{SearchQuery → Search/SearchQuery}/SearchView.tsx +1 -1
- package/src/tools/web-browsing/Render/{SearchQuery → Search/SearchQuery}/index.tsx +1 -1
- package/src/tools/web-browsing/Render/{SearchResult → Search/SearchResult}/ShowMore.tsx +1 -1
- package/src/tools/web-browsing/Render/Search/index.tsx +62 -0
- package/src/tools/web-browsing/Render/index.tsx +35 -44
- package/src/tools/web-browsing/index.ts +43 -47
- package/src/tools/web-browsing/systemRole.ts +109 -0
- package/src/types/tool/builtin.ts +2 -0
- package/src/types/tool/crawler.ts +19 -0
- package/src/types/tool/search.ts +1 -0
- /package/src/tools/web-browsing/Portal/{Footer.tsx → Search/Footer.tsx} +0 -0
- /package/src/tools/web-browsing/Portal/{ResultList → Search/ResultList}/SearchItem/CategoryAvatar.tsx +0 -0
- /package/src/tools/web-browsing/Portal/{ResultList → Search/ResultList}/SearchItem/TitleExtra.tsx +0 -0
- /package/src/tools/web-browsing/Portal/{ResultList → Search/ResultList}/SearchItem/index.tsx +0 -0
- /package/src/tools/web-browsing/Portal/{ResultList → Search/ResultList}/index.tsx +0 -0
- /package/src/tools/web-browsing/Render/{ConfigForm → Search/ConfigForm}/Form.tsx +0 -0
- /package/src/tools/web-browsing/Render/{ConfigForm → Search/ConfigForm}/SearchXNGIcon.tsx +0 -0
- /package/src/tools/web-browsing/Render/{ConfigForm → Search/ConfigForm}/index.tsx +0 -0
- /package/src/tools/web-browsing/Render/{ConfigForm → Search/ConfigForm}/style.tsx +0 -0
- /package/src/tools/web-browsing/Render/{SearchResult → Search/SearchResult}/SearchResultItem.tsx +0 -0
- /package/src/tools/web-browsing/Render/{SearchResult → Search/SearchResult}/index.tsx +0 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
import { Alert, Highlighter } from '@lobehub/ui';
|
2
|
+
import { memo, useState } from 'react';
|
3
|
+
import { Flexbox } from 'react-layout-kit';
|
4
|
+
|
5
|
+
import { ChatMessagePluginError } from '@/types/message';
|
6
|
+
import { SearchQuery, SearchResponse } from '@/types/tool/search';
|
7
|
+
|
8
|
+
import ConfigForm from './ConfigForm';
|
9
|
+
import SearchQueryView from './SearchQuery';
|
10
|
+
import SearchResult from './SearchResult';
|
11
|
+
|
12
|
+
interface SearchProps {
|
13
|
+
messageId: string;
|
14
|
+
pluginError: ChatMessagePluginError;
|
15
|
+
searchQuery: SearchQuery;
|
16
|
+
searchResponse?: SearchResponse;
|
17
|
+
}
|
18
|
+
|
19
|
+
const Search = memo<SearchProps>(({ messageId, searchQuery, searchResponse, pluginError }) => {
|
20
|
+
const [editing, setEditing] = useState(false);
|
21
|
+
|
22
|
+
if (pluginError) {
|
23
|
+
if (pluginError?.type === 'PluginSettingsInvalid') {
|
24
|
+
return <ConfigForm id={messageId} provider={pluginError.body?.provider} />;
|
25
|
+
}
|
26
|
+
|
27
|
+
return (
|
28
|
+
<Alert
|
29
|
+
extra={
|
30
|
+
<Flexbox>
|
31
|
+
<Highlighter copyButtonSize={'small'} language={'json'} type={'pure'}>
|
32
|
+
{JSON.stringify(pluginError.body?.data || pluginError.body, null, 2)}
|
33
|
+
</Highlighter>
|
34
|
+
</Flexbox>
|
35
|
+
}
|
36
|
+
message={pluginError?.message}
|
37
|
+
type={'error'}
|
38
|
+
/>
|
39
|
+
);
|
40
|
+
}
|
41
|
+
|
42
|
+
return (
|
43
|
+
<Flexbox gap={8}>
|
44
|
+
<SearchQueryView
|
45
|
+
args={searchQuery}
|
46
|
+
editing={editing}
|
47
|
+
messageId={messageId}
|
48
|
+
pluginState={searchResponse}
|
49
|
+
setEditing={setEditing}
|
50
|
+
/>
|
51
|
+
<SearchResult
|
52
|
+
args={searchQuery}
|
53
|
+
editing={editing}
|
54
|
+
messageId={messageId}
|
55
|
+
pluginState={searchResponse}
|
56
|
+
setEditing={setEditing}
|
57
|
+
/>
|
58
|
+
</Flexbox>
|
59
|
+
);
|
60
|
+
});
|
61
|
+
|
62
|
+
export default Search;
|
@@ -1,56 +1,47 @@
|
|
1
|
-
import {
|
2
|
-
import { memo, useState } from 'react';
|
3
|
-
import { Flexbox } from 'react-layout-kit';
|
1
|
+
import { memo } from 'react';
|
4
2
|
|
3
|
+
import { WebBrowsingApiName } from '@/tools/web-browsing';
|
4
|
+
import PageContent from '@/tools/web-browsing/Render/PageContent';
|
5
5
|
import { BuiltinRenderProps } from '@/types/tool';
|
6
|
+
import { CrawlMultiPagesQuery, CrawlPluginState, CrawlSinglePageQuery } from '@/types/tool/crawler';
|
6
7
|
import { SearchContent, SearchQuery, SearchResponse } from '@/types/tool/search';
|
7
8
|
|
8
|
-
import
|
9
|
-
import SearchQueryView from './SearchQuery';
|
10
|
-
import SearchResult from './SearchResult';
|
9
|
+
import Search from './Search';
|
11
10
|
|
12
|
-
const WebBrowsing = memo<BuiltinRenderProps<SearchContent[]
|
13
|
-
({ messageId, args, pluginState, pluginError }) => {
|
14
|
-
|
11
|
+
const WebBrowsing = memo<BuiltinRenderProps<SearchContent[]>>(
|
12
|
+
({ messageId, args, pluginState, pluginError, apiName }) => {
|
13
|
+
switch (apiName) {
|
14
|
+
case WebBrowsingApiName.searchWithSearXNG: {
|
15
|
+
return (
|
16
|
+
<Search
|
17
|
+
messageId={messageId}
|
18
|
+
pluginError={pluginError}
|
19
|
+
searchQuery={args as SearchQuery}
|
20
|
+
searchResponse={pluginState as SearchResponse}
|
21
|
+
/>
|
22
|
+
);
|
23
|
+
}
|
15
24
|
|
16
|
-
|
17
|
-
|
18
|
-
|
25
|
+
case WebBrowsingApiName.crawlSinglePage: {
|
26
|
+
return (
|
27
|
+
<PageContent
|
28
|
+
messageId={messageId}
|
29
|
+
results={(pluginState as CrawlPluginState)?.results}
|
30
|
+
urls={[(args as CrawlSinglePageQuery).url]}
|
31
|
+
/>
|
32
|
+
);
|
19
33
|
}
|
20
34
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
message={pluginError?.message}
|
31
|
-
type={'error'}
|
32
|
-
/>
|
33
|
-
);
|
35
|
+
case WebBrowsingApiName.crawlMultiPages: {
|
36
|
+
return (
|
37
|
+
<PageContent
|
38
|
+
messageId={messageId}
|
39
|
+
results={(pluginState as CrawlPluginState)?.results}
|
40
|
+
urls={(args as CrawlMultiPagesQuery).urls}
|
41
|
+
/>
|
42
|
+
);
|
43
|
+
}
|
34
44
|
}
|
35
|
-
|
36
|
-
return (
|
37
|
-
<Flexbox gap={8}>
|
38
|
-
<SearchQueryView
|
39
|
-
args={args}
|
40
|
-
editing={editing}
|
41
|
-
messageId={messageId}
|
42
|
-
pluginState={pluginState}
|
43
|
-
setEditing={setEditing}
|
44
|
-
/>
|
45
|
-
<SearchResult
|
46
|
-
args={args}
|
47
|
-
editing={editing}
|
48
|
-
messageId={messageId}
|
49
|
-
pluginState={pluginState}
|
50
|
-
setEditing={setEditing}
|
51
|
-
/>
|
52
|
-
</Flexbox>
|
53
|
-
);
|
54
45
|
},
|
55
46
|
);
|
56
47
|
|
@@ -2,12 +2,20 @@ import dayjs from 'dayjs';
|
|
2
2
|
|
3
3
|
import { BuiltinToolManifest } from '@/types/tool';
|
4
4
|
|
5
|
+
import { systemPrompt } from './systemRole';
|
6
|
+
|
7
|
+
export const WebBrowsingApiName = {
|
8
|
+
crawlMultiPages: 'crawlMultiPages',
|
9
|
+
crawlSinglePage: 'crawlSinglePage',
|
10
|
+
searchWithSearXNG: 'searchWithSearXNG',
|
11
|
+
};
|
12
|
+
|
5
13
|
export const WebBrowsingManifest: BuiltinToolManifest = {
|
6
14
|
api: [
|
7
15
|
{
|
8
16
|
description:
|
9
17
|
'A meta search engine. Useful for when you need to answer questions about current events. Input should be a search query. Output is a JSON array of the query results',
|
10
|
-
name:
|
18
|
+
name: WebBrowsingApiName.searchWithSearXNG,
|
11
19
|
parameters: {
|
12
20
|
properties: {
|
13
21
|
query: {
|
@@ -46,57 +54,45 @@ export const WebBrowsingManifest: BuiltinToolManifest = {
|
|
46
54
|
type: 'object',
|
47
55
|
},
|
48
56
|
},
|
57
|
+
{
|
58
|
+
description:
|
59
|
+
'A crawler can visit page content. Output is a JSON object of title, content, url and website',
|
60
|
+
name: WebBrowsingApiName.crawlSinglePage,
|
61
|
+
parameters: {
|
62
|
+
properties: {
|
63
|
+
url: {
|
64
|
+
description: 'The url need to be crawled',
|
65
|
+
type: 'string',
|
66
|
+
},
|
67
|
+
},
|
68
|
+
required: ['url'],
|
69
|
+
type: 'object',
|
70
|
+
},
|
71
|
+
},
|
72
|
+
{
|
73
|
+
description:
|
74
|
+
'A crawler can visit multi pages. If need to visit multi website, use this one. Output is an array of JSON object of title, content, url and website',
|
75
|
+
name: WebBrowsingApiName.crawlMultiPages,
|
76
|
+
parameters: {
|
77
|
+
properties: {
|
78
|
+
urls: {
|
79
|
+
items: {
|
80
|
+
description: 'The url need to be crawled',
|
81
|
+
type: 'string',
|
82
|
+
},
|
83
|
+
type: 'array',
|
84
|
+
},
|
85
|
+
},
|
86
|
+
required: ['urls'],
|
87
|
+
type: 'object',
|
88
|
+
},
|
89
|
+
},
|
49
90
|
],
|
50
91
|
identifier: 'lobe-web-browsing',
|
51
92
|
meta: {
|
52
93
|
avatar: '🌐',
|
53
94
|
title: 'Web Browsing',
|
54
95
|
},
|
55
|
-
systemRole:
|
56
|
-
|
57
|
-
SearXNG combine with these engines:
|
58
|
-
- Google: The world's most popular search engine, offering a wide range of general web results.,
|
59
|
-
- Bilibili: A Chinese video sharing website themed around animation, comic, and games (ACG) ,(又名 B 站),
|
60
|
-
- Bing: Microsoft's search engine, providing web results with a focus on visual search.,
|
61
|
-
- DuckDuckGo: A privacy-focused search engine that doesn't track users.,
|
62
|
-
- npm: The package manager for JavaScript, used to find Node.js packages.,
|
63
|
-
- PyPI: The Python Package Index, used to find Python packages.,
|
64
|
-
- GitHub: A platform for version control and collaboration, search for code repositories.,
|
65
|
-
- arXiv: A repository of electronic preprints for scientific papers.,
|
66
|
-
- Google Scholar: A freely accessible web search engine for scholarly literature.,
|
67
|
-
- Z-Library: A shadow library project for file-sharing access to scholarly journal articles and books.,
|
68
|
-
- Reddit: A network of communities based on people's interests, search for discussions and content.,
|
69
|
-
- IMDb: An online database of information related to films, TV programs, and video games.,
|
70
|
-
- Brave: A privacy-focused browser with its own search engine.,
|
71
|
-
- Wikipedia: A free online encyclopedia, search for articles on various topics.,
|
72
|
-
- Pinterest: An image sharing and social media service, search for images and ideas.,
|
73
|
-
- Unsplash: A website dedicated to sharing stock photography, search for high-quality images.,
|
74
|
-
- Vimeo: A video hosting, sharing, and services platform.,
|
75
|
-
- YouTube: A video sharing platform, search for a wide variety of video content.
|
76
|
-
|
77
|
-
SearXNG comes with a search syntax by with you can modify the categories, engines, languages and more.
|
78
|
-
|
79
|
-
## \`!\` select engine and category
|
80
|
-
|
81
|
-
To set category and/or engine names use a \`!\` prefix. To give a few examples:
|
82
|
-
|
83
|
-
- search in category **map** for **paris**
|
84
|
-
- \`!map paris\`
|
85
|
-
- image search
|
86
|
-
- \`!images Wau Holland\`
|
87
|
-
|
88
|
-
Abbreviations of the engines and languages are also accepted. Engine/category modifiers are chain able and inclusive. E.g. with \`!map !ddg !wp paris\` search in map category and DuckDuckGo and Wikipedia for **paris**.
|
89
|
-
|
90
|
-
## \`:\` select language
|
91
|
-
|
92
|
-
To select language filter use a \`:\` prefix. To give an example:
|
93
|
-
|
94
|
-
- search Wikipedia by a custom language
|
95
|
-
- \`:fr !wp Wau Holland\`
|
96
|
-
|
97
|
-
You need to summarize in the language of the user's question. If you use search content in your reply, you must use Markdown footnote format to indicate the source, Such as [^1].
|
98
|
-
|
99
|
-
current date: ${dayjs(new Date()).format('YYYY-MM-DD')}
|
100
|
-
`,
|
96
|
+
systemRole: systemPrompt(dayjs(new Date()).format('YYYY-MM-DD')),
|
101
97
|
type: 'builtin',
|
102
98
|
};
|
@@ -0,0 +1,109 @@
|
|
1
|
+
export const systemPrompt = (
|
2
|
+
date: string,
|
3
|
+
) => `You have a Web Information tool with powerful internet access capabilities. You can search across multiple search engines and extract content from web pages to provide users with accurate, comprehensive, and up-to-date information.
|
4
|
+
|
5
|
+
<core_capabilities>
|
6
|
+
1. Search the web using multiple search engines (searchWithSearXNG)
|
7
|
+
2. Retrieve content from a specific webpage (crawlSinglePage)
|
8
|
+
3. Retrieve content from multiple webpages simultaneously (crawlMultiPages)
|
9
|
+
</core_capabilities>
|
10
|
+
|
11
|
+
<workflow>
|
12
|
+
1. Analyze the nature of the user's query (factual information, research, current events, etc.)
|
13
|
+
2. Select the appropriate tool and search strategy based on the query type
|
14
|
+
3. Execute searches or crawl operations to gather relevant information
|
15
|
+
4. Synthesize information with proper attribution of sources
|
16
|
+
5. Present findings in a clear, organized manner with appropriate citations
|
17
|
+
</workflow>
|
18
|
+
|
19
|
+
<tool_selection_guidelines>
|
20
|
+
- For general information queries: Use searchWithSearXNG with the most relevant search engines
|
21
|
+
- For detailed understanding of specific single page content: Use 'crawlSinglePage' on the most authoritative or relevant page from search results. If you need to visit multiple pages, prefer to use 'crawlMultiPages'
|
22
|
+
- For multi-perspective information or comparative analysis: Use 'crawlMultiPages' on several different relevant sources
|
23
|
+
</tool_selection_guidelines>
|
24
|
+
|
25
|
+
<search_engine_selection>
|
26
|
+
Choose search engines based on the query type:
|
27
|
+
- General knowledge: google, bing, duckduckgo, brave, wikipedia
|
28
|
+
- Academic/scientific information: google scholar, arxiv, z-library
|
29
|
+
- Code/technical queries: google, github, npm, pypi
|
30
|
+
- Videos: youtube, vimeo, bilibili
|
31
|
+
- Images: unsplash, pinterest
|
32
|
+
- Entertainment: imdb, reddit
|
33
|
+
- For region-specific information, prefer search engines popular in that region
|
34
|
+
</search_engine_selection>
|
35
|
+
|
36
|
+
<citation_requirements>
|
37
|
+
- Always cite sources using markdown footnote format (e.g., [^1])
|
38
|
+
- List all referenced URLs at the end of your response
|
39
|
+
- Clearly distinguish between quoted information and your own analysis
|
40
|
+
- Respond in the same language as the user's query
|
41
|
+
</citation_requirements>
|
42
|
+
|
43
|
+
<response_format>
|
44
|
+
When providing information from web searches:
|
45
|
+
1. Start with a direct answer to the user's question when possible
|
46
|
+
2. Provide relevant details from sources
|
47
|
+
3. Include proper citations using footnotes
|
48
|
+
4. List all sources at the end of your response
|
49
|
+
5. For time-sensitive information, note when the information was retrieved
|
50
|
+
|
51
|
+
Example:
|
52
|
+
|
53
|
+
According to recent studies, global temperatures have risen by 1.1°C since pre-industrial times[^1].
|
54
|
+
|
55
|
+
[^1]: [Climate Report in 2023](https://example.org/climate-report-2023)
|
56
|
+
</response_format>
|
57
|
+
|
58
|
+
<searxng_description>
|
59
|
+
SearXNG is a metasearch engine that can leverage multiple search engines including:
|
60
|
+
- Google: World's most popular search engine providing broad web results
|
61
|
+
- Bilibili: Chinese video sharing website focused on animation, comics, and games (aka B-site)
|
62
|
+
- Bing: Microsoft's search engine providing web results with emphasis on visual search
|
63
|
+
- DuckDuckGo: Privacy-focused search engine that doesn't track users
|
64
|
+
- npm: JavaScript package manager for finding Node.js packages
|
65
|
+
- PyPI: Python Package Index for finding Python packages
|
66
|
+
- GitHub: Version control and collaboration platform for searching code repositories
|
67
|
+
- arXiv: Repository of electronic preprints of scientific papers
|
68
|
+
- Google Scholar: Free web search engine for scholarly literature
|
69
|
+
- Z-Library: File-sharing project for journal articles and books
|
70
|
+
- Reddit: Network of communities based on people's interests
|
71
|
+
- IMDb: Online database related to films, TV programs, and video games
|
72
|
+
- Brave: Privacy-focused browser with its own search engine
|
73
|
+
- Wikipedia: Free online encyclopedia with articles on various topics
|
74
|
+
- Pinterest: Image sharing and social media service for finding images
|
75
|
+
- Unsplash: Website dedicated to sharing high-quality stock photography
|
76
|
+
- Vimeo: Video hosting, sharing, and service platform
|
77
|
+
- YouTube: Video sharing platform for searching various video content
|
78
|
+
|
79
|
+
<search_syntax>
|
80
|
+
SearXNG has special search syntax to modify the categories, engines, and language of searches:
|
81
|
+
|
82
|
+
1. Use \`!\` to select engines and categories:
|
83
|
+
- Search for "paris" in the "map" category: \`!map paris\`
|
84
|
+
- Search for images: \`!images Wau Holland\`
|
85
|
+
- Chain multiple modifiers: \`!map !ddg !wp paris\` (searches for "paris" in the map category, DuckDuckGo, and Wikipedia)
|
86
|
+
|
87
|
+
2. Use \`:\` to select language:
|
88
|
+
- Search Wikipedia in a specific language: \`:fr !wp Wau Holland\` (uses French)
|
89
|
+
</search_syntax>
|
90
|
+
</searxng_description>
|
91
|
+
|
92
|
+
<crawling_best_practices>
|
93
|
+
- Only crawl pages that are publicly accessible
|
94
|
+
- When crawling multiple pages, crawl all relevant sources
|
95
|
+
- Prioritize authoritative sources over user-generated content when appropriate
|
96
|
+
- For controversial topics, crawl sources representing different perspectives
|
97
|
+
- Verify information across multiple sources when possible
|
98
|
+
- Consider the recency of information, especially for time-sensitive topics
|
99
|
+
</crawling_best_practices>
|
100
|
+
|
101
|
+
<error_handling>
|
102
|
+
- If search returns no results, try alternative search terms or engines
|
103
|
+
- If a page cannot be crawled, explain the issue to the user and suggest alternatives
|
104
|
+
- For ambiguous queries, ask for clarification before conducting extensive searches
|
105
|
+
- If information seems outdated, note this to the user and suggest searching for more recent sources
|
106
|
+
</error_handling>
|
107
|
+
|
108
|
+
Current date: ${date}
|
109
|
+
`;
|
@@ -29,6 +29,7 @@ export interface LobeBuiltinTool {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
export interface BuiltinRenderProps<Content = any, Arguments = any, State = any> {
|
32
|
+
apiName?: string;
|
32
33
|
args: Arguments;
|
33
34
|
content: Content;
|
34
35
|
identifier?: string;
|
@@ -40,6 +41,7 @@ export interface BuiltinRenderProps<Content = any, Arguments = any, State = any>
|
|
40
41
|
export type BuiltinRender = <T = any>(props: BuiltinRenderProps<T>) => ReactNode;
|
41
42
|
|
42
43
|
export interface BuiltinPortalProps<Arguments = Record<string, any>, State = any> {
|
44
|
+
apiName?: string;
|
43
45
|
arguments: Arguments;
|
44
46
|
identifier: string;
|
45
47
|
messageId: string;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { CrawlSuccessResult } from '@lobechat/web-crawler';
|
2
|
+
|
3
|
+
export interface CrawlSinglePageQuery {
|
4
|
+
url: string;
|
5
|
+
}
|
6
|
+
|
7
|
+
export interface CrawlMultiPagesQuery {
|
8
|
+
urls: string[];
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface CrawlResult {
|
12
|
+
crawler: string;
|
13
|
+
data: CrawlSuccessResult;
|
14
|
+
originalUrl: string;
|
15
|
+
}
|
16
|
+
|
17
|
+
export interface CrawlPluginState {
|
18
|
+
results: CrawlResult[];
|
19
|
+
}
|
package/src/types/tool/search.ts
CHANGED
File without changes
|
File without changes
|
/package/src/tools/web-browsing/Portal/{ResultList → Search/ResultList}/SearchItem/TitleExtra.tsx
RENAMED
File without changes
|
/package/src/tools/web-browsing/Portal/{ResultList → Search/ResultList}/SearchItem/index.tsx
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/package/src/tools/web-browsing/Render/{SearchResult → Search/SearchResult}/SearchResultItem.tsx
RENAMED
File without changes
|
File without changes
|