@lobehub/chat 1.53.0 → 1.53.2

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 CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.53.2](https://github.com/lobehub/lobe-chat/compare/v1.53.1...v1.53.2)
6
+
7
+ <sup>Released on **2025-02-12**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Disable openrouter client fetch.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Disable openrouter client fetch, closes [#6043](https://github.com/lobehub/lobe-chat/issues/6043) ([63b22ce](https://github.com/lobehub/lobe-chat/commit/63b22ce))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 1.53.1](https://github.com/lobehub/lobe-chat/compare/v1.53.0...v1.53.1)
31
+
32
+ <sup>Released on **2025-02-12**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix reasoning output for OpenRouter reasoning models like deepseek-r1.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix reasoning output for OpenRouter reasoning models like deepseek-r1, closes [#5903](https://github.com/lobehub/lobe-chat/issues/5903) [#5766](https://github.com/lobehub/lobe-chat/issues/5766) ([bfd9317](https://github.com/lobehub/lobe-chat/commit/bfd9317))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ## [Version 1.53.0](https://github.com/lobehub/lobe-chat/compare/v1.52.19...v1.53.0)
6
56
 
7
57
  <sup>Released on **2025-02-11**</sup>
package/README.ja-JP.md CHANGED
@@ -711,9 +711,9 @@ This project is [Apache 2.0](./LICENSE) licensed.
711
711
  [blog]: https://lobehub.com/blog
712
712
  [changelog]: https://lobehub.com/changelog
713
713
  [chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
714
- [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preview_lobehub_com_chat.html
714
+ [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/lobechat_com_chat.html
715
715
  [chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
716
- [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preview_lobehub_com_chat.html
716
+ [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/lobechat_com_chat.html
717
717
  [chat-plugin-sdk]: https://github.com/lobehub/chat-plugin-sdk
718
718
  [chat-plugin-template]: https://github.com/lobehub/chat-plugin-template
719
719
  [chat-plugins-gateway]: https://github.com/lobehub/chat-plugins-gateway
package/README.md CHANGED
@@ -728,9 +728,9 @@ This project is [Apache 2.0](./LICENSE) licensed.
728
728
  [blog]: https://lobehub.com/blog
729
729
  [changelog]: https://lobehub.com/changelog
730
730
  [chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
731
- [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preview_lobehub_com_chat.html
731
+ [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/lobechat_com_chat.html
732
732
  [chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
733
- [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preview_lobehub_com_chat.html
733
+ [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/lobechat_com_chat.html
734
734
  [chat-plugin-sdk]: https://github.com/lobehub/chat-plugin-sdk
735
735
  [chat-plugin-template]: https://github.com/lobehub/chat-plugin-template
736
736
  [chat-plugins-gateway]: https://github.com/lobehub/chat-plugins-gateway
package/README.zh-CN.md CHANGED
@@ -750,9 +750,9 @@ This project is [Apache 2.0](./LICENSE) licensed.
750
750
  [blog]: https://lobehub.com/zh/blog
751
751
  [changelog]: https://lobehub.com/changelog
752
752
  [chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
753
- [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preview_lobehub_com_chat.html
753
+ [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/lobechat_com_chat.html
754
754
  [chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
755
- [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preview_lobehub_com_chat.html
755
+ [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/lobechat_com_chat.html
756
756
  [chat-plugin-sdk]: https://github.com/lobehub/chat-plugin-sdk
757
757
  [chat-plugin-template]: https://github.com/lobehub/chat-plugin-template
758
758
  [chat-plugins-gateway]: https://github.com/lobehub/chat-plugins-gateway
package/README.zh-TW.md CHANGED
@@ -755,9 +755,9 @@ This project is [Apache 2.0](./LICENSE) licensed.
755
755
  [blog]: https://lobehub.com/zh/blog
756
756
  [changelog]: https://lobehub.com/changelog
757
757
  [chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
758
- [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preview_lobehub_com_chat.html
758
+ [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/lobechat_com_chat.html
759
759
  [chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
760
- [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preview_lobehub_com_chat.html
760
+ [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/lobechat_com_chat.html
761
761
  [chat-plugin-sdk]: https://github.com/lobehub/chat-plugin-sdk
762
762
  [chat-plugin-template]: https://github.com/lobehub/chat-plugin-template
763
763
  [chat-plugins-gateway]: https://github.com/lobehub/chat-plugins-gateway
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Disable openrouter client fetch."
6
+ ]
7
+ },
8
+ "date": "2025-02-12",
9
+ "version": "1.53.2"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Fix reasoning output for OpenRouter reasoning models like deepseek-r1."
15
+ ]
16
+ },
17
+ "date": "2025-02-12",
18
+ "version": "1.53.1"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "features": [
@@ -2,64 +2,37 @@
2
2
 
3
3
  #### TOC
4
4
 
5
- - [Welcome Page](#welcome-page)
6
5
  - [Chat Page](#chat-page)
7
- - [Market Page](#market-page)
8
- - [Settings Page](#settings-page)
9
-
10
- ## Welcome Page
11
-
12
- > **Info**\
13
- > <https://chat-preview.lobehub.com/welcome>
14
-
15
- | Desktop | Mobile |
16
- | :---------------------------------------------: | :--------------------------------------------: |
17
- | ![][welcome-desktop] | ![][welcome-mobile] |
18
- | [⚡️ Lighthouse Report][welcome-desktop-report] | [⚡️ Lighthouse Report][welcome-mobile-report] |
6
+ - [Discover Page](#discover-page)
19
7
 
20
8
  ## Chat Page
21
9
 
22
10
  > **Info**\
23
- > <https://chat-preview.lobehub.com/chat>
11
+ > <https://lobechat.com/chat>
24
12
 
25
13
  | Desktop | Mobile |
26
14
  | :------------------------------------------: | :-----------------------------------------: |
27
15
  | ![][chat-desktop] | ![][chat-mobile] |
28
16
  | [⚡️ Lighthouse Report][chat-desktop-report] | [⚡️ Lighthouse Report][chat-mobile-report] |
29
17
 
30
- ## Market Page
18
+
19
+ ## Discover Page
31
20
 
32
21
  > **Info**\
33
- > <https://chat-preview.lobehub.com/market>
22
+ > <https://lobechat.com/discover>
34
23
 
35
24
  | Desktop | Mobile |
36
25
  | :--------------------------------------------: | :-------------------------------------------: |
37
- | ![][market-desktop] | ![][market-mobile] |
38
- | [⚡️ Lighthouse Report][market-desktop-report] | [⚡️ Lighthouse Report][market-mobile-report] |
39
-
40
- ## Settings Page
26
+ | ![][discover-desktop] | ![][discover-mobile] |
27
+ | [⚡️ Lighthouse Report][discover-desktop-report] | [⚡️ Lighthouse Report][discover-mobile-report] |
41
28
 
42
- > **Info**\
43
- > <https://chat-preview.lobehub.com/settings>
44
29
 
45
- | Desktop | Mobile |
46
- | :----------------------------------------------: | :---------------------------------------------: |
47
- | ![][settings-desktop] | ![][settings-mobile] |
48
- | [⚡️ Lighthouse Report][settings-desktop-report] | [⚡️ Lighthouse Report][settings-mobile-report] |
49
30
 
50
31
  [chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
51
- [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preview_lobehub_com_chat.html
32
+ [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/lobechat_com_chat.html
52
33
  [chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
53
- [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preview_lobehub_com_chat.html
54
- [market-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/desktop/pagespeed.svg
55
- [market-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/desktop/chat_preview_lobehub_com_market.html
56
- [market-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/mobile/pagespeed.svg
57
- [market-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/mobile/chat_preview_lobehub_com_market.html
58
- [settings-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/desktop/pagespeed.svg
59
- [settings-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/desktop/chat_preview_lobehub_com_settings.html
60
- [settings-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/mobile/pagespeed.svg
61
- [settings-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/mobile/chat_preview_lobehub_com_settings.html
62
- [welcome-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/desktop/pagespeed.svg
63
- [welcome-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/desktop/chat_preview_lobehub_com_welcome.html
64
- [welcome-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/mobile/pagespeed.svg
65
- [welcome-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/mobile/chat_preview_lobehub_com_welcome.html
34
+ [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/lobechat_com_chat.html
35
+ [discover-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/discover/desktop/pagespeed.svg
36
+ [discover-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/discover/desktop/lobechat_com_discover.html
37
+ [discover-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/discover/mobile/pagespeed.svg
38
+ [discover-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/discover/mobile/lobechat_com_discover.html
@@ -2,64 +2,35 @@
2
2
 
3
3
  #### TOC
4
4
 
5
- - [Welcome 欢迎页面](#welcome-欢迎页面)
6
5
  - [Chat 聊天页面](#chat-聊天页面)
7
- - [Market 市场页面](#market-市场页面)
8
- - [Settings 设置页面](#settings-设置页面)
9
-
10
- ## Welcome 欢迎页面
11
-
12
- > **Info**\
13
- > <https://chat-preview.lobehub.com/welcome>
14
-
15
- | Desktop | Mobile |
16
- | :---------------------------------------------: | :--------------------------------------------: |
17
- | ![][welcome-desktop] | ![][welcome-mobile] |
18
- | [⚡️ Lighthouse Report][welcome-desktop-report] | [⚡️ Lighthouse Report][welcome-mobile-report] |
6
+ - [Discover 市场页面](#discover-市场页面)
19
7
 
20
8
  ## Chat 聊天页面
21
9
 
22
10
  > **Info**\
23
- > <https://chat-preview.lobehub.com/chat>
11
+ > <https://lobechat.com/chat>
24
12
 
25
13
  | Desktop | Mobile |
26
14
  | :------------------------------------------: | :-----------------------------------------: |
27
15
  | ![][chat-desktop] | ![][chat-mobile] |
28
16
  | [⚡️ Lighthouse Report][chat-desktop-report] | [⚡️ Lighthouse Report][chat-mobile-report] |
29
17
 
30
- ## Market 市场页面
18
+ ## Discover 发现页面
31
19
 
32
20
  > **Info**\
33
- > <https://chat-preview.lobehub.com/market>
21
+ > <https://lobechat.com/discover>
34
22
 
35
23
  | Desktop | Mobile |
36
24
  | :--------------------------------------------: | :-------------------------------------------: |
37
- | ![][market-desktop] | ![][market-mobile] |
38
- | [⚡️ Lighthouse Report][market-desktop-report] | [⚡️ Lighthouse Report][market-mobile-report] |
39
-
40
- ## Settings 设置页面
41
-
42
- > **Info**\
43
- > <https://chat-preview.lobehub.com/settings>
25
+ | ![][discover-desktop] | ![][discover-mobile] |
26
+ | [⚡️ Lighthouse Report][discover-desktop-report] | [⚡️ Lighthouse Report][discover-mobile-report] |
44
27
 
45
- | Desktop | Mobile |
46
- | :----------------------------------------------: | :---------------------------------------------: |
47
- | ![][settings-desktop] | ![][settings-mobile] |
48
- | [⚡️ Lighthouse Report][settings-desktop-report] | [⚡️ Lighthouse Report][settings-mobile-report] |
49
28
 
50
29
  [chat-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/desktop/pagespeed.svg
51
- [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/chat_preview_lobehub_com_chat.html
30
+ [chat-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/desktop/lobechat_com_chat.html
52
31
  [chat-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/chat/mobile/pagespeed.svg
53
- [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/chat_preview_lobehub_com_chat.html
54
- [market-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/desktop/pagespeed.svg
55
- [market-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/desktop/chat_preview_lobehub_com_market.html
56
- [market-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/market/mobile/pagespeed.svg
57
- [market-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/market/mobile/chat_preview_lobehub_com_market.html
58
- [settings-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/desktop/pagespeed.svg
59
- [settings-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/desktop/chat_preview_lobehub_com_settings.html
60
- [settings-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/settings/mobile/pagespeed.svg
61
- [settings-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/settings/mobile/chat_preview_lobehub_com_settings.html
62
- [welcome-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/desktop/pagespeed.svg
63
- [welcome-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/desktop/chat_preview_lobehub_com_welcome.html
64
- [welcome-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/welcome/mobile/pagespeed.svg
65
- [welcome-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/welcome/mobile/chat_preview_lobehub_com_welcome.html
32
+ [chat-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/chat/mobile/lobechat_com_chat.html
33
+ [discover-desktop]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/discover/desktop/pagespeed.svg
34
+ [discover-desktop-report]: https://lobehub.github.io/lobe-chat/lighthouse/discover/desktop/lobechat_com_discover.html
35
+ [discover-mobile]: https://raw.githubusercontent.com/lobehub/lobe-chat/lighthouse/lighthouse/discover/mobile/pagespeed.svg
36
+ [discover-mobile-report]: https://lobehub.github.io/lobe-chat/lighthouse/discover/mobile/lobechat_com_discover.html
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.53.0",
3
+ "version": "1.53.2",
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",
@@ -172,19 +172,20 @@ const OpenRouter: ModelProviderCard = {
172
172
  },
173
173
  {
174
174
  contextWindowTokens: 1_048_576 + 8192,
175
- description: "Gemini 2.0 Flash 提供下一代功能和改进,包括卓越的速度、原生工具使用、多模态生成和1M令牌上下文窗口。",
176
- displayName: "Gemini 2.0 Flash",
175
+ description:
176
+ 'Gemini 2.0 Flash 提供下一代功能和改进,包括卓越的速度、原生工具使用、多模态生成和1M令牌上下文窗口。',
177
+ displayName: 'Gemini 2.0 Flash',
177
178
  enabled: true,
178
179
  functionCall: true,
179
- id: "google/gemini-2.0-flash-001",
180
+ id: 'google/gemini-2.0-flash-001',
180
181
  maxOutput: 8192,
181
182
  pricing: {
182
183
  cachedInput: 0.025,
183
184
  input: 0.1,
184
- output: 0.4
185
+ output: 0.4,
185
186
  },
186
- releasedAt: "2025-02-05",
187
- vision: true
187
+ releasedAt: '2025-02-05',
188
+ vision: true,
188
189
  },
189
190
  {
190
191
  contextWindowTokens: 2_000_000 + 8192,
@@ -214,6 +215,19 @@ const OpenRouter: ModelProviderCard = {
214
215
  },
215
216
  releasedAt: '2024-09-05',
216
217
  },
218
+ {
219
+ contextWindowTokens: 163_840,
220
+ description: 'DeepSeek-R1',
221
+ displayName: 'DeepSeek R1',
222
+ enabled: true,
223
+ functionCall: false,
224
+ id: 'deepseek/deepseek-r1',
225
+ pricing: {
226
+ input: 3,
227
+ output: 8,
228
+ },
229
+ releasedAt: '2025-01-20',
230
+ },
217
231
  {
218
232
  contextWindowTokens: 131_072,
219
233
  description:
@@ -285,14 +299,15 @@ const OpenRouter: ModelProviderCard = {
285
299
  },
286
300
  {
287
301
  contextWindowTokens: 2_097_152 + 8192,
288
- description: "Gemini 2.0 Pro Experimental 是 Google 最新的实验性多模态AI模型,与历史版本相比有一定的质量提升,特别是对于世界知识、代码和长上下文。",
289
- displayName: "Gemini 2.0 Pro Experimental 02-05 (Free)",
302
+ description:
303
+ 'Gemini 2.0 Pro Experimental Google 最新的实验性多模态AI模型,与历史版本相比有一定的质量提升,特别是对于世界知识、代码和长上下文。',
304
+ displayName: 'Gemini 2.0 Pro Experimental 02-05 (Free)',
290
305
  enabled: true,
291
306
  functionCall: true,
292
- id: "google/gemini-2.0-pro-exp-02-05:free",
307
+ id: 'google/gemini-2.0-pro-exp-02-05:free',
293
308
  maxOutput: 8192,
294
- releasedAt: "2025-02-05",
295
- vision: true
309
+ releasedAt: '2025-02-05',
310
+ vision: true,
296
311
  },
297
312
  ],
298
313
  checkModel: 'google/gemma-2-9b-it:free',
@@ -303,6 +318,9 @@ const OpenRouter: ModelProviderCard = {
303
318
  modelsUrl: 'https://openrouter.ai/models',
304
319
  name: 'OpenRouter',
305
320
  settings: {
321
+ // OpenRouter don't support browser request
322
+ // https://github.com/lobehub/lobe-chat/issues/5900
323
+ disableBrowserRequest: true,
306
324
  sdkType: 'openai',
307
325
  showModelFetcher: true,
308
326
  },
@@ -79,14 +79,14 @@ describe('LobeOpenRouterAI', () => {
79
79
 
80
80
  // Assert
81
81
  expect(instance['client'].chat.completions.create).toHaveBeenCalledWith(
82
- {
82
+ expect.objectContaining({
83
83
  max_tokens: 1024,
84
84
  messages: [{ content: 'Hello', role: 'user' }],
85
85
  stream: true,
86
86
  model: 'mistralai/mistral-7b-instruct:free',
87
87
  temperature: 0.7,
88
88
  top_p: 1,
89
- },
89
+ }),
90
90
  { headers: { Accept: '*/*' } },
91
91
  );
92
92
  expect(result).toBeInstanceOf(Response);
@@ -6,6 +6,15 @@ import { OpenRouterModelCard } from './type';
6
6
 
7
7
  export const LobeOpenRouterAI = LobeOpenAICompatibleFactory({
8
8
  baseURL: 'https://openrouter.ai/api/v1',
9
+ chatCompletion: {
10
+ handlePayload: (payload) => {
11
+ return {
12
+ ...payload,
13
+ include_reasoning: true,
14
+ stream: payload.stream ?? true,
15
+ } as any;
16
+ },
17
+ },
9
18
  constructorOptions: {
10
19
  defaultHeaders: {
11
20
  'HTTP-Referer': 'https://chat-preview.lobehub.com',
@@ -17,10 +26,7 @@ export const LobeOpenRouterAI = LobeOpenAICompatibleFactory({
17
26
  },
18
27
  models: {
19
28
  transformModel: (m) => {
20
- const visionKeywords = [
21
- 'qwen/qvq',
22
- 'vision',
23
- ];
29
+ const visionKeywords = ['qwen/qvq', 'vision'];
24
30
 
25
31
  const reasoningKeywords = [
26
32
  'deepseek/deepseek-r1',
@@ -28,7 +34,7 @@ export const LobeOpenRouterAI = LobeOpenAICompatibleFactory({
28
34
  'openai/o3',
29
35
  'qwen/qvq',
30
36
  'qwen/qwq',
31
- 'thinking'
37
+ 'thinking',
32
38
  ];
33
39
 
34
40
  const model = m as unknown as OpenRouterModelCard;
@@ -45,11 +51,11 @@ export const LobeOpenRouterAI = LobeOpenAICompatibleFactory({
45
51
  typeof model.top_provider.max_completion_tokens === 'number'
46
52
  ? model.top_provider.max_completion_tokens
47
53
  : undefined,
48
- reasoning: reasoningKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
54
+ reasoning: reasoningKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)),
49
55
  vision:
50
56
  model.description.includes('vision') ||
51
57
  model.description.includes('multimodal') ||
52
- visionKeywords.some(keyword => model.id.toLowerCase().includes(keyword)),
58
+ visionKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)),
53
59
  };
54
60
  },
55
61
  },
@@ -1375,5 +1375,206 @@ describe('OpenAIStream', () => {
1375
1375
  ].map((i) => `${i}\n`),
1376
1376
  );
1377
1377
  });
1378
+
1379
+ it('should handle reasoning key from OpenRouter response', async () => {
1380
+ const data = [
1381
+ {
1382
+ id: '1',
1383
+ object: 'chat.completion.chunk',
1384
+ created: 1737563070,
1385
+ model: 'deepseek-reasoner',
1386
+ system_fingerprint: 'fp_1c5d8833bc',
1387
+ choices: [
1388
+ {
1389
+ index: 0,
1390
+ delta: { role: 'assistant', reasoning: '' },
1391
+ logprobs: null,
1392
+ finish_reason: null,
1393
+ },
1394
+ ],
1395
+ },
1396
+ {
1397
+ id: '1',
1398
+ object: 'chat.completion.chunk',
1399
+ created: 1737563070,
1400
+ model: 'deepseek-reasoner',
1401
+ system_fingerprint: 'fp_1c5d8833bc',
1402
+ choices: [
1403
+ {
1404
+ index: 0,
1405
+ delta: { reasoning: '您好' },
1406
+ logprobs: null,
1407
+ finish_reason: null,
1408
+ },
1409
+ ],
1410
+ },
1411
+ {
1412
+ id: '1',
1413
+ object: 'chat.completion.chunk',
1414
+ created: 1737563070,
1415
+ model: 'deepseek-reasoner',
1416
+ system_fingerprint: 'fp_1c5d8833bc',
1417
+ choices: [
1418
+ {
1419
+ index: 0,
1420
+ delta: { reasoning: '!' },
1421
+ logprobs: null,
1422
+ finish_reason: null,
1423
+ },
1424
+ ],
1425
+ },
1426
+ {
1427
+ id: '1',
1428
+ object: 'chat.completion.chunk',
1429
+ created: 1737563070,
1430
+ model: 'deepseek-reasoner',
1431
+ system_fingerprint: 'fp_1c5d8833bc',
1432
+ choices: [
1433
+ {
1434
+ index: 0,
1435
+ delta: { content: '你好', reasoning: null },
1436
+ logprobs: null,
1437
+ finish_reason: null,
1438
+ },
1439
+ ],
1440
+ },
1441
+ {
1442
+ id: '1',
1443
+ object: 'chat.completion.chunk',
1444
+ created: 1737563070,
1445
+ model: 'deepseek-reasoner',
1446
+ system_fingerprint: 'fp_1c5d8833bc',
1447
+ choices: [
1448
+ {
1449
+ index: 0,
1450
+ delta: { content: '很高兴', reasoning: null },
1451
+ logprobs: null,
1452
+ finish_reason: null,
1453
+ },
1454
+ ],
1455
+ },
1456
+ {
1457
+ id: '1',
1458
+ object: 'chat.completion.chunk',
1459
+ created: 1737563070,
1460
+ model: 'deepseek-reasoner',
1461
+ system_fingerprint: 'fp_1c5d8833bc',
1462
+ choices: [
1463
+ {
1464
+ index: 0,
1465
+ delta: { content: '为您', reasoning: null },
1466
+ logprobs: null,
1467
+ finish_reason: null,
1468
+ },
1469
+ ],
1470
+ },
1471
+ {
1472
+ id: '1',
1473
+ object: 'chat.completion.chunk',
1474
+ created: 1737563070,
1475
+ model: 'deepseek-reasoner',
1476
+ system_fingerprint: 'fp_1c5d8833bc',
1477
+ choices: [
1478
+ {
1479
+ index: 0,
1480
+ delta: { content: '提供', reasoning: null },
1481
+ logprobs: null,
1482
+ finish_reason: null,
1483
+ },
1484
+ ],
1485
+ },
1486
+ {
1487
+ id: '1',
1488
+ object: 'chat.completion.chunk',
1489
+ created: 1737563070,
1490
+ model: 'deepseek-reasoner',
1491
+ system_fingerprint: 'fp_1c5d8833bc',
1492
+ choices: [
1493
+ {
1494
+ index: 0,
1495
+ delta: { content: '帮助。', reasoning: null },
1496
+ logprobs: null,
1497
+ finish_reason: null,
1498
+ },
1499
+ ],
1500
+ },
1501
+ {
1502
+ id: '1',
1503
+ object: 'chat.completion.chunk',
1504
+ created: 1737563070,
1505
+ model: 'deepseek-reasoner',
1506
+ system_fingerprint: 'fp_1c5d8833bc',
1507
+ choices: [
1508
+ {
1509
+ index: 0,
1510
+ delta: { content: '', reasoning: null },
1511
+ logprobs: null,
1512
+ finish_reason: 'stop',
1513
+ },
1514
+ ],
1515
+ usage: {
1516
+ prompt_tokens: 6,
1517
+ completion_tokens: 104,
1518
+ total_tokens: 110,
1519
+ prompt_tokens_details: { cached_tokens: 0 },
1520
+ completion_tokens_details: { reasoning_tokens: 70 },
1521
+ prompt_cache_hit_tokens: 0,
1522
+ prompt_cache_miss_tokens: 6,
1523
+ },
1524
+ },
1525
+ ];
1526
+
1527
+ const mockOpenAIStream = new ReadableStream({
1528
+ start(controller) {
1529
+ data.forEach((chunk) => {
1530
+ controller.enqueue(chunk);
1531
+ });
1532
+
1533
+ controller.close();
1534
+ },
1535
+ });
1536
+
1537
+ const protocolStream = OpenAIStream(mockOpenAIStream);
1538
+
1539
+ const decoder = new TextDecoder();
1540
+ const chunks = [];
1541
+
1542
+ // @ts-ignore
1543
+ for await (const chunk of protocolStream) {
1544
+ chunks.push(decoder.decode(chunk, { stream: true }));
1545
+ }
1546
+
1547
+ expect(chunks).toEqual(
1548
+ [
1549
+ 'id: 1',
1550
+ 'event: reasoning',
1551
+ `data: ""\n`,
1552
+ 'id: 1',
1553
+ 'event: reasoning',
1554
+ `data: "您好"\n`,
1555
+ 'id: 1',
1556
+ 'event: reasoning',
1557
+ `data: "!"\n`,
1558
+ 'id: 1',
1559
+ 'event: text',
1560
+ `data: "你好"\n`,
1561
+ 'id: 1',
1562
+ 'event: text',
1563
+ `data: "很高兴"\n`,
1564
+ 'id: 1',
1565
+ 'event: text',
1566
+ `data: "为您"\n`,
1567
+ 'id: 1',
1568
+ 'event: text',
1569
+ `data: "提供"\n`,
1570
+ 'id: 1',
1571
+ 'event: text',
1572
+ `data: "帮助。"\n`,
1573
+ 'id: 1',
1574
+ 'event: stop',
1575
+ `data: "stop"\n`,
1576
+ ].map((i) => `${i}\n`),
1577
+ );
1578
+ });
1378
1579
  });
1379
1580
  });
@@ -88,8 +88,12 @@ export const transformOpenAIStream = (
88
88
  }
89
89
 
90
90
  if (item.delta) {
91
- let reasoning_content =
92
- 'reasoning_content' in item.delta ? item.delta.reasoning_content : null;
91
+ let reasoning_content = (() => {
92
+ if ('reasoning_content' in item.delta) return item.delta.reasoning_content;
93
+ if ('reasoning' in item.delta) return item.delta.reasoning;
94
+ return null;
95
+ })();
96
+
93
97
  let content = 'content' in item.delta ? item.delta.content : null;
94
98
 
95
99
  // DeepSeek reasoner will put thinking in the reasoning_content field