@lobehub/lobehub 2.0.0-next.140 → 2.0.0-next.142

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 (30) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/Dockerfile +2 -0
  3. package/apps/desktop/src/main/controllers/__tests__/McpInstallCtr.test.ts +286 -0
  4. package/apps/desktop/src/main/controllers/__tests__/NotificationCtr.test.ts +347 -0
  5. package/apps/desktop/src/main/controllers/__tests__/RemoteServerConfigCtr.test.ts +645 -0
  6. package/apps/desktop/src/main/controllers/__tests__/RemoteServerSyncCtr.test.ts +372 -0
  7. package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +276 -0
  8. package/apps/desktop/src/main/controllers/__tests__/UploadFileCtr.test.ts +171 -0
  9. package/apps/desktop/src/main/core/browser/__tests__/Browser.test.ts +573 -0
  10. package/apps/desktop/src/main/core/browser/__tests__/BrowserManager.test.ts +415 -0
  11. package/apps/desktop/src/main/core/infrastructure/__tests__/I18nManager.test.ts +353 -0
  12. package/apps/desktop/src/main/core/infrastructure/__tests__/IoCContainer.test.ts +156 -0
  13. package/apps/desktop/src/main/core/infrastructure/__tests__/ProtocolManager.test.ts +348 -0
  14. package/apps/desktop/src/main/core/infrastructure/__tests__/StaticFileServerManager.test.ts +481 -0
  15. package/apps/desktop/src/main/core/infrastructure/__tests__/StoreManager.test.ts +164 -0
  16. package/apps/desktop/src/main/core/infrastructure/__tests__/UpdaterManager.test.ts +513 -0
  17. package/changelog/v1.json +18 -0
  18. package/docs/development/database-schema.dbml +1 -2
  19. package/docs/self-hosting/environment-variables/model-provider.mdx +31 -0
  20. package/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx +30 -0
  21. package/package.json +1 -1
  22. package/packages/database/migrations/0055_rename_phone_number_to_phone.sql +4 -0
  23. package/packages/database/migrations/meta/0055_snapshot.json +8396 -0
  24. package/packages/database/migrations/meta/_journal.json +7 -0
  25. package/packages/database/src/core/migrations.json +11 -0
  26. package/packages/database/src/schemas/user.ts +1 -2
  27. package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +6 -3
  28. package/src/config/modelProviders/vertexai.ts +1 -1
  29. package/src/envs/llm.ts +4 -0
  30. package/src/server/modules/ModelRuntime/index.ts +4 -4
@@ -385,6 +385,13 @@
385
385
  "when": 1764579351312,
386
386
  "tag": "0054_better_auth_two_factor",
387
387
  "breakpoints": true
388
+ },
389
+ {
390
+ "idx": 55,
391
+ "version": "7",
392
+ "when": 1764583392443,
393
+ "tag": "0055_rename_phone_number_to_phone",
394
+ "breakpoints": true
388
395
  }
389
396
  ],
390
397
  "version": "6"
@@ -890,5 +890,16 @@
890
890
  "bps": true,
891
891
  "folderMillis": 1764579351312,
892
892
  "hash": "22fb7a65764b1f3e3c1ae2ce95d448685e6a01d1fb2f8c3f925c655f0824c161"
893
+ },
894
+ {
895
+ "sql": [
896
+ "ALTER TABLE \"users\" DROP CONSTRAINT IF EXISTS \"users_phone_number_unique\";",
897
+ "\nALTER TABLE \"users\" DROP COLUMN IF EXISTS \"phone_number\";",
898
+ "\nALTER TABLE \"users\" DROP CONSTRAINT IF EXISTS \"users_phone_unique\";",
899
+ "\nALTER TABLE \"users\" ADD CONSTRAINT \"users_phone_unique\" UNIQUE(\"phone\");\n"
900
+ ],
901
+ "bps": true,
902
+ "folderMillis": 1764583392443,
903
+ "hash": "6a43d90ee1d2e1e008d1b8206f227aa05b9a2e2a8fc8c31ec608a3716c716a6c"
893
904
  }
894
905
  ]
