@lobehub/chat 1.61.6 → 1.62.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/changelog/v1.json +12 -0
  3. package/locales/en-US/components.json +3 -3
  4. package/package.json +2 -2
  5. package/src/components/ModelSelect/index.tsx +24 -2
  6. package/src/components/Thinking/index.tsx +7 -2
  7. package/src/config/aiModels/jina.ts +7 -5
  8. package/src/config/aiModels/perplexity.ts +8 -0
  9. package/src/config/llm.ts +8 -0
  10. package/src/database/client/migrations.json +12 -8
  11. package/src/database/migrations/0015_add_message_search_metadata.sql +2 -0
  12. package/src/database/migrations/meta/0015_snapshot.json +3616 -0
  13. package/src/database/migrations/meta/_journal.json +7 -0
  14. package/src/database/schemas/message.ts +3 -1
  15. package/src/database/server/models/message.ts +2 -0
  16. package/src/features/Conversation/components/ChatItem/index.tsx +10 -1
  17. package/src/features/Conversation/components/MarkdownElements/Thinking/Render.tsx +5 -1
  18. package/src/features/Conversation/components/MarkdownElements/remarkPlugins/createRemarkCustomTagPlugin.ts +1 -0
  19. package/src/features/Conversation/components/MarkdownElements/remarkPlugins/getNodeContent.test.ts +107 -0
  20. package/src/features/Conversation/components/MarkdownElements/remarkPlugins/getNodeContent.ts +6 -0
  21. package/src/libs/agent-runtime/perplexity/index.test.ts +156 -12
  22. package/src/libs/agent-runtime/utils/streams/anthropic.ts +3 -3
  23. package/src/libs/agent-runtime/utils/streams/bedrock/claude.ts +6 -2
  24. package/src/libs/agent-runtime/utils/streams/bedrock/llama.ts +3 -3
  25. package/src/libs/agent-runtime/utils/streams/google-ai.ts +3 -3
  26. package/src/libs/agent-runtime/utils/streams/ollama.ts +3 -3
  27. package/src/libs/agent-runtime/utils/streams/openai.ts +26 -8
  28. package/src/libs/agent-runtime/utils/streams/protocol.ts +33 -8
  29. package/src/libs/agent-runtime/utils/streams/vertex-ai.ts +3 -3
  30. package/src/locales/default/components.ts +1 -0
  31. package/src/store/chat/slices/aiChat/actions/generateAIChat.ts +17 -6
  32. package/src/store/chat/slices/message/action.ts +12 -7
  33. package/src/types/aiModel.ts +5 -0
  34. package/src/types/message/base.ts +13 -0
  35. package/src/types/message/chat.ts +3 -2
  36. package/src/utils/fetch/fetchSSE.ts +17 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,39 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.62.0](https://github.com/lobehub/lobe-chat/compare/v1.61.6...v1.62.0)
6
+
7
+ <sup>Released on **2025-02-20**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Support pplx search grounding.
12
+
13
+ #### 🐛 Bug Fixes
14
+
15
+ - **misc**: Azure AI env var configuration issue..
16
+
17
+ <br/>
18
+
19
+ <details>
20
+ <summary><kbd>Improvements and Fixes</kbd></summary>
21
+
22
+ #### What's improved
23
+
24
+ - **misc**: Support pplx search grounding, closes [#6331](https://github.com/lobehub/lobe-chat/issues/6331) ([ccb0003](https://github.com/lobehub/lobe-chat/commit/ccb0003))
25
+
26
+ #### What's fixed
27
+
28
+ - **misc**: Azure AI env var configuration issue., closes [#6346](https://github.com/lobehub/lobe-chat/issues/6346) ([3fc61bb](https://github.com/lobehub/lobe-chat/commit/3fc61bb))
29
+
30
+ </details>
31
+
32
+ <div align="right">
33
+
34
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
35
+
36
+ </div>
37
+
5
38
  ### [Version 1.61.6](https://github.com/lobehub/lobe-chat/compare/v1.61.5...v1.61.6)
6
39
 
7
40
  <sup>Released on **2025-02-20**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "features": [
5
+ "Support pplx search grounding."
6
+ ],
7
+ "fixes": [
8
+ "Azure AI env var configuration issue.."
9
+ ]
10
+ },
11
+ "date": "2025-02-20",
12
+ "version": "1.62.0"
13
+ },
2
14
  {
3
15
  "children": {
4
16
  "fixes": [
@@ -111,8 +111,8 @@
111
111
  }
112
112
  },
113
113
  "Thinking": {
114
- "thinking": "Deep in thought...",
115
- "thought": "Deeply thought (took {{duration}} seconds)",
116
- "thoughtWithDuration": "Deeply thought"
114
+ "thinking": "Deep Thinking...",
115
+ "thought": "Deeply Thought (in {{duration}} seconds)",
116
+ "thoughtWithDuration": "Deeply Thought"
117
117
  }
118
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.61.6",
3
+ "version": "1.62.0",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot 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",
@@ -129,7 +129,7 @@
129
129
  "@lobehub/chat-plugins-gateway": "^1.9.0",
130
130
  "@lobehub/icons": "^1.73.1",
131
131
  "@lobehub/tts": "^1.28.0",
132
- "@lobehub/ui": "^1.164.15",
132
+ "@lobehub/ui": "^1.165.0",
133
133
  "@neondatabase/serverless": "^0.10.4",
134
134
  "@next/third-parties": "^15.1.4",
135
135
  "@react-spring/web": "^9.7.5",
@@ -2,7 +2,14 @@ import { IconAvatarProps, ModelIcon, ProviderIcon } from '@lobehub/icons';
2
2
  import { Avatar, Icon, Tooltip } from '@lobehub/ui';
3
3
  import { Typography } from 'antd';
4
4
  import { createStyles } from 'antd-style';
5
- import { Infinity, AtomIcon, LucideEye, LucidePaperclip, ToyBrick } from 'lucide-react';
5
+ import {
6
+ Infinity,
7
+ AtomIcon,
8
+ LucideEye,
9
+ LucideGlobe,
10
+ LucidePaperclip,
11
+ ToyBrick,
12
+ } from 'lucide-react';
6
13
  import numeral from 'numeral';
7
14
  import { rgba } from 'polished';
8
15
  import { FC, memo } from 'react';
@@ -14,7 +21,7 @@ import { AiProviderSourceType } from '@/types/aiProvider';
14
21
  import { ChatModelCard } from '@/types/llm';
15
22
  import { formatTokenNumber } from '@/utils/format';
16
23
 
17
- const useStyles = createStyles(({ css, token }) => ({
24
+ const useStyles = createStyles(({ css, token, isDarkMode }) => ({
18
25
  custom: css`
19
26
  width: 36px;
20
27
  height: 20px;
@@ -41,6 +48,10 @@ const useStyles = createStyles(({ css, token }) => ({
41
48
  color: ${token.geekblue};
42
49
  background: ${token.geekblue1};
43
50
  `,
51
+ tagCyan: css`
52
+ color: ${isDarkMode ? token.cyan7 : token.cyan10};
53
+ background: ${isDarkMode ? token.cyan1 : token.cyan2};
54
+ `,
44
55
  tagGreen: css`
45
56
  color: ${token.green};
46
57
  background: ${token.green1};
@@ -122,6 +133,17 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
122
133
  </div>
123
134
  </Tooltip>
124
135
  )}
136
+ {model.search && (
137
+ <Tooltip
138
+ placement={placement}
139
+ styles={{ root: { pointerEvents: 'none' } }}
140
+ title={t('ModelSelect.featureTag.search')}
141
+ >
142
+ <div className={cx(styles.tag, styles.tagCyan)} style={{ cursor: 'pointer' }} title="">
143
+ <Icon icon={LucideGlobe} />
144
+ </div>
145
+ </Tooltip>
146
+ )}
125
147
  {typeof model.contextWindowTokens === 'number' && (
126
148
  <Tooltip
127
149
  placement={placement}
@@ -7,6 +7,8 @@ import { CSSProperties, memo, useEffect, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { Flexbox } from 'react-layout-kit';
9
9
 
10
+ import { CitationItem } from '@/types/message';
11
+
10
12
  const useStyles = createStyles(({ css, token, isDarkMode }) => ({
11
13
  container: css`
12
14
  width: fit-content;
@@ -59,13 +61,14 @@ const useStyles = createStyles(({ css, token, isDarkMode }) => ({
59
61
  }));
60
62
 
61
63
  interface ThinkingProps {
64
+ citations?: CitationItem[];
62
65
  content?: string;
63
66
  duration?: number;
64
67
  style?: CSSProperties;
65
68
  thinking?: boolean;
66
69
  }
67
70
 
68
- const Thinking = memo<ThinkingProps>(({ content, duration, thinking, style }) => {
71
+ const Thinking = memo<ThinkingProps>(({ content, duration, thinking, style, citations }) => {
69
72
  const { t } = useTranslation(['components', 'common']);
70
73
  const { styles, cx } = useStyles();
71
74
 
@@ -135,7 +138,9 @@ const Thinking = memo<ThinkingProps>(({ content, duration, thinking, style }) =>
135
138
  }}
136
139
  >
137
140
  {typeof content === 'string' ? (
138
- <Markdown variant={'chat'}>{content}</Markdown>
141
+ <Markdown citations={citations} variant={'chat'}>
142
+ {content}
143
+ </Markdown>
139
144
  ) : (
140
145
  content
141
146
  )}
@@ -4,19 +4,21 @@ const jinaChatModels: AIChatModelCard[] = [
4
4
  {
5
5
  abilities: {
6
6
  reasoning: true,
7
+ search: true,
7
8
  },
8
9
  contextWindowTokens: 1_000_000,
9
- description: '深度搜索结合了网络搜索、阅读和推理,可进行全面调查。您可以将其视为一个代理,接受您的研究任务 - 它会进行广泛搜索并经过多次迭代,然后才能给出答案。这个过程涉及持续的研究、推理和从各个角度解决问题。这与直接从预训练数据生成答案的标准大模型以及依赖一次性表面搜索的传统 RAG 系统有着根本的不同。',
10
+ description:
11
+ '深度搜索结合了网络搜索、阅读和推理,可进行全面调查。您可以将其视为一个代理,接受您的研究任务 - 它会进行广泛搜索并经过多次迭代,然后才能给出答案。这个过程涉及持续的研究、推理和从各个角度解决问题。这与直接从预训练数据生成答案的标准大模型以及依赖一次性表面搜索的传统 RAG 系统有着根本的不同。',
10
12
  displayName: 'Jina DeepSearch v1',
11
13
  enabled: true,
12
14
  id: 'jina-deepsearch-v1',
13
15
  pricing: {
14
16
  input: 0.02,
15
- output: 0.02
17
+ output: 0.02,
16
18
  },
17
- type: 'chat'
18
- }
19
- ]
19
+ type: 'chat',
20
+ },
21
+ ];
20
22
 
21
23
  export const allModels = [...jinaChatModels];
22
24
 
@@ -4,6 +4,7 @@ const perplexityChatModels: AIChatModelCard[] = [
4
4
  {
5
5
  abilities: {
6
6
  reasoning: true,
7
+ search: true,
7
8
  },
8
9
  contextWindowTokens: 127_072,
9
10
  description: '由 DeepSeek 推理模型提供支持的新 API 产品。',
@@ -16,6 +17,7 @@ const perplexityChatModels: AIChatModelCard[] = [
16
17
  {
17
18
  abilities: {
18
19
  reasoning: true,
20
+ search: true,
19
21
  },
20
22
  contextWindowTokens: 127_072,
21
23
  description: '由 DeepSeek 推理模型提供支持的新 API 产品。',
@@ -26,6 +28,9 @@ const perplexityChatModels: AIChatModelCard[] = [
26
28
  type: 'chat',
27
29
  },
28
30
  {
31
+ abilities: {
32
+ search: true,
33
+ },
29
34
  contextWindowTokens: 200_000,
30
35
  description: '支持搜索上下文的高级搜索产品,支持高级查询和跟进。',
31
36
  displayName: 'Sonar Pro',
@@ -34,6 +39,9 @@ const perplexityChatModels: AIChatModelCard[] = [
34
39
  type: 'chat',
35
40
  },
36
41
  {
42
+ abilities: {
43
+ search: true,
44
+ },
37
45
  contextWindowTokens: 127_072,
38
46
  description: '基于搜索上下文的轻量级搜索产品,比 Sonar Pro 更快、更便宜。',
39
47
  displayName: 'Sonar',
package/src/config/llm.ts CHANGED
@@ -15,6 +15,10 @@ export const getLLMConfig = () => {
15
15
  AZURE_API_VERSION: z.string().optional(),
16
16
  AZURE_ENDPOINT: z.string().optional(),
17
17
 
18
+ ENABLED_AZUREAI: z.boolean(),
19
+ AZUREAI_ENDPOINT: z.string().optional(),
20
+ AZUREAI_ENDPOINT_KEY: z.string().optional(),
21
+
18
22
  ENABLED_ZHIPU: z.boolean(),
19
23
  ZHIPU_API_KEY: z.string().optional(),
20
24
 
@@ -155,6 +159,10 @@ export const getLLMConfig = () => {
155
159
  AZURE_API_VERSION: process.env.AZURE_API_VERSION,
156
160
  AZURE_ENDPOINT: process.env.AZURE_ENDPOINT,
157
161
 
162
+ ENABLED_AZUREAI: !!process.env.AZUREAI_ENDPOINT_KEY,
163
+ AZUREAI_ENDPOINT_KEY: process.env.AZUREAI_ENDPOINT_KEY,
164
+ AZUREAI_ENDPOINT: process.env.AZUREAI_ENDPOINT,
165
+
158
166
  ENABLED_ZHIPU: !!process.env.ZHIPU_API_KEY,
159
167
  ZHIPU_API_KEY: process.env.ZHIPU_API_KEY,
160
168
 
@@ -223,10 +223,7 @@
223
223
  "hash": "9646161fa041354714f823d726af27247bcd6e60fa3be5698c0d69f337a5700b"
224
224
  },
225
225
  {
226
- "sql": [
227
- "DROP TABLE \"user_budgets\";",
228
- "\nDROP TABLE \"user_subscriptions\";"
229
- ],
226
+ "sql": ["DROP TABLE \"user_budgets\";", "\nDROP TABLE \"user_subscriptions\";"],
230
227
  "bps": true,
231
228
  "folderMillis": 1729699958471,
232
229
  "hash": "7dad43a2a25d1aec82124a4e53f8d82f8505c3073f23606c1dc5d2a4598eacf9"
@@ -298,11 +295,18 @@
298
295
  "hash": "845a692ceabbfc3caf252a97d3e19a213bc0c433df2689900135f9cfded2cf49"
299
296
  },
300
297
  {
301
- "sql": [
302
- "ALTER TABLE \"messages\" ADD COLUMN \"reasoning\" jsonb;"
303
- ],
298
+ "sql": ["ALTER TABLE \"messages\" ADD COLUMN \"reasoning\" jsonb;"],
304
299
  "bps": true,
305
300
  "folderMillis": 1737609172353,
306
301
  "hash": "2cb36ae4fcdd7b7064767e04bfbb36ae34518ff4bb1b39006f2dd394d1893868"
302
+ },
303
+ {
304
+ "sql": [
305
+ "ALTER TABLE \"messages\" ADD COLUMN \"search\" jsonb;",
306
+ "\nALTER TABLE \"messages\" ADD COLUMN \"metadata\" jsonb;"
307
+ ],
308
+ "bps": true,
309
+ "folderMillis": 1739901891891,
310
+ "hash": "78d8fefd8c58938d7bc3da2295a73b35ce2e8d7cb2820f8e817acdb8dd5bebb2"
307
311
  }
308
- ]
312
+ ]
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "messages" ADD COLUMN "search" jsonb;--> statement-breakpoint
2
+ ALTER TABLE "messages" ADD COLUMN "metadata" jsonb;