@lobehub/chat 1.136.9 → 1.136.10

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/package.json +1 -1
  4. package/packages/prompts/src/prompts/index.ts +1 -0
  5. package/packages/prompts/src/prompts/search/crawlResults.test.ts +172 -0
  6. package/packages/prompts/src/prompts/search/crawlResults.ts +82 -0
  7. package/packages/prompts/src/prompts/search/index.ts +2 -0
  8. package/packages/prompts/src/prompts/search/searchResults.test.ts +138 -0
  9. package/packages/prompts/src/prompts/search/searchResults.ts +58 -0
  10. package/packages/prompts/src/prompts/search/xmlEscape.ts +21 -0
  11. package/packages/types/src/tool/builtin.ts +8 -0
  12. package/packages/types/src/tool/index.ts +2 -0
  13. package/src/features/Conversation/Messages/Assistant/Tool/Inspector/BuiltinPluginTitle.tsx +17 -13
  14. package/src/features/Conversation/Messages/Assistant/Tool/Inspector/ToolTitle.tsx +1 -8
  15. package/src/features/Conversation/Messages/Assistant/Tool/Render/Arguments/index.tsx +12 -16
  16. package/src/features/Conversation/Messages/Assistant/Tool/Render/LoadingPlaceholder/index.tsx +29 -0
  17. package/src/features/Conversation/Messages/Assistant/Tool/Render/index.tsx +26 -7
  18. package/src/features/Conversation/Messages/Assistant/Tool/index.tsx +2 -0
  19. package/src/features/PluginsUI/Render/BuiltinType/index.test.tsx +5 -5
  20. package/src/features/PluginsUI/Render/BuiltinType/index.tsx +1 -7
  21. package/src/store/chat/slices/builtinTool/actions/search.test.ts +4 -3
  22. package/src/store/chat/slices/builtinTool/actions/search.ts +23 -15
  23. package/src/store/chat/slices/message/selectors.ts +10 -0
  24. package/src/styles/text.ts +10 -7
  25. package/src/tools/placeholders.ts +8 -0
  26. package/src/tools/web-browsing/Placeholder/PageContent.tsx +27 -0
  27. package/src/tools/web-browsing/Placeholder/Search.tsx +65 -0
  28. package/src/tools/web-browsing/Placeholder/index.tsx +40 -0
  29. package/src/tools/web-browsing/Render/PageContent/Loading.tsx +14 -5
  30. package/src/tools/web-browsing/Render/PageContent/Result.tsx +14 -13
  31. package/src/tools/web-browsing/Render/PageContent/index.tsx +15 -6
  32. package/src/tools/web-browsing/Render/Search/SearchQuery/SearchView.tsx +13 -19
  33. package/src/tools/web-browsing/Render/Search/SearchResult/index.tsx +21 -26
  34. package/src/tools/web-browsing/components/EngineAvatar.tsx +8 -2
  35. package/src/tools/web-browsing/const.ts +8 -1
@@ -1,10 +1,10 @@
1
- import { Button } from '@lobehub/ui';
2
- import { Empty, Skeleton } from 'antd';
1
+ import { Icon, Text } from '@lobehub/ui';
2
+ import { Button, Skeleton } from 'antd';
3
3
  import { uniq } from 'lodash-es';
4
4
  import { Edit2Icon } from 'lucide-react';