@@ -12,7 +12,7 @@ export const users = pgTable('users', {
12
12
  email: text('email').unique(),
13
13
 
14
14
  avatar: text('avatar'),
15
- phone: text('phone'),
15
+ phone: text('phone').unique(),
16
16
  firstName: text('first_name'),
17
17
  lastName: text('last_name'),
18
18
  fullName: text('full_name'),
@@ -38,7 +38,6 @@ export const users = pgTable('users', {
38
38
  twoFactorEnabled: boolean('two_factor_enabled').default(false),
39
39
 
40
40
  // better-auth phone number
41
- phoneNumber: text('phone_number').unique(),
42
41
  phoneNumberVerified: boolean('phone_number_verified'),
43
42
 
44
43
  ...timestamps,
@@ -368,8 +368,11 @@ export const createOpenAICompatibleRuntime = <T extends Record<string, any> = an
368
368
  this,
369
369
  ) as any;
370
370
  } else {
371
+ // Remove internal apiMode parameter before sending to API
372
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
373
+ const { apiMode: _, ...cleanedPayload } = postPayload as any;
371
374
  const finalPayload = {
372
- ...postPayload,
375
+ ...cleanedPayload,
373
376
  messages,
374
377
  ...(chatCompletion?.noUserId ? {} : { user: options?.user }),
375
378
  stream_options:
@@ -385,11 +388,11 @@ export const createOpenAICompatibleRuntime = <T extends Record<string, any> = an
385
388
  console.log(JSON.stringify(finalPayload), '\n');
386
389
  }
387
390
 
388
- response = await this.client.chat.completions.create(finalPayload, {
391
+ response = (await this.client.chat.completions.create(finalPayload, {
389
392
  // https://github.com/lobehub/lobe-chat/pull/318
390
393
  headers: { Accept: '*/*', ...options?.requestHeaders },
391
394
  signal: options?.signal,
392
- });
395
+ })) as unknown as Stream<OpenAI.Chat.Completions.ChatCompletionChunk>;
393
396
  }
394
397
 
395
398
  if (postPayload.stream) {
@@ -3,7 +3,7 @@ import { ModelProviderCard } from '@/types/llm';
3
3
  // ref: https://ai.google.dev/gemini-api/docs/models/gemini
4
4
  const VertexAI: ModelProviderCard = {
5
5
  chatModels: [],
6
- checkModel: 'gemini-1.5-flash-001',
6
+ checkModel: 'gemini-2.0-flash',
7
7
  description:
8
8
  'Google 的 Gemini 系列是其最先进、通用的 AI模型,由 Google DeepMind 打造,专为多模态设计,支持文本、代码、图像、音频和视频的无缝理解与处理。适用于从数据中心到移动设备的多种环境,极大提升了AI模型的效率与应用广泛性。',
9
9
  id: 'vertexai',
package/src/envs/llm.ts CHANGED
@@ -28,6 +28,8 @@ export const getLLMConfig = () => {
28
28
  ENABLED_GOOGLE: z.boolean(),
29
29
  GOOGLE_API_KEY: z.string().optional(),
30
30
 
31
+ ENABLED_VERTEXAI: z.boolean(),
32
+
31
33
  ENABLED_MOONSHOT: z.boolean(),
32
34
  MOONSHOT_API_KEY: z.string().optional(),
33
35
 
@@ -237,6 +239,8 @@ export const getLLMConfig = () => {
237
239
  ENABLED_GOOGLE: !!process.env.GOOGLE_API_KEY,
238
240
  GOOGLE_API_KEY: process.env.GOOGLE_API_KEY,
239
241
 
242
+ ENABLED_VERTEXAI: !!process.env.VERTEXAI_CREDENTIALS,
243
+
240
244
  ENABLED_VOLCENGINE: !!process.env.VOLCENGINE_API_KEY,
241
245
  VOLCENGINE_API_KEY: process.env.VOLCENGINE_API_KEY,
242
246
 
@@ -162,18 +162,18 @@ const buildVertexOptions = (
162
162
  payload: ClientSecretPayload,
163
163
  params: Partial<GoogleGenAIOptions> = {},
164
164
  ): GoogleGenAIOptions => {
165
- const rawCredentials = payload.apiKey ?? process.env.VERTEXAI_CREDENTIALS ?? '';
165
+ const rawCredentials = payload.apiKey || process.env.VERTEXAI_CREDENTIALS || '';
166
166
  const credentials = safeParseJSON<Record<string, string>>(rawCredentials);
167
167
 
168
168
  const projectFromParams = params.project as string | undefined;
169
169
  const projectFromCredentials = credentials?.project_id;
170
170
  const projectFromEnv = process.env.VERTEXAI_PROJECT;
171
171
 
172
- const project = projectFromParams ?? projectFromCredentials ?? projectFromEnv;
172
+ const project = projectFromParams || projectFromCredentials || projectFromEnv;
173
173
  const location =
174
- (params.location as string | undefined) ?? payload.vertexAIRegion ?? process.env.VERTEXAI_LOCATION ?? undefined;
174
+ (params.location as string | undefined) || payload.vertexAIRegion || process.env.VERTEXAI_LOCATION || undefined;
175
175
 
176
- const googleAuthOptions = params.googleAuthOptions ?? (credentials ? { credentials } : undefined);
176
+ const googleAuthOptions = params.googleAuthOptions || (credentials ? { credentials } : undefined);
177
177
 
178
178
  const options: GoogleGenAIOptions = {
179
179
  ...params,