@lobehub/lobehub 2.0.0-next.62 → 2.0.0-next.64

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 (89) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v1.json +18 -0
  3. package/locales/ar/plugin.json +2 -0
  4. package/locales/bg-BG/plugin.json +2 -0
  5. package/locales/de-DE/plugin.json +2 -0
  6. package/locales/en-US/plugin.json +8 -1
  7. package/locales/es-ES/plugin.json +2 -0
  8. package/locales/fa-IR/plugin.json +2 -0
  9. package/locales/fr-FR/plugin.json +2 -0
  10. package/locales/it-IT/plugin.json +2 -0
  11. package/locales/ja-JP/plugin.json +2 -0
  12. package/locales/ko-KR/plugin.json +2 -0
  13. package/locales/nl-NL/plugin.json +2 -0
  14. package/locales/pl-PL/plugin.json +2 -0
  15. package/locales/pt-BR/plugin.json +2 -0
  16. package/locales/ru-RU/plugin.json +2 -0
  17. package/locales/tr-TR/plugin.json +2 -0
  18. package/locales/vi-VN/plugin.json +2 -0
  19. package/locales/zh-CN/plugin.json +8 -1
  20. package/locales/zh-TW/plugin.json +2 -0
  21. package/package.json +1 -2
  22. package/packages/agent-runtime/src/types/event.ts +2 -1
  23. package/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts +1 -2
  24. package/packages/database/src/client/db.test.ts +1 -2
  25. package/packages/database/src/client/db.ts +6 -6
  26. package/packages/database/src/core/electron.ts +1 -1
  27. package/packages/database/src/models/__tests__/asyncTask.test.ts +1 -2
  28. package/packages/database/src/models/__tests__/file.test.ts +1 -2
  29. package/packages/database/src/models/__tests__/generation.test.ts +1 -2
  30. package/packages/database/src/models/__tests__/generationBatch.test.ts +1 -2
  31. package/packages/database/src/models/aiProvider.ts +7 -7
  32. package/packages/database/src/repositories/aiInfra/index.test.ts +6 -6
  33. package/packages/database/src/repositories/aiInfra/index.ts +7 -7
  34. package/packages/database/src/repositories/dataImporter/__tests__/index.test.ts +1 -2
  35. package/packages/database/src/repositories/dataImporter/deprecated/__tests__/index.test.ts +1 -1
  36. package/packages/database/src/repositories/dataImporter/deprecated/index.ts +1 -1
  37. package/packages/database/src/repositories/dataImporter/index.ts +1 -2
  38. package/packages/database/src/repositories/tableViewer/index.ts +4 -5
  39. package/packages/database/src/schemas/agent.ts +1 -2
  40. package/packages/database/src/schemas/aiInfra.ts +1 -2
  41. package/packages/database/src/schemas/document.ts +1 -2
  42. package/packages/database/src/schemas/file.ts +1 -2
  43. package/packages/database/src/schemas/topic.ts +1 -2
  44. package/packages/database/src/schemas/user.ts +1 -1
  45. package/packages/database/src/server/models/__tests__/user.test.ts +1 -1
  46. package/packages/model-runtime/src/core/streams/vertex-ai.ts +1 -2
  47. package/packages/model-runtime/src/providers/comfyui/__tests__/index.test.ts +1 -2
  48. package/packages/model-runtime/src/providers/comfyui/auth/AuthManager.ts +1 -2
  49. package/packages/model-runtime/src/providers/comfyui/index.ts +2 -7
  50. package/packages/types/src/files/list.ts +1 -1
  51. package/packages/types/src/files/upload.ts +1 -1
  52. package/packages/types/src/importer.ts +2 -2
  53. package/packages/types/src/index.ts +4 -0
  54. package/packages/types/src/openai/image.ts +1 -1
  55. package/packages/types/src/topic/topic.ts +1 -1
  56. package/packages/types/src/user/settings/hotkey.ts +1 -1
  57. package/src/components/FileIcon/index.tsx +0 -2
  58. package/src/features/Conversation/Messages/Assistant/MessageContent.tsx +0 -18
  59. package/src/features/Conversation/Messages/Group/Tool/Inspector/index.tsx +26 -5
  60. package/src/features/Conversation/Messages/Group/Tool/index.tsx +1 -1
  61. package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/ToolTitle.tsx +1 -7
  62. package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/index.tsx +2 -15
  63. package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/CustomRender.tsx +1 -1
  64. package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/PluginSettings.tsx +2 -2
  65. package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/index.tsx +2 -31
  66. package/src/features/Conversation/Messages/Tool/ToolItem.tsx +51 -0
  67. package/src/features/Conversation/Messages/Tool/index.tsx +58 -0
  68. package/src/features/Conversation/Messages/index.tsx +5 -0
  69. package/src/features/DataImporter/index.tsx +2 -2
  70. package/src/features/ShareModal/ShareJSON/index.tsx +2 -2
  71. package/src/locales/default/plugin.ts +8 -0
  72. package/src/store/chat/slices/message/action.test.ts +8 -4
  73. package/src/store/chat/slices/message/actions/optimisticUpdate.ts +12 -0
  74. package/src/store/chat/slices/message/actions/publicApi.ts +19 -17
  75. package/src/tools/local-system/index.ts +27 -27
  76. package/src/tools/local-system/systemRole.ts +7 -7
  77. package/Dockerfile.lite +0 -272
  78. package/src/features/Conversation/Messages/Assistant/Tool/Render/LoadingPlaceholder/index.tsx +0 -29
  79. package/src/features/Conversation/Messages/Assistant/Tool/index.tsx +0 -76
  80. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/BuiltinPluginTitle.tsx +0 -0
  81. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/Debug.tsx +0 -0
  82. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/PluginResult.tsx +0 -0
  83. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/PluginState.tsx +0 -0
  84. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/Settings.tsx +0 -0
  85. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/Arguments/ObjectEntity.tsx +0 -0
  86. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/Arguments/ValueCell.tsx +0 -0
  87. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/Arguments/index.tsx +0 -0
  88. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/ErrorResponse.tsx +0 -0
  89. /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/KeyValueEditor.tsx +0 -0