5
5
  import { memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
- import { Center, Flexbox } from 'react-layout-kit';
7
+ import { Flexbox } from 'react-layout-kit';
8
8
 
9
9
  import { useIsMobile } from '@/hooks/useIsMobile';
10
10
  import { useChatStore } from '@/store/chat';
@@ -50,29 +50,24 @@ const SearchResult = memo<SearchResultProps>(
50
50
 
51
51
  if (searchResults.length === 0)
52
52
  return (
53
- <Center>
54
- <Empty
55
- description={
56
- <Flexbox gap={8}>
57
- <div>{t('search.emptyResult')}</div>
58
- {!editing && (
59
- <div>
60
- <Button
61
- icon={Edit2Icon}
62
- onClick={() => {
63
- setEditing(true);
64
- }}
65
- type={'primary'}
66
- >
67
- {t('edit', { ns: 'common' })}
68
- </Button>
69
- </div>
70
- )}
71
- </Flexbox>
72
- }
73
- image={Empty.PRESENTED_IMAGE_SIMPLE}
74
- />
75
- </Center>
53
+ <Flexbox align={'center'} gap={8} horizontal paddingInline={8}>
54
+ <Text type={'secondary'}>{t('search.emptyResult')}</Text>
55
+ {!editing && (
56
+ <div>
57
+ <Button
58
+ color={'default'}
59
+ icon={<Icon icon={Edit2Icon} />}
60
+ onClick={() => {
61
+ setEditing(true);
62
+ }}
63
+ size={'small'}
64
+ variant={'filled'}
65
+ >
66
+ {t('edit', { ns: 'common' })}
67
+ </Button>
68
+ </div>
69
+ )}
70
+ </Flexbox>
76
71
  );
77
72
 
78
73
  return (
@@ -20,11 +20,17 @@ export const EngineAvatarGroup = memo<EngineAvatarGroupProps>(({ engines }) => {
20
20
  const theme = useTheme();
21
21
  return (
22
22
  <Avatar.Group>
23
- {engines.map((engine) => (
23
+ {engines.map((engine, index) => (
24
24
  <Avatar
25
25
  key={engine}
26
26
  src={ENGINE_ICON_MAP[engine]}
27
- style={{ background: theme.colorBgLayout, height: 20, padding: 3, width: 20 }}
27
+ style={{
28
+ background: theme.colorBgLayout,
29
+ height: 20,
30
+ padding: 3,
31
+ width: 20,
32
+ zIndex: 100 - index,
33
+ }}
28
34
  />
29
35
  ))}
30
36
  </Avatar.Group>
@@ -28,13 +28,20 @@ export const ENGINE_ICON_MAP: Record<string, string> = {
28
28
  'arxiv': 'https://icons.duckduckgo.com/ip3/arxiv.org.ico',
29
29
  'bilibili': 'https://icons.duckduckgo.com/ip3/bilibili.com.ico',
30
30
  'bing': 'https://icons.duckduckgo.com/ip3/www.bing.com.ico',
31
+ 'bing news': 'https://icons.duckduckgo.com/ip3/www.bing.com.ico',
31
32
  'brave': 'https://icons.duckduckgo.com/ip3/brave.com.ico',
33
+ 'brave.news': 'https://icons.duckduckgo.com/ip3/brave.com.ico',
32
34
  'duckduckgo': 'https://icons.duckduckgo.com/ip3/www.duckduckgo.com.ico',
33
35
  'google': 'https://icons.duckduckgo.com/ip3/google.com.ico',
34
36
  'google scholar': 'https://icons.duckduckgo.com/ip3/scholar.google.com.ico',
35
37
  'npm': 'https://icons.duckduckgo.com/ip3/npmjs.com.ico',
38
+ 'openairepublications': 'https://icons.duckduckgo.com/ip3/doi.org.ico',
39
+ 'pubmed': 'https://icons.duckduckgo.com/ip3/pubmed.ncbi.nlm.nih.gov.ico',
36
40
  'qwant': 'https://icons.duckduckgo.com/ip3/www.qwant.com.ico',
41
+ 'sogou wechat': 'https://icons.duckduckgo.com/ip3/weixin.sogou.com.ico',
37
42
  'youtube': 'https://icons.duckduckgo.com/ip3/youtube.com.ico',
38
43
  };
39
44
 
40
- export const CRAWL_CONTENT_LIMITED_COUNT = 7000;
45
+ export const CRAWL_CONTENT_LIMITED_COUNT = 25_000;
46
+
47
+ export const SEARCH_ITEM_LIMITED_COUNT = 30;