@lobehub/lobehub 2.0.0-next.232 → 2.0.0-next.234

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 (112) hide show
  1. package/.github/workflows/bundle-analyzer.yml +1 -1
  2. package/.github/workflows/e2e.yml +62 -53
  3. package/.github/workflows/manual-build-desktop.yml +5 -5
  4. package/.github/workflows/pr-build-desktop.yml +4 -4
  5. package/.github/workflows/pr-build-docker.yml +2 -2
  6. package/.github/workflows/release-desktop-beta.yml +4 -4
  7. package/.github/workflows/release-docker.yml +2 -2
  8. package/.github/workflows/test.yml +44 -7
  9. package/CHANGELOG.md +59 -0
  10. package/CLAUDE.md +1 -1
  11. package/changelog/v1.json +14 -0
  12. package/docs/development/basic/feature-development.mdx +4 -5
  13. package/docs/development/basic/feature-development.zh-CN.mdx +4 -5
  14. package/docs/self-hosting/environment-variables/auth.mdx +7 -0
  15. package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +7 -0
  16. package/e2e/README.md +6 -6
  17. package/e2e/src/features/community/detail-pages.feature +9 -9
  18. package/e2e/src/features/community/interactions.feature +13 -13
  19. package/e2e/src/features/community/smoke.feature +6 -6
  20. package/e2e/src/steps/agent/conversation-mgmt.steps.ts +196 -25
  21. package/e2e/src/steps/agent/conversation.steps.ts +58 -0
  22. package/e2e/src/steps/agent/message-ops.steps.ts +20 -15
  23. package/e2e/src/steps/community/detail-pages.steps.ts +60 -19
  24. package/e2e/src/steps/community/interactions.steps.ts +145 -32
  25. package/e2e/src/steps/hooks.ts +12 -2
  26. package/locales/en-US/setting.json +3 -0
  27. package/locales/zh-CN/file.json +4 -0
  28. package/locales/zh-CN/setting.json +3 -0
  29. package/package.json +5 -5
  30. package/packages/business/config/src/llm.ts +6 -1
  31. package/packages/const/src/index.ts +1 -0
  32. package/packages/const/src/lobehubSkill.ts +55 -0
  33. package/packages/const/src/settings/image.ts +1 -1
  34. package/packages/model-bank/src/aiModels/azure.ts +2 -2
  35. package/packages/model-bank/src/aiModels/google.ts +1 -0
  36. package/packages/model-bank/src/aiModels/lobehub.ts +33 -13
  37. package/packages/model-bank/src/aiModels/openai.ts +21 -4
  38. package/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts +4 -1
  39. package/packages/model-runtime/src/providers/openai/__snapshots__/index.test.ts.snap +1 -1
  40. package/packages/ssrf-safe-fetch/index.test.ts +5 -34
  41. package/packages/ssrf-safe-fetch/index.ts +12 -2
  42. package/packages/types/package.json +1 -1
  43. package/packages/types/src/files/upload.ts +11 -1
  44. package/packages/types/src/message/common/tools.ts +1 -1
  45. package/packages/types/src/serverConfig.ts +1 -0
  46. package/public/not-compatible.html +1296 -0
  47. package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx +3 -3
  48. package/src/app/[variants]/(main)/image/features/GenerationFeed/index.tsx +3 -10
  49. package/src/app/[variants]/(main)/image/index.tsx +1 -1
  50. package/src/app/[variants]/(main)/resource/features/FileDetail.tsx +20 -12
  51. package/src/app/[variants]/(main)/resource/features/modal/FullscreenModal.tsx +2 -4
  52. package/src/app/[variants]/layout.tsx +50 -1
  53. package/src/envs/auth.ts +15 -0
  54. package/src/features/ChatInput/ActionBar/Tools/LobehubSkillServerItem.tsx +304 -0
  55. package/src/features/ChatInput/ActionBar/Tools/useControls.tsx +74 -10
  56. package/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/ToolTitle.tsx +9 -0
  57. package/src/features/FileViewer/Renderer/Code/index.tsx +224 -0
  58. package/src/features/FileViewer/Renderer/Image/index.tsx +8 -1
  59. package/src/features/FileViewer/Renderer/PDF/index.tsx +3 -1
  60. package/src/features/FileViewer/Renderer/PDF/style.ts +2 -1
  61. package/src/features/FileViewer/index.tsx +135 -24
  62. package/src/features/PageEditor/EditorCanvas/useSlashItems.tsx +7 -4
  63. package/src/features/PageEditor/store/initialState.ts +2 -1
  64. package/src/features/ResourceManager/components/Editor/FileContent.tsx +1 -4
  65. package/src/features/ResourceManager/components/Editor/FileCopilot.tsx +64 -0
  66. package/src/features/ResourceManager/components/Editor/index.tsx +98 -31
  67. package/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx +3 -2
  68. package/src/features/ResourceManager/components/Explorer/ListView/ColumnResizeHandle.tsx +119 -0
  69. package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +67 -22
  70. package/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx +46 -11
  71. package/src/features/ResourceManager/components/Explorer/ListView/index.tsx +140 -81
  72. package/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx +20 -12
  73. package/src/features/ResourceManager/components/Explorer/ToolBar/ViewSwitcher.tsx +18 -10
  74. package/src/features/ResourceManager/components/UploadDock/Item.tsx +38 -6
  75. package/src/features/ResourceManager/components/UploadDock/index.tsx +62 -41
  76. package/src/features/ResourceManager/index.tsx +1 -0
  77. package/src/helpers/toolEngineering/index.test.ts +3 -0
  78. package/src/helpers/toolEngineering/index.ts +12 -1
  79. package/src/hooks/useFetchAiImageConfig.ts +54 -10
  80. package/src/libs/trpc/utils/internalJwt.ts +2 -2
  81. package/src/locales/default/file.ts +4 -0
  82. package/src/locales/default/setting.ts +3 -0
  83. package/src/server/globalConfig/index.ts +1 -0
  84. package/src/server/modules/ModelRuntime/index.test.ts +214 -1
  85. package/src/server/modules/ModelRuntime/index.ts +43 -7
  86. package/src/server/routers/lambda/document.ts +44 -0
  87. package/src/server/routers/tools/market.ts +261 -0
  88. package/src/server/services/document/index.ts +22 -0
  89. package/src/services/document/index.ts +4 -0
  90. package/src/services/upload.ts +22 -2
  91. package/src/store/chat/slices/plugin/actions/internals.ts +15 -2
  92. package/src/store/chat/slices/plugin/actions/pluginTypes.ts +104 -0
  93. package/src/store/file/slices/fileManager/action.test.ts +9 -3
  94. package/src/store/file/slices/fileManager/action.ts +165 -70
  95. package/src/store/file/slices/upload/action.ts +3 -0
  96. package/src/store/global/actions/general.ts +15 -0
  97. package/src/store/global/initialState.ts +13 -0
  98. package/src/store/image/slices/generationConfig/initialState.ts +5 -5
  99. package/src/store/image/slices/generationConfig/selectors.test.ts +11 -4
  100. package/src/store/serverConfig/selectors.ts +1 -0
  101. package/src/store/tool/initialState.ts +11 -2
  102. package/src/store/tool/selectors/index.ts +1 -0
  103. package/src/store/tool/selectors/tool.ts +3 -1
  104. package/src/store/tool/slices/lobehubSkillStore/action.ts +361 -0
  105. package/src/store/tool/slices/lobehubSkillStore/index.ts +4 -0
  106. package/src/store/tool/slices/lobehubSkillStore/initialState.ts +24 -0
  107. package/src/store/tool/slices/lobehubSkillStore/selectors.ts +145 -0
  108. package/src/store/tool/slices/lobehubSkillStore/types.ts +100 -0
  109. package/src/store/tool/store.ts +8 -2
  110. package/vitest.config.mts +11 -6
  111. package/src/features/FileViewer/Renderer/JavaScript/index.tsx +0 -66
  112. package/src/features/FileViewer/Renderer/TXT/index.tsx +0 -50
