@lobehub/chat 1.35.5 → 1.35.6

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,39 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.35.6](https://github.com/lobehub/lobe-chat/compare/v1.35.5...v1.35.6)
6
+
7
+ <sup>Released on **2024-12-02**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Add user server api key method in the server mode.
12
+
13
+ #### 💄 Styles
14
+
15
+ - **misc**: Add QwQ 32B Preview model.
16
+
17
+ <br/>
18
+
19
+ <details>
20
+ <summary><kbd>Improvements and Fixes</kbd></summary>
21
+
22
+ #### Code refactoring
23
+
24
+ - **misc**: Add user server api key method in the server mode, closes [#4870](https://github.com/lobehub/lobe-chat/issues/4870) ([875463a](https://github.com/lobehub/lobe-chat/commit/875463a))
25
+
26
+ #### Styles
27
+
28
+ - **misc**: Add QwQ 32B Preview model, closes [#4867](https://github.com/lobehub/lobe-chat/issues/4867) ([edd93e0](https://github.com/lobehub/lobe-chat/commit/edd93e0))
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.35.5](https://github.com/lobehub/lobe-chat/compare/v1.35.4...v1.35.5)
6
39
 
7
40
  <sup>Released on **2024-12-02**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "improvements": [
5
+ "Add QwQ 32B Preview model."
6
+ ]
7
+ },
8
+ "date": "2024-12-02",
9
+ "version": "1.35.6"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "improvements": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.35.5",
3
+ "version": "1.35.6",
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",
@@ -27,6 +27,12 @@ const HuggingFace: ModelProviderCard = {
27
27
  id: 'Qwen/Qwen2.5-Coder-32B-Instruct',
28
28
  tokens: 32_768,
29
29
  },
30
+ {
31
+ description: 'Qwen QwQ 是由 Qwen 团队开发的实验研究模型,专注于提升AI推理能力。',
32
+ displayName: 'QwQ 32B Preview',
33
+ id: 'Qwen/QwQ-32B-Preview',
34
+ tokens: 32_768,
35
+ },
30
36
  {
31
37
  displayName: 'Phi 3.5 mini instruct',
32
38
  id: 'microsoft/Phi-3.5-mini-instruct',
@@ -5,7 +5,7 @@ import { DeepPartial } from 'utility-types';
5
5
  import { serverDB } from '@/database/server/core/db';
6
6
  import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
7
7
  import { UserGuide, UserPreference } from '@/types/user';
8
- import { UserSettings } from '@/types/user/settings';
8
+ import { UserKeyVaults, UserSettings } from '@/types/user/settings';
9
9
  import { merge } from '@/utils/merge';
10
10
 
11
11
  import { NewUser, UserItem, userSettings, users } from '../schemas/lobechat';
@@ -105,6 +105,38 @@ export class UserModel {
105
105
  };
106
106
  };
107
107
 
108
+ static getUserApiKeys = async (id: string) => {
109
+ const result = await serverDB
110
+ .select({
111
+ settingsKeyVaults: userSettings.keyVaults,
112
+ })
113
+ .from(userSettings)
114
+ .where(eq(userSettings.id, id));
115
+
116
+ if (!result || !result[0]) {
117
+ throw new UserNotFoundError();
118
+ }
119
+
120
+ const state = result[0];
121
+
122
+ // Decrypt keyVaults
123
+ let decryptKeyVaults = {};
124
+ if (state.settingsKeyVaults) {
125
+ const gateKeeper = await KeyVaultsGateKeeper.initWithEnvKey();
126
+ const { wasAuthentic, plaintext } = await gateKeeper.decrypt(state.settingsKeyVaults);
127
+
128
+ if (wasAuthentic) {
129
+ try {
130
+ decryptKeyVaults = JSON.parse(plaintext);
131
+ } catch (e) {
132
+ console.error(`Failed to parse keyVaults ,userId: ${id}. Error:`, e);
133
+ }
134
+ }
135
+ }
136
+
137
+ return decryptKeyVaults as UserKeyVaults;
138
+ };
139
+
108
140
  async updateUser(id: string, value: Partial<UserItem>) {
109
141
  return serverDB
110
142
  .update(users)