@@ -227,13 +227,16 @@ describe('chatMessage actions', () => {
227
227
  expect(replaceMessagesSpy).toHaveBeenCalledWith(mockMessages);
228
228
  });
229
229
 
230
- it('deleteMessage should remove messages with tools', async () => {
230
+ it('deleteMessage should remove the message only', async () => {
231
231
  const { result } = renderHook(() => useChatStore());
232
232
  const messageId = 'message-id';
233
233
  const removeMessagesSpy = vi.spyOn(messageService, 'removeMessages');
234
- const mockMessages = [{ id: 'remaining-message' }] as any;
234
+ const mockMessages = [
235
+ { id: '2', tool_call_id: 'tool1', role: 'tool' },
236
+ { id: '3', tool_call_id: 'tool2', role: 'tool' },
237
+ ] as any;
235
238
 
236
- // Mock the service to return messages
239
+ // Mock the service to return remaining messages (orphaned tool messages)
237
240
  (messageService.removeMessages as Mock).mockResolvedValue({
238
241
  success: true,
239
242
  messages: mockMessages,
@@ -258,7 +261,8 @@ describe('chatMessage actions', () => {
258
261
  await result.current.deleteMessage(messageId);
259
262
  });
260
263
 
261
- expect(removeMessagesSpy).toHaveBeenCalledWith([messageId, '2', '3'], {
264
+ // Only the message itself should be deleted, tool messages remain as orphaned
265
+ expect(removeMessagesSpy).toHaveBeenCalledWith([messageId], {
262
266
  sessionId: 'session-id',
263
267
  topicId: undefined,
264
268
  });
@@ -41,6 +41,7 @@ export interface MessageOptimisticUpdateAction {
41
41
  * delete the message content with optimistic update
42
42
  */
43
43
  optimisticDeleteMessage: (id: string) => Promise<void>;
44
+ optimisticDeleteMessages: (ids: string[]) => Promise<void>;
44
45
 
45
46
  /**
46
47
  * update the message content with optimistic update
@@ -154,6 +155,17 @@ export const messageOptimisticUpdate: StateCreator<
154
155
  }
155
156
  },
156
157
 
158
+ optimisticDeleteMessages: async (ids) => {
159
+ get().internal_dispatchMessage({ ids, type: 'deleteMessages' });
160
+ const result = await messageService.removeMessages(ids, {
161
+ sessionId: get().activeId,
162
+ topicId: get().activeTopicId,
163
+ });
164
+ if (result?.success && result.messages) {
165
+ get().replaceMessages(result.messages);
166
+ }
167
+ },
168
+
157
169
  optimisticUpdateMessageContent: async (id, content, extra) => {
158
170
  const {
159
171
  internal_dispatchMessage,
@@ -31,6 +31,7 @@ export interface MessagePublicApiAction {
31
31
  */
32
32
  clearMessage: () => Promise<void>;
33
33
  deleteMessage: (id: string) => Promise<void>;
34
+ deleteAssistantMessage: (id: string) => Promise<void>;
34
35
  deleteDBMessage: (id: string) => Promise<void>;
35
36
  deleteToolMessage: (id: string) => Promise<void>;
36
37
  clearAllMessages: () => Promise<void>;
@@ -97,12 +98,28 @@ export const messagePublicApi: StateCreator<
97
98
  }
98
99
  },
99
100
 
101
+ deleteAssistantMessage: async (id) => {
102
+ const message = dbMessageSelectors.getDbMessageById(id)(get());
103
+ if (!message) return;
104
+
105
+ let ids = [message.id];
106
+ if (message.tools) {
107
+ const allMessages = dbMessageSelectors.activeDbMessages(get());
108
+
109
+ const toolMessageIds = message.tools.flatMap((tool) => {
110
+ const messages = allMessages.filter((m) => m.tool_call_id === tool.id);
111
+ return messages.map((m) => m.id);
112
+ });
113
+ ids = ids.concat(toolMessageIds);
114
+ }
115
+
116
+ await get().optimisticDeleteMessages(ids);
117
+ },
100
118
  deleteMessage: async (id) => {
101
119
  const message = displayMessageSelectors.getDisplayMessageById(id)(get());
102
120
  if (!message) return;
103
121
 
104
122
  let ids = [message.id];
105
- const allMessages = displayMessageSelectors.activeDisplayMessages(get());
106
123
 
107
124
  // Handle assistantGroup messages: delete all child blocks and tool results
108
125
  if (message.role === 'assistantGroup' && message.children) {
@@ -117,23 +134,8 @@ export const messagePublicApi: StateCreator<
117
134
  });
118
135
  ids = ids.concat(toolResultIds);
119
136
  }
120
- // Handle regular messages with tools: find and delete related tool messages
121
- else if (message.tools) {
122
- const toolMessageIds = message.tools.flatMap((tool) => {
123
- const messages = allMessages.filter((m) => m.tool_call_id === tool.id);
124
- return messages.map((m) => m.id);
125
- });
126
- ids = ids.concat(toolMessageIds);
127
- }
128
137
 
129
- get().internal_dispatchMessage({ type: 'deleteMessages', ids });
130
- const result = await messageService.removeMessages(ids, {
131
- sessionId: get().activeId,
132
- topicId: get().activeTopicId,
133
- });
134
- if (result?.success && result.messages) {
135
- get().replaceMessages(result.messages);
136
- }
138
+ await get().optimisticDeleteMessages(ids);
137
139
  },
138
140
 
139
141
  deleteDBMessage: async (id) => {
@@ -203,6 +203,33 @@ export const LocalSystemManifest: BuiltinToolManifest = {
203
203
  type: 'object',
204
204
  },
205
205
  },
206
+ {
207
+ description:
208
+ 'Perform exact string replacements in files. Must read the file first before editing.',
209
+ name: LocalSystemApiName.editLocalFile,
210
+ parameters: {
211
+ properties: {
212
+ file_path: {
213
+ description: 'The absolute path to the file to modify',
214
+ type: 'string',
215
+ },
216
+ new_string: {
217
+ description: 'The text to replace with (must differ from old_string)',
218
+ type: 'string',
219
+ },
220
+ old_string: {
221
+ description: 'The exact text to replace',
222
+ type: 'string',
223
+ },
224
+ replace_all: {
225
+ description: 'Replace all occurrences of old_string (default: false)',
226
+ type: 'boolean',
227
+ },
228
+ },
229
+ required: ['file_path', 'old_string', 'new_string'],
230
+ type: 'object',
231
+ },
232
+ },
206
233
  {
207
234
  description:
208
235
  'Execute a shell command and return its output. Supports both synchronous and background execution with timeout control.',
@@ -349,33 +376,6 @@ export const LocalSystemManifest: BuiltinToolManifest = {
349
376
  type: 'object',
350
377
  },
351
378
  },
352
- {
353
- description:
354
- 'Perform exact string replacements in files. Must read the file first before editing.',
355
- name: LocalSystemApiName.editLocalFile,
356
- parameters: {
357
- properties: {
358
- file_path: {
359
- description: 'The absolute path to the file to modify',
360
- type: 'string',
361
- },
362
- new_string: {
363
- description: 'The text to replace with (must differ from old_string)',
364
- type: 'string',
365
- },
366
- old_string: {
367
- description: 'The exact text to replace',
368
- type: 'string',
369
- },
370
- replace_all: {
371
- description: 'Replace all occurrences of old_string (default: false)',
372
- type: 'boolean',
373
- },
374
- },
375
- required: ['file_path', 'old_string', 'new_string'],
376
- type: 'object',
377
- },
378
- },
379
379
  ],
380
380
  identifier: 'lobe-local-system',
381
381
  meta: {
@@ -19,17 +19,17 @@ You have access to a set of tools to interact with the user's local file system:
19
19
  1. **listLocalFiles**: Lists files and directories in a specified path.
20
20
  2. **readLocalFile**: Reads the content of a specified file, optionally within a line range. You can read file types such as Word, Excel, PowerPoint, PDF, and plain text files.
21
21
  3. **writeLocalFile**: Write content to a specific file, only support plain text file like \`.text\` or \`.md\`
22
- 4. **searchLocalFiles**: Searches for files based on keywords and other criteria using Spotlight (macOS) or native search. Use this tool to find files if the user is unsure about the exact path.
22
+ 4. **editLocalFile**: Performs exact string replacements in files. Must read the file first before editing.
23
23
  5. **renameLocalFile**: Renames a single file or directory in its current location.
24
24
  6. **moveLocalFiles**: Moves multiple files or directories. Can be used for renaming during the move.
25
- 7. **editLocalFile**: Performs exact string replacements in files. Must read the file first before editing.
26
25
 
27
26
  **Shell Commands:**
28
- 8. **runCommand**: Execute shell commands with timeout control. Supports both synchronous and background execution. When providing a description, always use the same language as the user's input.
29
- 9. **getCommandOutput**: Retrieve output from running background commands. Returns only new output since last check.
30
- 10. **killCommand**: Terminate a running background shell command by its ID.
27
+ 7. **runCommand**: Execute shell commands with timeout control. Supports both synchronous and background execution. When providing a description, always use the same language as the user's input.
28
+ 8. **getCommandOutput**: Retrieve output from running background commands. Returns only new output since last check.
29
+ 9. **killCommand**: Terminate a running background shell command by its ID.
31
30
 
32
31
  **Search & Find:**
32
+ 10. **searchLocalFiles**: Searches for files based on keywords and other criteria using Spotlight (macOS) or native search. Use this tool to find files if the user is unsure about the exact path.
33
33
  11. **grepContent**: Search for content within files using regex patterns. Supports various output modes, filtering, and context lines.
34
34
  12. **globLocalFiles**: Find files matching glob patterns (e.g., "**/*.js", "*.{ts,tsx}").
35
35
  </core_capabilities>
@@ -37,9 +37,9 @@ You have access to a set of tools to interact with the user's local file system:
37
37
  <workflow>
38
38
  1. Understand the user's request regarding local operations (files, commands, searches).
39
39
  2. Select the appropriate tool:
40
- - File operations: listLocalFiles, readLocalFile, writeLocalFile, editLocalFile, searchLocalFiles, renameLocalFile, moveLocalFiles
40
+ - File operations: listLocalFiles, readLocalFile, writeLocalFile, editLocalFile, renameLocalFile, moveLocalFiles
41
41
  - Shell commands: runCommand, getCommandOutput, killCommand
42
- - Search/Find: grepContent, globLocalFiles
42
+ - Search/Find: searchLocalFiles, grepContent, globLocalFiles
43
43
  3. Execute the operation. **If the user mentions a common location (like Desktop, Documents, Downloads, etc.) without providing a full path, use the corresponding path from the <user_context> section.**
44
44
  4. Present the results or confirmation.
45
45
  </workflow>
package/Dockerfile.lite DELETED
@@ -1,272 +0,0 @@
1
- ## Set global build ENV
2
- ARG NODEJS_VERSION="24"
3
-
4
- ## Base image for all building stages
5
- FROM node:${NODEJS_VERSION}-slim AS base
6
-
7
- ARG USE_CN_MIRROR
8
-
9
- ENV DEBIAN_FRONTEND="noninteractive"
10
-
11
- RUN \
12
- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
13
- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
14
- sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" "/etc/apt/sources.list.d/debian.sources"; \
15
- fi \
16
- # Add required package
17
- && apt update \
18
- && apt install ca-certificates proxychains-ng -qy \
19
- # Prepare required package to distroless
20
- && mkdir -p /distroless/bin /distroless/etc /distroless/etc/ssl/certs /distroless/lib \
21
- # Copy proxychains to distroless
22
- && cp /usr/lib/$(arch)-linux-gnu/libproxychains.so.4 /distroless/lib/libproxychains.so.4 \
23
- && cp /usr/lib/$(arch)-linux-gnu/libdl.so.2 /distroless/lib/libdl.so.2 \
24
- && cp /usr/bin/proxychains4 /distroless/bin/proxychains \
25
- && cp /etc/proxychains4.conf /distroless/etc/proxychains4.conf \
26
- # Copy node to distroless
27
- && cp /usr/lib/$(arch)-linux-gnu/libstdc++.so.6 /distroless/lib/libstdc++.so.6 \
28
- && cp /usr/lib/$(arch)-linux-gnu/libgcc_s.so.1 /distroless/lib/libgcc_s.so.1 \
29
- && cp /usr/local/bin/node /distroless/bin/node \
30
- # Copy CA certificates to distroless
31
- && cp /etc/ssl/certs/ca-certificates.crt /distroless/etc/ssl/certs/ca-certificates.crt \
32
- # Cleanup temp files
33
- && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
34
-
35
- ## Builder image, install all the dependencies and build the app
36
- FROM base AS builder
37
-
38
- ARG USE_CN_MIRROR
39
- ARG NEXT_PUBLIC_BASE_PATH
40
- ARG NEXT_PUBLIC_SENTRY_DSN
41
- ARG NEXT_PUBLIC_ANALYTICS_POSTHOG
42
- ARG NEXT_PUBLIC_POSTHOG_HOST
43
- ARG NEXT_PUBLIC_POSTHOG_KEY
44
- ARG NEXT_PUBLIC_ANALYTICS_UMAMI
45
- ARG NEXT_PUBLIC_UMAMI_SCRIPT_URL
46
- ARG NEXT_PUBLIC_UMAMI_WEBSITE_ID
47
- ARG FEATURE_FLAGS
48
-
49
- ENV NEXT_PUBLIC_CLIENT_DB="pglite"
50
- ENV NEXT_PUBLIC_BASE_PATH="${NEXT_PUBLIC_BASE_PATH}" \
51
- FEATURE_FLAGS="${FEATURE_FLAGS}"
52
-
53
- # Sentry
54
- ENV NEXT_PUBLIC_SENTRY_DSN="${NEXT_PUBLIC_SENTRY_DSN}" \
55
- SENTRY_ORG="" \
56
- SENTRY_PROJECT=""
57
-
58
- ENV APP_URL="http://app.com"
59
-
60
- # Posthog
61
- ENV NEXT_PUBLIC_ANALYTICS_POSTHOG="${NEXT_PUBLIC_ANALYTICS_POSTHOG}" \
62
- NEXT_PUBLIC_POSTHOG_HOST="${NEXT_PUBLIC_POSTHOG_HOST}" \
63
- NEXT_PUBLIC_POSTHOG_KEY="${NEXT_PUBLIC_POSTHOG_KEY}"
64
-
65
- # Umami
66
- ENV NEXT_PUBLIC_ANALYTICS_UMAMI="${NEXT_PUBLIC_ANALYTICS_UMAMI}" \
67
- NEXT_PUBLIC_UMAMI_SCRIPT_URL="${NEXT_PUBLIC_UMAMI_SCRIPT_URL}" \
68
- NEXT_PUBLIC_UMAMI_WEBSITE_ID="${NEXT_PUBLIC_UMAMI_WEBSITE_ID}"
69
-
70
- # Node
71
- ENV NODE_OPTIONS="--max-old-space-size=6144"
72
-
73
- WORKDIR /app
74
-
75
- COPY package.json pnpm-workspace.yaml ./
76
- COPY .npmrc ./
77
- COPY packages ./packages
78
-
79
- RUN \
80
- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
81
- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
82
- export SENTRYCLI_CDNURL="https://npmmirror.com/mirrors/sentry-cli"; \
83
- npm config set registry "https://registry.npmmirror.com/"; \
84
- echo 'canvas_binary_host_mirror=https://npmmirror.com/mirrors/canvas' >> .npmrc; \
85
- fi \
86
- # Set the registry for corepack
87
- && export COREPACK_NPM_REGISTRY=$(npm config get registry | sed 's/\/$//') \
88
- # Update corepack to latest (nodejs/corepack#612)
89
- && npm i -g corepack@latest \
90
- # Enable corepack
91
- && corepack enable \
92
- # Use pnpm for corepack
93
- && corepack use $(sed -n 's/.*"packageManager": "\(.*\)".*/\1/p' package.json) \
94
- # Install the dependencies
95
- && pnpm i
96
-
97
- COPY . .
98
-
99
- # run build standalone for docker version
100
- RUN npm run build:docker
101
-
102
- ## Application image, copy all the files for production
103
- FROM busybox:latest AS app
104
-
105
- COPY --from=base /distroless/ /
106
-
107
- # Automatically leverage output traces to reduce image size
108
- # https://nextjs.org/docs/advanced-features/output-file-tracing
109
- COPY --from=builder /app/.next/standalone /app/
110
-
111
- # Copy server launcher
112
- COPY --from=builder /app/scripts/serverLauncher/startServer.js /app/startServer.js
113
-
114
- RUN \
115
- # Add nextjs:nodejs to run the app
116
- addgroup -S -g 1001 nodejs \
117
- && adduser -D -G nodejs -H -S -h /app -u 1001 nextjs \
118
- # Set permission for nextjs:nodejs
119
- && chown -R nextjs:nodejs /app /etc/proxychains4.conf
120
-
121
- ## Production image, copy all the files and run next
122
- FROM scratch
123
-
124
- # Copy all the files from app, set the correct permission for prerender cache
125
- COPY --from=app / /
126
-
127
- ENV NODE_ENV="production" \
128
- NODE_OPTIONS="--dns-result-order=ipv4first --use-openssl-ca" \
129
- NODE_EXTRA_CA_CERTS="" \
130
- NODE_TLS_REJECT_UNAUTHORIZED="" \
131
- SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
132
-
133
- # Make the middleware rewrite through local as default
134
- # refs: https://github.com/lobehub/lobe-chat/issues/5876
135
- ENV MIDDLEWARE_REWRITE_THROUGH_LOCAL="1"
136
-
137
- # set hostname to localhost
138
- ENV HOSTNAME="0.0.0.0" \
139
- PORT="3210"
140
-
141
- # General Variables
142
- ENV ACCESS_CODE="" \
143
- API_KEY_SELECT_MODE="" \
144
- DEFAULT_AGENT_CONFIG="" \
145
- SYSTEM_AGENT="" \
146
- FEATURE_FLAGS="" \
147
- PROXY_URL="" \
148
- ENABLE_AUTH_PROTECTION=""
149
-
150
- # Model Variables
151
- ENV \
152
- # AI21
153
- AI21_API_KEY="" AI21_MODEL_LIST="" \
154
- # Ai360
155
- AI360_API_KEY="" AI360_MODEL_LIST="" \
156
- # AiHubMix
157
- AIHUBMIX_API_KEY="" AIHUBMIX_MODEL_LIST="" \
158
- # Anthropic
159
- ANTHROPIC_API_KEY="" ANTHROPIC_MODEL_LIST="" ANTHROPIC_PROXY_URL="" \
160
- # Amazon Bedrock
161
- ENABLED_AWS_BEDROCK="" AWS_ACCESS_KEY_ID="" AWS_SECRET_ACCESS_KEY="" AWS_REGION="" AWS_BEDROCK_MODEL_LIST="" \
162
- # Azure OpenAI
163
- AZURE_API_KEY="" AZURE_API_VERSION="" AZURE_ENDPOINT="" AZURE_MODEL_LIST="" \
164
- # Baichuan
165
- BAICHUAN_API_KEY="" BAICHUAN_MODEL_LIST="" \
166
- # Cloudflare
167
- CLOUDFLARE_API_KEY="" CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID="" CLOUDFLARE_MODEL_LIST="" \
168
- # Cohere
169
- COHERE_API_KEY="" COHERE_MODEL_LIST="" COHERE_PROXY_URL="" \
170
- # ComfyUI
171
- ENABLED_COMFYUI="" COMFYUI_BASE_URL="" COMFYUI_AUTH_TYPE="" \
172
- COMFYUI_API_KEY="" COMFYUI_USERNAME="" COMFYUI_PASSWORD="" COMFYUI_CUSTOM_HEADERS="" \
173
- # DeepSeek
174
- DEEPSEEK_API_KEY="" DEEPSEEK_MODEL_LIST="" \
175
- # Fireworks AI
176
- FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
177
- # Gitee AI
178
- GITEE_AI_API_KEY="" GITEE_AI_MODEL_LIST="" \
179
- # GitHub
180
- GITHUB_TOKEN="" GITHUB_MODEL_LIST="" \
181
- # Google
182
- GOOGLE_API_KEY="" GOOGLE_MODEL_LIST="" GOOGLE_PROXY_URL="" \
183
- # Groq
184
- GROQ_API_KEY="" GROQ_MODEL_LIST="" GROQ_PROXY_URL="" \
185
- # Higress
186
- HIGRESS_API_KEY="" HIGRESS_MODEL_LIST="" HIGRESS_PROXY_URL="" \
187
- # HuggingFace
188
- HUGGINGFACE_API_KEY="" HUGGINGFACE_MODEL_LIST="" HUGGINGFACE_PROXY_URL="" \
189
- # Hunyuan
190
- HUNYUAN_API_KEY="" HUNYUAN_MODEL_LIST="" \
191
- # InternLM
192
- INTERNLM_API_KEY="" INTERNLM_MODEL_LIST="" \
193
- # Jina
194
- JINA_API_KEY="" JINA_MODEL_LIST="" JINA_PROXY_URL="" \
195
- # Minimax
196
- MINIMAX_API_KEY="" MINIMAX_MODEL_LIST="" \
197
- # Mistral
198
- MISTRAL_API_KEY="" MISTRAL_MODEL_LIST="" \
199
- # ModelScope
200
- MODELSCOPE_API_KEY="" MODELSCOPE_MODEL_LIST="" MODELSCOPE_PROXY_URL="" \
201
- # Moonshot
202
- MOONSHOT_API_KEY="" MOONSHOT_MODEL_LIST="" MOONSHOT_PROXY_URL="" \
203
- # Nebius
204
- NEBIUS_API_KEY="" NEBIUS_MODEL_LIST="" NEBIUS_PROXY_URL="" \
205
- # NewAPI
206
- NEWAPI_API_KEY="" NEWAPI_PROXY_URL="" \
207
- # Novita
208
- NOVITA_API_KEY="" NOVITA_MODEL_LIST="" \
209
- # Nvidia NIM
210
- NVIDIA_API_KEY="" NVIDIA_MODEL_LIST="" NVIDIA_PROXY_URL="" \
211
- # Ollama
212
- ENABLED_OLLAMA="" OLLAMA_MODEL_LIST="" OLLAMA_PROXY_URL="" \
213
- # OpenAI
214
- ENABLED_OPENAI="" OPENAI_API_KEY="" OPENAI_MODEL_LIST="" OPENAI_PROXY_URL="" \
215
- # OpenRouter
216
- OPENROUTER_API_KEY="" OPENROUTER_MODEL_LIST="" \
217
- # Perplexity
218
- PERPLEXITY_API_KEY="" PERPLEXITY_MODEL_LIST="" PERPLEXITY_PROXY_URL="" \
219
- # Qiniu
220
- QINIU_API_KEY="" QINIU_MODEL_LIST="" QINIU_PROXY_URL="" \
221
- # Qwen
222
- QWEN_API_KEY="" QWEN_MODEL_LIST="" QWEN_PROXY_URL="" \
223
- # SambaNova
224
- SAMBANOVA_API_KEY="" SAMBANOVA_MODEL_LIST="" \
225
- # SenseNova
226
- SENSENOVA_API_KEY="" SENSENOVA_MODEL_LIST="" \
227
- # SiliconCloud
228
- SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
229
- # Spark
230
- SPARK_API_KEY="" SPARK_MODEL_LIST="" SPARK_PROXY_URL="" SPARK_SEARCH_MODE="" \
231
- # Stepfun
232
- STEPFUN_API_KEY="" STEPFUN_MODEL_LIST="" \
233
- # Taichu
234
- TAICHU_API_KEY="" TAICHU_MODEL_LIST="" \
235
- # TogetherAI
236
- TOGETHERAI_API_KEY="" TOGETHERAI_MODEL_LIST="" \
237
- # Upstage
238
- UPSTAGE_API_KEY="" UPSTAGE_MODEL_LIST="" \
239
- # v0 (Vercel)
240
- V0_API_KEY="" V0_MODEL_LIST="" \
241
- # vLLM
242
- VLLM_API_KEY="" VLLM_MODEL_LIST="" VLLM_PROXY_URL="" \
243
- # Wenxin
244
- WENXIN_API_KEY="" WENXIN_MODEL_LIST="" \
245
- # xAI
246
- XAI_API_KEY="" XAI_MODEL_LIST="" XAI_PROXY_URL="" \
247
- # Xinference
248
- XINFERENCE_API_KEY="" XINFERENCE_MODEL_LIST="" XINFERENCE_PROXY_URL="" \
249
- # 01.AI
250
- ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
251
- # Zhipu
252
- ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" \
253
- # Tencent Cloud
254
- TENCENT_CLOUD_API_KEY="" TENCENT_CLOUD_MODEL_LIST="" \
255
- # Infini-AI
256
- INFINIAI_API_KEY="" INFINIAI_MODEL_LIST="" \
257
- # 302.AI
258
- AI302_API_KEY="" AI302_MODEL_LIST="" \
259
- # FAL
260
- ENABLED_FAL="" FAL_API_KEY="" FAL_MODEL_LIST="" \
261
- # BFL
262
- BFL_API_KEY="" BFL_MODEL_LIST="" \
263
- # Vercel AI Gateway
264
- VERCELAIGATEWAY_API_KEY="" VERCELAIGATEWAY_MODEL_LIST=""
265
-
266
- USER nextjs
267
-
268
- EXPOSE 3210/tcp
269
-
270
- ENTRYPOINT ["/bin/node"]
271
-
272
- CMD ["/app/startServer.js"]
@@ -1,29 +0,0 @@
1
- import { safeParseJSON } from '@lobechat/utils';
2
- import { memo } from 'react';
3
-
4
- import { getBuiltinPlaceholder } from '@/tools/placeholders';
5
-
6
- import Arguments from '../Arguments';
7
-
8
- interface LoadingPlaceholderProps {
9
- apiName: string;
10
- identifier: string;
11
- loading?: boolean;
12
- requestArgs?: string;
13
- }
14
-
15
- const LoadingPlaceholder = memo<LoadingPlaceholderProps>(
16
- ({ identifier, requestArgs, apiName, loading }) => {
17
- const Render = getBuiltinPlaceholder(identifier, apiName);
18
-
19
- if (Render) {
20
- return (
21
- <Render apiName={apiName} args={safeParseJSON(requestArgs) || {}} identifier={identifier} />
22
- );
23
- }
24
-
25
- return <Arguments arguments={requestArgs} shine={loading} />;
26
- },
27
- );
28
-
29
- export default LoadingPlaceholder;
@@ -1,76 +0,0 @@
1
- import { CSSProperties, memo, useEffect, useState } from 'react';
2
- import { Flexbox } from 'react-layout-kit';
3
-
4
- import AnimatedCollapsed from '@/components/AnimatedCollapsed';
5
- import { useChatStore } from '@/store/chat';
6
- import { messageStateSelectors } from '@/store/chat/selectors';
7
-
8
- import Inspectors from './Inspector';
9
- import Render from './Render';
10
-
11
- export interface InspectorProps {
12
- apiName: string;
13
- arguments?: string;
14
- id: string;
15
- identifier: string;
16
- index: number;
17
- messageId: string;
18
- payload: object;
19
- style?: CSSProperties;
20
- type?: string;
21
- }
22
-
23
- const Tool = memo<InspectorProps>(
24
- ({ arguments: requestArgs, apiName, messageId, id, index, identifier, style, payload, type }) => {
25
- const [showDetail, setShowDetail] = useState(type !== 'mcp');
26
- const [showPluginRender, setShowPluginRender] = useState(false);
27
- const isLoading = useChatStore(messageStateSelectors.isInToolsCalling(messageId, index));
28
-
29
- useEffect(() => {
30
- if (type !== 'mcp') return;
31
-
32
- setTimeout(
33
- () => {
34
- setShowDetail(isLoading);
35
- },
36
- isLoading ? 1 : 1500,
37
- );
38
- }, [isLoading]);
39
-
40
- return (
41
- <Flexbox gap={8} style={style}>
42
- <Inspectors
43
- apiName={apiName}
44
- arguments={requestArgs}
45
- // mcp don't have ui render
46
- hidePluginUI={type === 'mcp'}
47
- id={id}
48
- identifier={identifier}
49
- index={index}
50
- messageId={messageId}
51
- payload={payload}
52
- setShowPluginRender={setShowPluginRender}
53
- setShowRender={setShowDetail}
54
- showPluginRender={showPluginRender}
55
- showRender={showDetail}
56
- />
57
- <AnimatedCollapsed open={showDetail}>
58
- <Render
59
- apiName={apiName}
60
- identifier={identifier}
61
- messageId={messageId}
62
- requestArgs={requestArgs}
63
- setShowPluginRender={setShowPluginRender}
64
- showPluginRender={showPluginRender}
65
- toolCallId={id}
66
- toolIndex={index}
67
- />
68
- </AnimatedCollapsed>
69
- </Flexbox>
70
- );
71
- },
72
- );
73
-
74
- Tool.displayName = 'AssistantTool';
75
-
76
- export default Tool;