@@ -1063,6 +1063,14 @@ export const nanoBananaProParameters: ModelParamsSchema = {
1063
1063
  },
1064
1064
  };
1065
1065
 
1066
+ const gptImage1Schema = {
1067
+ imageUrls: { default: [], maxCount: 1, maxFileSize: 5 },
1068
+ prompt: { default: '' },
1069
+ size: {
1070
+ default: 'auto',
1071
+ enum: ['auto', '1024x1024', '1536x1024', '1024x1536'],
1072
+ },
1073
+ };
1066
1074
  const lobehubImageModels: AIImageModelCard[] = [
1067
1075
  {
1068
1076
  description:
@@ -1104,7 +1112,7 @@ const lobehubImageModels: AIImageModelCard[] = [
1104
1112
  {
1105
1113
  description: 'Imagen 4th generation text-to-image model series',
1106
1114
  displayName: 'Imagen 4 Fast',
1107
- enabled: false,
1115
+ enabled: true,
1108
1116
  id: 'imagen-4.0-fast-generate-001',
1109
1117
  organization: 'Deepmind',
1110
1118
  parameters: imagenBaseParameters,
@@ -1117,7 +1125,7 @@ const lobehubImageModels: AIImageModelCard[] = [
1117
1125
  {
1118
1126
  description: 'Imagen 4th generation text-to-image model series',
1119
1127
  displayName: 'Imagen 4',
1120
- enabled: false,
1128
+ enabled: true,
1121
1129
  id: 'imagen-4.0-generate-001',
1122
1130
  organization: 'Deepmind',
1123
1131
  parameters: imagenBaseParameters,
@@ -1130,7 +1138,7 @@ const lobehubImageModels: AIImageModelCard[] = [
1130
1138
  {
1131
1139
  description: 'Imagen 4th generation text-to-image model series Ultra version',
1132
1140
  displayName: 'Imagen 4 Ultra',
1133
- enabled: false,
1141
+ enabled: true,
1134
1142
  id: 'imagen-4.0-ultra-generate-001',
1135
1143
  organization: 'Deepmind',
1136
1144
  parameters: imagenBaseParameters,
@@ -1140,19 +1148,32 @@ const lobehubImageModels: AIImageModelCard[] = [
1140
1148
  releasedAt: '2025-08-15',
1141
1149
  type: 'image',
1142
1150
  },
1151
+ {
1152
+ description:
1153
+ 'An enhanced GPT Image 1 model with 4× faster generation, more precise editing, and improved text rendering.',
1154
+ displayName: 'GPT Image 1.5',
1155
+ enabled: true,
1156
+ id: 'gpt-image-1.5',
1157
+ parameters: gptImage1Schema,
1158
+ pricing: {
1159
+ approximatePricePerImage: 0.034,
1160
+ units: [
1161
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
1162
+ { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
1163
+ { name: 'imageInput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
1164
+ { name: 'imageInput_cacheRead', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
1165
+ { name: 'imageOutput', rate: 32, strategy: 'fixed', unit: 'millionTokens' },
1166
+ ],
1167
+ },
1168
+ releasedAt: '2025-12-16',
1169
+ type: 'image',
1170
+ },
1143
1171
  {
1144
1172
  description: 'ChatGPT native multimodal image generation model.',
1145
1173
  displayName: 'GPT Image 1',
1146
1174
  enabled: true,
1147
1175
  id: 'gpt-image-1',
1148
- parameters: {
1149
- imageUrls: { default: [], maxCount: 1, maxFileSize: 5 },
1150
- prompt: { default: '' },
1151
- size: {
1152
- default: 'auto',
1153
- enum: ['auto', '1024x1024', '1536x1024', '1024x1536'],
1154
- },
1155
- },
1176
+ parameters: gptImage1Schema,
1156
1177
  pricing: {
1157
1178
  approximatePricePerImage: 0.042,
1158
1179
  units: [
@@ -1169,7 +1190,7 @@ const lobehubImageModels: AIImageModelCard[] = [
1169
1190
  description:
1170
1191
  'The latest DALL·E model, released in November 2023, supports more realistic, accurate image generation with stronger detail.',
1171
1192
  displayName: 'DALL·E 3',
1172
- enabled: false,
1193
+ enabled: true,
1173
1194
  id: 'dall-e-3',
1174
1195
  parameters: {
1175
1196
  prompt: { default: '' },
@@ -1203,7 +1224,6 @@ const lobehubImageModels: AIImageModelCard[] = [
1203
1224
  },
1204
1225
  ],
1205
1226
  },
1206
- resolutions: ['1024x1024', '1024x1792', '1792x1024'],
1207
1227
  type: 'image',
1208
1228
  },
1209
1229
  {
@@ -1219,6 +1219,26 @@ export const openaiSTTModels: AISTTModelCard[] = [
1219
1219
 
1220
1220
  // Image generation models
1221
1221
  export const openaiImageModels: AIImageModelCard[] = [
1222
+ {
1223
+ description:
1224
+ 'An enhanced GPT Image 1 model with 4× faster generation, more precise editing, and improved text rendering.',
1225
+ displayName: 'GPT Image 1.5',
1226
+ enabled: true,
1227
+ id: 'gpt-image-1.5',
1228
+ parameters: gptImage1ParamsSchema,
1229
+ pricing: {
1230
+ approximatePricePerImage: 0.034,
1231
+ units: [
1232
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
1233
+ { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
1234
+ { name: 'imageInput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
1235
+ { name: 'imageInput_cacheRead', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
1236
+ { name: 'imageOutput', rate: 32, strategy: 'fixed', unit: 'millionTokens' },
1237
+ ],
1238
+ },
1239
+ releasedAt: '2025-12-16',
1240
+ type: 'image',
1241
+ },
1222
1242
  // https://platform.openai.com/docs/models/gpt-image-1
1223
1243
  {
1224
1244
  description: 'ChatGPT native multimodal image generation model.',
@@ -1236,7 +1256,6 @@ export const openaiImageModels: AIImageModelCard[] = [
1236
1256
  { name: 'imageOutput', rate: 40, strategy: 'fixed', unit: 'millionTokens' },
1237
1257
  ],
1238
1258
  },
1239
- resolutions: ['1024x1024', '1024x1536', '1536x1024'],
1240
1259
  type: 'image',
1241
1260
  },
1242
1261
  {
@@ -1257,13 +1276,13 @@ export const openaiImageModels: AIImageModelCard[] = [
1257
1276
  ],
1258
1277
  },
1259
1278
  releasedAt: '2025-10-06',
1260
- resolutions: ['1024x1024', '1024x1536', '1536x1024'],
1261
1279
  type: 'image',
1262
1280
  },
1263
1281
  {
1264
1282
  description:
1265
1283
  'The latest DALL·E model, released in November 2023, supports more realistic, accurate image generation with stronger detail.',
1266
1284
  displayName: 'DALL·E 3',
1285
+ enabled: true,
1267
1286
  id: 'dall-e-3',
1268
1287
  parameters: {
1269
1288
  prompt: { default: '' },
@@ -1296,7 +1315,6 @@ export const openaiImageModels: AIImageModelCard[] = [
1296
1315
  },
1297
1316
  ],
1298
1317
  },
1299
- resolutions: ['1024x1024', '1024x1792', '1792x1024'],
1300
1318
  type: 'image',
1301
1319
  },
1302
1320
  {
@@ -1329,7 +1347,6 @@ export const openaiImageModels: AIImageModelCard[] = [
1329
1347
  },
1330
1348
  ],
1331
1349
  },
1332
- resolutions: ['256x256', '512x512', '1024x1024'],
1333
1350
  type: 'image',
1334
1351
  },
1335
1352
  ];
@@ -67,7 +67,10 @@ async function generateByImageMode(
67
67
  const defaultInput = {
68
68
  n: 1,
69
69
  ...(model.includes('dall-e') ? { response_format: 'b64_json' } : {}),
70
- ...(isImageEdit && model === 'gpt-image-1' ? { input_fidelity: 'high' } : {}),
70
+ // https://platform.openai.com/docs/api-reference/images/createEdit#images_createedit-input_fidelity
71
+ ...(isImageEdit && model.includes('gpt-image-') && !model.includes('mini')
72
+ ? { input_fidelity: 'high' }
73
+ : {}),
71
74
  };
72
75
 
73
76
  const options = cleanObject({
@@ -311,7 +311,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
311
311
  "contextWindowTokens": undefined,
312
312
  "description": "The latest DALL·E model, released in November 2023, supports more realistic, accurate image generation with stronger detail.",
313
313
  "displayName": "DALL·E 3",
314
- "enabled": false,
314
+ "enabled": true,
315
315
  "functionCall": false,
316
316
  "id": "dall-e-3",
317
317
  "imageOutput": false,
@@ -49,14 +49,7 @@ describe('ssrfSafeFetch', () => {
49
49
  expect(mockFetch).toHaveBeenCalledWith(
50
50
  'https://httpbin.org/get',
51
51
  expect.objectContaining({
52
- agent: expect.objectContaining({
53
- requestFilterOptions: expect.objectContaining({
54
- allowIPAddressList: [],
55
- allowMetaIPAddress: false,
56
- allowPrivateIPAddress: false,
57
- denyIPAddressList: [],
58
- }),
59
- }),
52
+ agent: expect.any(Function),
60
53
  }),
61
54
  );
62
55
  expect(response).toBeInstanceOf(Response);
@@ -80,14 +73,7 @@ describe('ssrfSafeFetch', () => {
80
73
  'https://httpbin.org/post',
81
74
  expect.objectContaining({
82
75
  ...requestOptions,
83
- agent: expect.objectContaining({
84
- requestFilterOptions: expect.objectContaining({
85
- allowIPAddressList: [],
86
- allowMetaIPAddress: false,
87
- allowPrivateIPAddress: false,
88
- denyIPAddressList: [],
89
- }),
90
- }),
76
+ agent: expect.any(Function),
91
77
  }),
92
78
  );
93
79
  });
@@ -302,14 +288,7 @@ describe('ssrfSafeFetch', () => {
302
288
  'https://api.example.com/data',
303
289
  expect.objectContaining({
304
290
  ...requestOptions,
305
- agent: expect.objectContaining({
306
- requestFilterOptions: expect.objectContaining({
307
- allowIPAddressList: ['127.0.0.1'],
308
- allowMetaIPAddress: true,
309
- allowPrivateIPAddress: true,
310
- denyIPAddressList: [],
311
- }),
312
- }),
291
+ agent: expect.any(Function),
313
292
  }),
314
293
  );
315
294
 
@@ -323,19 +302,11 @@ describe('ssrfSafeFetch', () => {
323
302
 
324
303
  await ssrfSafeFetch('https://secure.example.com/api');
325
304
 
326
- // Verify that the agent is properly configured for HTTPS
305
+ // Verify that the agent function is passed
327
306
  expect(mockFetch).toHaveBeenCalledWith(
328
307
  'https://secure.example.com/api',
329
308
  expect.objectContaining({
330
- agent: expect.objectContaining({
331
- protocol: 'https:',
332
- requestFilterOptions: expect.objectContaining({
333
- allowIPAddressList: [],
334
- allowMetaIPAddress: false,
335
- allowPrivateIPAddress: false,
336
- denyIPAddressList: [],
337
- }),
338
- }),
309
+ agent: expect.any(Function),
339
310
  }),
340
311
  );
341
312
  });
@@ -1,5 +1,9 @@
1
1
  import fetch from 'node-fetch';
2
- import { RequestFilteringAgentOptions, useAgent as ssrfAgent } from 'request-filtering-agent';
2
+ import {
3
+ RequestFilteringAgentOptions,
4
+ RequestFilteringHttpAgent,
5
+ RequestFilteringHttpsAgent,
6
+ } from 'request-filtering-agent';
3
7
 
4
8
  /**
5
9
  * Options for per-call SSRF configuration overrides
@@ -42,10 +46,16 @@ export const ssrfSafeFetch = async (
42
46
  denyIPAddressList: [],
43
47
  };
44
48
 
49
+ // Create agents for both protocols
50
+ const httpAgent = new RequestFilteringHttpAgent(agentOptions);
51
+ const httpsAgent = new RequestFilteringHttpsAgent(agentOptions);
52
+
45
53
  // Use node-fetch with SSRF protection agent
54
+ // Pass a function to dynamically select agent based on URL protocol
55
+ // This handles redirects from HTTP to HTTPS correctly
46
56
  const response = await fetch(url, {
47
57
  ...options,
48
- agent: ssrfAgent(url, agentOptions),
58
+ agent: (parsedURL: URL) => (parsedURL.protocol === 'https:' ? httpsAgent : httpAgent),
49
59
  } as any);
50
60
 
51
61
  // Convert node-fetch Response to standard Response
@@ -8,7 +8,7 @@
8
8
  "@lobechat/python-interpreter": "workspace:*",
9
9
  "@lobechat/web-crawler": "workspace:*",
10
10
  "@lobehub/chat-plugin-sdk": "^1.32.4",
11
- "@lobehub/market-sdk": "beta",
11
+ "@lobehub/market-sdk": "0.28.0",
12
12
  "@lobehub/market-types": "^1.11.4",
13
13
  "model-bank": "workspace:*",
14
14
  "type-fest": "^4.41.0",
@@ -14,7 +14,13 @@ export interface FileUploadState {
14
14
  speed: number;
15
15
  }
16
16
 
17
- export type FileUploadStatus = 'pending' | 'uploading' | 'processing' | 'success' | 'error';
17
+ export type FileUploadStatus =
18
+ | 'pending'
19
+ | 'uploading'
20
+ | 'processing'
21
+ | 'success'
22
+ | 'error'
23
+ | 'cancelled';
18
24
 
19
25
  export type FileProcessStatus = 'pending' | 'chunking' | 'embedding' | 'success' | 'error';
20
26
 
@@ -22,6 +28,10 @@ export const UPLOAD_STATUS_SET = new Set(['uploading', 'pending', 'processing'])
22
28
 
23
29
  // the file that is upload at chat page
24
30
  export interface UploadFileItem {
31
+ /**
32
+ * AbortController to cancel the upload
33
+ */
34
+ abortController?: AbortController;
25
35
  /**
26
36
  * base64 data, it will use in other data
27
37
  */
@@ -26,7 +26,7 @@ export interface ChatPluginPayload {
26
26
  /**
27
27
  * Tool source indicates where the tool comes from
28
28
  */
29
- export type ToolSource = 'builtin' | 'plugin' | 'mcp' | 'klavis';
29
+ export type ToolSource = 'builtin' | 'plugin' | 'mcp' | 'klavis' | 'lobehubSkill';
30
30
 
31
31
  export interface ChatToolPayload {
32
32
  apiName: string;
@@ -51,6 +51,7 @@ export interface GlobalServerConfig {
51
51
  defaultAgent?: PartialDeep<UserDefaultAgent>;
52
52
  enableEmailVerification?: boolean;
53
53
  enableKlavis?: boolean;
54
+ enableLobehubSkill?: boolean;
54
55
  enableMagicLink?: boolean;
55
56
  enableMarketTrustedClient?: boolean;
56
57
  enableUploadFileToServer?: boolean;