@lobehub/chat 1.49.12 → 1.49.14

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.49.14](https://github.com/lobehub/lobe-chat/compare/v1.49.13...v1.49.14)
6
+
7
+ <sup>Released on **2025-02-03**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix provider update issue.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix provider update issue, closes [#5676](https://github.com/lobehub/lobe-chat/issues/5676) ([e5d81ea](https://github.com/lobehub/lobe-chat/commit/e5d81ea))
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.49.13](https://github.com/lobehub/lobe-chat/compare/v1.49.12...v1.49.13)
31
+
32
+ <sup>Released on **2025-02-03**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Optimize requests without historical messages.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Optimize requests without historical messages, closes [#5174](https://github.com/lobehub/lobe-chat/issues/5174) ([182f8d9](https://github.com/lobehub/lobe-chat/commit/182f8d9))
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.49.12](https://github.com/lobehub/lobe-chat/compare/v1.49.11...v1.49.12)
6
56
 
7
57
  <sup>Released on **2025-02-02**</sup>
package/Dockerfile CHANGED
@@ -79,10 +79,12 @@ RUN \
79
79
  fi \
80
80
  # Set the registry for corepack
81
81
  && export COREPACK_NPM_REGISTRY=$(npm config get registry | sed 's/\/$//') \
82
+ # Update corepack to latest (nodejs/corepack#612)
83
+ && npm i -g corepack@latest \
82
84
  # Enable corepack
83
85
  && corepack enable \
84
86
  # Use pnpm for corepack
85
- && corepack use pnpm@9 \
87
+ && corepack use $(sed -n 's/.*"packageManager": "\(.*\)".*/\1/p' package.json) \
86
88
  # Install the dependencies
87
89
  && pnpm i \
88
90
  # Add sharp dependencies
@@ -86,10 +86,12 @@ RUN \
86
86
  fi \
87
87
  # Set the registry for corepack
88
88
  && export COREPACK_NPM_REGISTRY=$(npm config get registry | sed 's/\/$//') \
89
+ # Update corepack to latest (nodejs/corepack#612)
90
+ && npm i -g corepack@latest \
89
91
  # Enable corepack
90
92
  && corepack enable \
91
93
  # Use pnpm for corepack
92
- && corepack use pnpm@9 \
94
+ && corepack use $(sed -n 's/.*"packageManager": "\(.*\)".*/\1/p' package.json) \
93
95
  # Install the dependencies
94
96
  && pnpm i \
95
97
  # Add sharp and db migration dependencies
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix provider update issue."
6
+ ]
7
+ },
8
+ "date": "2025-02-03",
9
+ "version": "1.49.14"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Optimize requests without historical messages."
15
+ ]
16
+ },
17
+ "date": "2025-02-03",
18
+ "version": "1.49.13"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "fixes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.49.12",
3
+ "version": "1.49.14",
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",
@@ -114,7 +114,7 @@
114
114
  "@baiducloud/qianfan": "^0.1.9",
115
115
  "@cfworker/json-schema": "^4.1.0",
116
116
  "@clerk/localizations": "^3.9.6",
117
- "@clerk/nextjs": "6.10.2",
117
+ "@clerk/nextjs": "^6.10.6",
118
118
  "@clerk/themes": "^2.2.4",
119
119
  "@codesandbox/sandpack-react": "^2.19.10",
120
120
  "@cyntler/react-doc-viewer": "^1.17.0",
@@ -154,7 +154,7 @@
154
154
  "debug": "^4.4.0",
155
155
  "dexie": "^3.2.7",
156
156
  "diff": "^7.0.0",
157
- "drizzle-orm": "^0.38.3",
157
+ "drizzle-orm": "^0.39.0",
158
158
  "drizzle-zod": "^0.5.1",
159
159
  "fast-deep-equal": "^3.1.3",
160
160
  "file-type": "^19.6.0",
@@ -12,6 +12,7 @@ import {
12
12
  AiProviderRuntimeState,
13
13
  CreateAiProviderSchema,
14
14
  UpdateAiProviderConfigSchema,
15
+ UpdateAiProviderSchema,
15
16
  } from '@/types/aiProvider';
16
17
  import { ProviderConfig } from '@/types/user/settings';
17
18
 
@@ -82,7 +83,7 @@ export const aiProviderRouter = router({
82
83
  .input(
83
84
  z.object({
84
85
  id: z.string(),
85
- value: CreateAiProviderSchema.partial(),
86
+ value: UpdateAiProviderSchema,
86
87
  }),
87
88
  )
88
89
  .mutation(async ({ input, ctx }) => {
@@ -74,7 +74,7 @@ describe('chatHelpers', () => {
74
74
  ] as ChatMessage[];
75
75
 
76
76
  it('returns all messages if history is disabled', () => {
77
- const config = { enableHistoryCount: false, historyCount: 0 } as LobeAgentChatConfig;
77
+ const config = { enableHistoryCount: false, historyCount: undefined } as LobeAgentChatConfig;
78
78
  const slicedMessages = chatHelpers.getSlicedMessagesWithConfig(messages, config);
79
79
  expect(slicedMessages).toEqual(messages);
80
80
  });
@@ -105,5 +105,11 @@ describe('chatHelpers', () => {
105
105
  const slicedMessages = chatHelpers.getSlicedMessagesWithConfig([], config);
106
106
  expect(slicedMessages).toEqual([]);
107
107
  });
108
+
109
+ it('returns an empty array when historyCount is zero', () => {
110
+ const config = { enableHistoryCount: true, historyCount: 0 } as LobeAgentChatConfig;
111
+ const slicedMessages = chatHelpers.getSlicedMessagesWithConfig(messages, config);
112
+ expect(slicedMessages).toEqual([]);
113
+ });
108
114
  });
109
115
  });
@@ -14,13 +14,13 @@ const getSlicedMessagesWithConfig = (
14
14
  config: LobeAgentChatConfig,
15
15
  includeNewUserMessage?: boolean,
16
16
  ): ChatMessage[] => {
17
- // if historyCount is not enabled or set to 0, return all messages
18
- if (!config.enableHistoryCount || !config.historyCount) return messages;
17
+ // if historyCount is not enabled, return all messages
18
+ if (!config.enableHistoryCount || config.historyCount === undefined) return messages;
19
19
 
20
20
  // if user send message, history will include this message so the total length should +1
21
21
  const messagesCount = !!includeNewUserMessage ? config.historyCount + 1 : config.historyCount;
22
22
 
23
- // if historyCount is negative, return empty array
23
+ // if historyCount is negative or set to 0, return empty array
24
24
  if (messagesCount <= 0) return [];
25
25
 
26
26
  // if historyCount is positive, return last N messages
@@ -159,8 +159,8 @@ export interface AiProviderDetailItem {
159
159
  // Update
160
160
  export const UpdateAiProviderSchema = z.object({
161
161
  config: z.object({}).passthrough().optional(),
162
- description: z.string().optional(),
163
- logo: z.string().optional(),
162
+ description: z.string().nullable().optional(),
163
+ logo: z.string().nullable().optional(),
164
164
  name: z.string(),
165
165
  sdkType: z.enum(['openai', 'anthropic']).optional(),
166
166
  });