@lobehub/lobehub 2.0.0-next.61 → 2.0.0-next.63
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 +50 -0
- package/changelog/v1.json +14 -0
- package/locales/ar/plugin.json +2 -0
- package/locales/bg-BG/plugin.json +2 -0
- package/locales/de-DE/plugin.json +2 -0
- package/locales/en-US/plugin.json +8 -1
- package/locales/es-ES/plugin.json +2 -0
- package/locales/fa-IR/plugin.json +2 -0
- package/locales/fr-FR/plugin.json +2 -0
- package/locales/it-IT/plugin.json +2 -0
- package/locales/ja-JP/plugin.json +2 -0
- package/locales/ko-KR/plugin.json +2 -0
- package/locales/nl-NL/plugin.json +2 -0
- package/locales/pl-PL/plugin.json +2 -0
- package/locales/pt-BR/plugin.json +2 -0
- package/locales/ru-RU/plugin.json +2 -0
- package/locales/tr-TR/plugin.json +2 -0
- package/locales/vi-VN/plugin.json +2 -0
- package/locales/zh-CN/plugin.json +8 -1
- package/locales/zh-TW/plugin.json +2 -0
- package/package.json +1 -1
- package/src/app/(backend)/middleware/auth/index.ts +7 -2
- package/src/app/(backend)/trpc/async/[trpc]/route.ts +9 -3
- package/src/app/(backend)/trpc/desktop/[trpc]/route.ts +9 -3
- package/src/app/(backend)/trpc/lambda/[trpc]/route.ts +9 -3
- package/src/app/(backend)/trpc/mobile/[trpc]/route.ts +9 -3
- package/src/app/(backend)/trpc/tools/[trpc]/route.ts +9 -3
- package/src/components/FileIcon/index.tsx +0 -2
- package/src/features/Conversation/Messages/Assistant/MessageContent.tsx +0 -18
- package/src/features/Conversation/Messages/Group/Tool/Inspector/index.tsx +26 -5
- package/src/features/Conversation/Messages/Group/Tool/index.tsx +1 -1
- package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/ToolTitle.tsx +1 -7
- package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/index.tsx +2 -15
- package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/CustomRender.tsx +1 -1
- package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/PluginSettings.tsx +2 -2
- package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/index.tsx +2 -31
- package/src/features/Conversation/Messages/Tool/ToolItem.tsx +51 -0
- package/src/features/Conversation/Messages/Tool/index.tsx +58 -0
- package/src/features/Conversation/Messages/index.tsx +5 -0
- package/src/features/ShareModal/ShareJSON/index.tsx +2 -2
- package/src/libs/trpc/utils/request-adapter.ts +20 -0
- package/src/locales/default/plugin.ts +8 -0
- package/src/store/chat/slices/message/action.test.ts +8 -4
- package/src/store/chat/slices/message/actions/optimisticUpdate.ts +12 -0
- package/src/store/chat/slices/message/actions/publicApi.ts +19 -17
- package/src/tools/local-system/index.ts +27 -27
- package/src/tools/local-system/systemRole.ts +7 -7
- package/src/features/Conversation/Messages/Assistant/Tool/Render/LoadingPlaceholder/index.tsx +0 -29
- package/src/features/Conversation/Messages/Assistant/Tool/index.tsx +0 -76
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/BuiltinPluginTitle.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/Debug.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/PluginResult.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/PluginState.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Inspector/Settings.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/Arguments/ObjectEntity.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/Arguments/ValueCell.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/Arguments/index.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/ErrorResponse.tsx +0 -0
- /package/src/features/Conversation/Messages/{Assistant/Tool → Tool}/Render/KeyValueEditor.tsx +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.63](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.62...v2.0.0-next.63)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2025-11-15**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: Show orphaned tool message and support delete tool message.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: Show orphaned tool message and support delete tool message, closes [#10232](https://github.com/lobehub/lobe-chat/issues/10232) ([38cfd26](https://github.com/lobehub/lobe-chat/commit/38cfd26))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## [Version 2.0.0-next.62](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.61...v2.0.0-next.62)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2025-11-15**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **next16**: Resolve 'Response body object should not be disturbed or locked' error.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **next16**: Resolve 'Response body object should not be disturbed or locked' error, closes [#10226](https://github.com/lobehub/lobe-chat/issues/10226) ([caa9c78](https://github.com/lobehub/lobe-chat/commit/caa9c78))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
## [Version 2.0.0-next.61](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.60...v2.0.0-next.61)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2025-11-15**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"features": [
|
|
5
|
+
"Show orphaned tool message and support delete tool message."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2025-11-15",
|
|
9
|
+
"version": "2.0.0-next.63"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {},
|
|
13
|
+
"date": "2025-11-15",
|
|
14
|
+
"version": "2.0.0-next.62"
|
|
15
|
+
},
|
|
2
16
|
{
|
|
3
17
|
"children": {
|
|
4
18
|
"improvements": [
|
package/locales/ar/plugin.json
CHANGED
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "عرض قائمة المعلمات",
|
|
239
|
+
"delete": "حذف استدعاء الأداة",
|
|
240
|
+
"orphanedToolCall": "قد تكون رسالة استدعاء الأداة هذه معزولة بسبب ظروف غير طبيعية، مما قد يؤثر على تنفيذ الوكيل بشكل صحيح. يُرجى إزالتها.",
|
|
239
241
|
"pluginRender": "عرض واجهة الإضافة"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Преглед на списъка с параметри",
|
|
239
|
+
"delete": "Изтриване на извикване на инструмент",
|
|
240
|
+
"orphanedToolCall": "Това извикване на инструмент може да е станало изолирано поради необичайни причини, което може да повлияе на нормалното изпълнение на агента. Моля, премахнете го.",
|
|
239
241
|
"pluginRender": "Преглед на интерфейса на плъгина"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Parameterliste anzeigen",
|
|
239
|
+
"delete": "Werkzeugaufruf löschen",
|
|
240
|
+
"orphanedToolCall": "Dieser Werkzeugaufruf könnte aufgrund eines Fehlers verwaist sein, was den normalen Ablauf des Agenten beeinträchtigen kann. Bitte entfernen Sie ihn.",
|
|
239
241
|
"pluginRender": "Plugin-Oberfläche anzeigen"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "View Argument List",
|
|
239
|
+
"delete": "Delete Tool Call",
|
|
240
|
+
"orphanedToolCall": "This tool call message may have become orphaned due to an unexpected issue, which could affect the Agent's normal operation. Please remove it.",
|
|
239
241
|
"pluginRender": "View Plugin Interface"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -251,13 +253,18 @@
|
|
|
251
253
|
},
|
|
252
254
|
"localSystem": {
|
|
253
255
|
"apiName": {
|
|
256
|
+
"getCommandOutput": "Get Code Output",
|
|
257
|
+
"globLocalFiles": "Match Files",
|
|
258
|
+
"grepContent": "Search Content",
|
|
259
|
+
"killCommand": "Kill Code Execution",
|
|
254
260
|
"listLocalFiles": "View File List",
|
|
255
261
|
"moveLocalFiles": "Move Files",
|
|
256
262
|
"readLocalFile": "Read File Content",
|
|
257
263
|
"renameLocalFile": "Rename",
|
|
258
264
|
"runCommand": "Run Code",
|
|
259
265
|
"searchLocalFiles": "Search Files",
|
|
260
|
-
"writeLocalFile": "Write File"
|
|
266
|
+
"writeLocalFile": "Write File",
|
|
267
|
+
"editLocalFile": "Edit File"
|
|
261
268
|
},
|
|
262
269
|
"title": "Local System"
|
|
263
270
|
},
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Ver lista de parámetros",
|
|
239
|
+
"delete": "Eliminar llamada a la herramienta",
|
|
240
|
+
"orphanedToolCall": "Este mensaje de llamada a la herramienta podría haberse quedado huérfano debido a circunstancias excepcionales, lo que puede afectar el funcionamiento normal del agente. Por favor, elimínelo.",
|
|
239
241
|
"pluginRender": "Ver interfaz del plugin"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "مشاهده لیست پارامترها",
|
|
239
|
+
"delete": "حذف فراخوانی ابزار",
|
|
240
|
+
"orphanedToolCall": "این پیام فراخوانی ابزار ممکن است به دلایل غیرعادی به یک پیام یتیم تبدیل شده باشد که میتواند عملکرد عادی عامل را مختل کند. لطفاً آن را حذف کنید.",
|
|
239
241
|
"pluginRender": "مشاهده رابط افزونه"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Voir la liste des paramètres",
|
|
239
|
+
"delete": "Supprimer l'appel d'outil",
|
|
240
|
+
"orphanedToolCall": "Cet appel d'outil est peut-être devenu orphelin en raison d'une erreur, ce qui pourrait perturber le bon fonctionnement de l'agent. Veuillez le supprimer.",
|
|
239
241
|
"pluginRender": "Voir l'interface du plugin"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Visualizza lista parametri",
|
|
239
|
+
"delete": "Elimina chiamata allo strumento",
|
|
240
|
+
"orphanedToolCall": "Questo messaggio di chiamata allo strumento potrebbe essere diventato orfano a causa di un'anomalia, il che potrebbe compromettere il corretto funzionamento dell'agente. Si consiglia di rimuoverlo.",
|
|
239
241
|
"pluginRender": "Visualizza interfaccia plugin"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Bekijk parameterlijst",
|
|
239
|
+
"delete": "Hulpoproep verwijderen",
|
|
240
|
+
"orphanedToolCall": "Dit hulpoproepbericht is mogelijk geïsoleerd geraakt door een onverwachte fout, wat de normale werking van de agent kan beïnvloeden. Verwijder het alstublieft.",
|
|
239
241
|
"pluginRender": "Bekijk plugin-interface"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Zobacz listę argumentów",
|
|
239
|
+
"delete": "Usuń wywołanie narzędzia",
|
|
240
|
+
"orphanedToolCall": "To wywołanie narzędzia mogło zostać osierocone z powodu nieoczekiwanych okoliczności, co może zakłócić prawidłowe działanie Agenta. Proszę je usunąć.",
|
|
239
241
|
"pluginRender": "Zobacz interfejs wtyczki"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Ver lista de parâmetros",
|
|
239
|
+
"delete": "Excluir chamada de ferramenta",
|
|
240
|
+
"orphanedToolCall": "Esta chamada de ferramenta pode ter se tornado uma mensagem órfã devido a um erro, o que pode afetar a execução normal do Agente. Por favor, remova-a.",
|
|
239
241
|
"pluginRender": "Ver interface do plugin"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Просмотр списка параметров",
|
|
239
|
+
"delete": "Удалить вызов инструмента",
|
|
240
|
+
"orphanedToolCall": "Этот вызов инструмента, возможно, стал изолированным из-за непредвиденных обстоятельств, что может повлиять на корректную работу агента. Пожалуйста, удалите его.",
|
|
239
241
|
"pluginRender": "Просмотр интерфейса плагина"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Parametre listesini görüntüle",
|
|
239
|
+
"delete": "Araç çağrısını sil",
|
|
240
|
+
"orphanedToolCall": "Bu araç çağrısı mesajı, beklenmeyen bir nedenle yetim kalmış olabilir ve bu durum Ajansın düzgün çalışmasını etkileyebilir. Lütfen bunu kaldırın.",
|
|
239
241
|
"pluginRender": "Eklenti arayüzünü görüntüle"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "Xem danh sách tham số",
|
|
239
|
+
"delete": "Xoá lệnh gọi công cụ",
|
|
240
|
+
"orphanedToolCall": "Lệnh gọi công cụ này có thể đã trở thành một tin nhắn bị cô lập do sự cố bất thường, điều này có thể ảnh hưởng đến quá trình thực thi bình thường của Tác nhân. Vui lòng xoá nó.",
|
|
239
241
|
"pluginRender": "Xem giao diện plugin"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -236,6 +236,8 @@
|
|
|
236
236
|
},
|
|
237
237
|
"inspector": {
|
|
238
238
|
"args": "查看参数列表",
|
|
239
|
+
"delete": "删除工具调用",
|
|
240
|
+
"orphanedToolCall": "该工具调用消息可能因异常原因成为孤立消息,这会影响 Agent 的正常执行,请将其移除",
|
|
239
241
|
"pluginRender": "查看插件界面"
|
|
240
242
|
},
|
|
241
243
|
"list": {
|
|
@@ -251,13 +253,18 @@
|
|
|
251
253
|
},
|
|
252
254
|
"localSystem": {
|
|
253
255
|
"apiName": {
|
|
256
|
+
"getCommandOutput": "获取代码输出",
|
|
257
|
+
"globLocalFiles": "匹配搜索文件",
|
|
258
|
+
"grepContent": "搜索内容",
|
|
259
|
+
"killCommand": "终止代码执行",
|
|
254
260
|
"listLocalFiles": "查看文件列表",
|
|
255
261
|
"moveLocalFiles": "移动文件",
|
|
256
262
|
"readLocalFile": "读取文件内容",
|
|
257
263
|
"renameLocalFile": "重命名",
|
|
258
264
|
"runCommand": "执行代码",
|
|
259
265
|
"searchLocalFiles": "搜索文件",
|
|
260
|
-
"writeLocalFile": "写入文件"
|
|
266
|
+
"writeLocalFile": "写入文件",
|
|
267
|
+
"editLocalFile": "编辑文件"
|
|
261
268
|
},
|
|
262
269
|
"title": "本地系统"
|
|
263
270
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.63",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent 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",
|
|
@@ -33,10 +33,15 @@ export type RequestHandler = (
|
|
|
33
33
|
|
|
34
34
|
export const checkAuth =
|
|
35
35
|
(handler: RequestHandler) => async (req: Request, options: RequestOptions) => {
|
|
36
|
+
// Clone the request to avoid "Response body object should not be disturbed or locked" error
|
|
37
|
+
// in Next.js 16 when the body stream has been consumed by Next.js internal mechanisms
|
|
38
|
+
// This ensures the handler can safely read the request body
|
|
39
|
+
const clonedReq = req.clone();
|
|
40
|
+
|
|
36
41
|
// we have a special header to debug the api endpoint in development mode
|
|
37
42
|
const isDebugApi = req.headers.get('lobe-auth-dev-backend-api') === '1';
|
|
38
43
|
if (process.env.NODE_ENV === 'development' && isDebugApi) {
|
|
39
|
-
return handler(
|
|
44
|
+
return handler(clonedReq, { ...options, jwtPayload: { userId: 'DEV_USER' } });
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
let jwtPayload: ClientSecretPayload;
|
|
@@ -107,5 +112,5 @@ export const checkAuth =
|
|
|
107
112
|
return createErrorResponse(errorType, { error, ...res, provider: params?.provider });
|
|
108
113
|
}
|
|
109
114
|
|
|
110
|
-
return handler(
|
|
115
|
+
return handler(clonedReq, { ...options, jwtPayload });
|
|
111
116
|
};
|
|
@@ -3,10 +3,15 @@ import type { NextRequest } from 'next/server';
|
|
|
3
3
|
|
|
4
4
|
import { pino } from '@/libs/logger';
|
|
5
5
|
import { createAsyncRouteContext } from '@/libs/trpc/async/context';
|
|
6
|
+
import { prepareRequestForTRPC } from '@/libs/trpc/utils/request-adapter';
|
|
6
7
|
import { asyncRouter } from '@/server/routers/async';
|
|
7
8
|
|
|
8
|
-
const handler = (req: NextRequest) =>
|
|
9
|
-
|
|
9
|
+
const handler = (req: NextRequest) => {
|
|
10
|
+
// Clone the request to avoid "Response body object should not be disturbed or locked" error
|
|
11
|
+
// in Next.js 16 when the body stream has been consumed by Next.js internal mechanisms
|
|
12
|
+
const preparedReq = prepareRequestForTRPC(req);
|
|
13
|
+
|
|
14
|
+
return fetchRequestHandler({
|
|
10
15
|
// 避免请求之间互相影响
|
|
11
16
|
// https://github.com/lobehub/lobe-chat/discussions/7442#discussioncomment-13658563
|
|
12
17
|
allowBatching: false,
|
|
@@ -23,8 +28,9 @@ const handler = (req: NextRequest) =>
|
|
|
23
28
|
console.error(error);
|
|
24
29
|
},
|
|
25
30
|
|
|
26
|
-
req,
|
|
31
|
+
req: preparedReq,
|
|
27
32
|
router: asyncRouter,
|
|
28
33
|
});
|
|
34
|
+
};
|
|
29
35
|
|
|
30
36
|
export { handler as GET, handler as POST };
|
|
@@ -3,10 +3,15 @@ import type { NextRequest } from 'next/server';
|
|
|
3
3
|
|
|
4
4
|
import { pino } from '@/libs/logger';
|
|
5
5
|
import { createLambdaContext } from '@/libs/trpc/lambda/context';
|
|
6
|
+
import { prepareRequestForTRPC } from '@/libs/trpc/utils/request-adapter';
|
|
6
7
|
import { desktopRouter } from '@/server/routers/desktop';
|
|
7
8
|
|
|
8
|
-
const handler = (req: NextRequest) =>
|
|
9
|
-
|
|
9
|
+
const handler = (req: NextRequest) => {
|
|
10
|
+
// Clone the request to avoid "Response body object should not be disturbed or locked" error
|
|
11
|
+
// in Next.js 16 when the body stream has been consumed by Next.js internal mechanisms
|
|
12
|
+
const preparedReq = prepareRequestForTRPC(req);
|
|
13
|
+
|
|
14
|
+
return fetchRequestHandler({
|
|
10
15
|
/**
|
|
11
16
|
* @link https://trpc.io/docs/v11/context
|
|
12
17
|
*/
|
|
@@ -19,7 +24,7 @@ const handler = (req: NextRequest) =>
|
|
|
19
24
|
console.error(error);
|
|
20
25
|
},
|
|
21
26
|
|
|
22
|
-
req,
|
|
27
|
+
req: preparedReq,
|
|
23
28
|
responseMeta({ ctx }) {
|
|
24
29
|
const headers = ctx?.resHeaders;
|
|
25
30
|
|
|
@@ -27,5 +32,6 @@ const handler = (req: NextRequest) =>
|
|
|
27
32
|
},
|
|
28
33
|
router: desktopRouter,
|
|
29
34
|
});
|
|
35
|
+
};
|
|
30
36
|
|
|
31
37
|
export { handler as GET, handler as POST };
|
|
@@ -3,10 +3,15 @@ import type { NextRequest } from 'next/server';
|
|
|
3
3
|
|
|
4
4
|
import { pino } from '@/libs/logger';
|
|
5
5
|
import { createLambdaContext } from '@/libs/trpc/lambda/context';
|
|
6
|
+
import { prepareRequestForTRPC } from '@/libs/trpc/utils/request-adapter';
|
|
6
7
|
import { lambdaRouter } from '@/server/routers/lambda';
|
|
7
8
|
|
|
8
|
-
const handler = (req: NextRequest) =>
|
|
9
|
-
|
|
9
|
+
const handler = (req: NextRequest) => {
|
|
10
|
+
// Clone the request to avoid "Response body object should not be disturbed or locked" error
|
|
11
|
+
// in Next.js 16 when the body stream has been consumed by Next.js internal mechanisms
|
|
12
|
+
const preparedReq = prepareRequestForTRPC(req);
|
|
13
|
+
|
|
14
|
+
return fetchRequestHandler({
|
|
10
15
|
/**
|
|
11
16
|
* @link https://trpc.io/docs/v11/context
|
|
12
17
|
*/
|
|
@@ -19,7 +24,7 @@ const handler = (req: NextRequest) =>
|
|
|
19
24
|
console.error(error);
|
|
20
25
|
},
|
|
21
26
|
|
|
22
|
-
req,
|
|
27
|
+
req: preparedReq,
|
|
23
28
|
responseMeta({ ctx }) {
|
|
24
29
|
const headers = ctx?.resHeaders;
|
|
25
30
|
|
|
@@ -27,5 +32,6 @@ const handler = (req: NextRequest) =>
|
|
|
27
32
|
},
|
|
28
33
|
router: lambdaRouter,
|
|
29
34
|
});
|
|
35
|
+
};
|
|
30
36
|
|
|
31
37
|
export { handler as GET, handler as POST };
|
|
@@ -3,10 +3,15 @@ import type { NextRequest } from 'next/server';
|
|
|
3
3
|
|
|
4
4
|
import { pino } from '@/libs/logger';
|
|
5
5
|
import { createLambdaContext } from '@/libs/trpc/lambda/context';
|
|
6
|
+
import { prepareRequestForTRPC } from '@/libs/trpc/utils/request-adapter';
|
|
6
7
|
import { mobileRouter } from '@/server/routers/mobile';
|
|
7
8
|
|
|
8
|
-
const handler = (req: NextRequest) =>
|
|
9
|
-
|
|
9
|
+
const handler = (req: NextRequest) => {
|
|
10
|
+
// Clone the request to avoid "Response body object should not be disturbed or locked" error
|
|
11
|
+
// in Next.js 16 when the body stream has been consumed by Next.js internal mechanisms
|
|
12
|
+
const preparedReq = prepareRequestForTRPC(req);
|
|
13
|
+
|
|
14
|
+
return fetchRequestHandler({
|
|
10
15
|
/**
|
|
11
16
|
* @link https://trpc.io/docs/v11/context
|
|
12
17
|
*/
|
|
@@ -19,7 +24,7 @@ const handler = (req: NextRequest) =>
|
|
|
19
24
|
console.error(error);
|
|
20
25
|
},
|
|
21
26
|
|
|
22
|
-
req,
|
|
27
|
+
req: preparedReq,
|
|
23
28
|
responseMeta({ ctx }) {
|
|
24
29
|
const headers = ctx?.resHeaders;
|
|
25
30
|
|
|
@@ -27,5 +32,6 @@ const handler = (req: NextRequest) =>
|
|
|
27
32
|
},
|
|
28
33
|
router: mobileRouter,
|
|
29
34
|
});
|
|
35
|
+
};
|
|
30
36
|
|
|
31
37
|
export { handler as GET, handler as POST };
|
|
@@ -3,10 +3,15 @@ import type { NextRequest } from 'next/server';
|
|
|
3
3
|
|
|
4
4
|
import { pino } from '@/libs/logger';
|
|
5
5
|
import { createLambdaContext } from '@/libs/trpc/lambda/context';
|
|
6
|
+
import { prepareRequestForTRPC } from '@/libs/trpc/utils/request-adapter';
|
|
6
7
|
import { toolsRouter } from '@/server/routers/tools';
|
|
7
8
|
|
|
8
|
-
const handler = (req: NextRequest) =>
|
|
9
|
-
|
|
9
|
+
const handler = (req: NextRequest) => {
|
|
10
|
+
// Clone the request to avoid "Response body object should not be disturbed or locked" error
|
|
11
|
+
// in Next.js 16 when the body stream has been consumed by Next.js internal mechanisms
|
|
12
|
+
const preparedReq = prepareRequestForTRPC(req);
|
|
13
|
+
|
|
14
|
+
return fetchRequestHandler({
|
|
10
15
|
/**
|
|
11
16
|
* @link https://trpc.io/docs/v11/context
|
|
12
17
|
*/
|
|
@@ -19,8 +24,9 @@ const handler = (req: NextRequest) =>
|
|
|
19
24
|
console.error(error);
|
|
20
25
|
},
|
|
21
26
|
|
|
22
|
-
req,
|
|
27
|
+
req: preparedReq,
|
|
23
28
|
router: toolsRouter,
|
|
24
29
|
});
|
|
30
|
+
};
|
|
25
31
|
|
|
26
32
|
export { handler as GET, handler as POST };
|
|
@@ -12,7 +12,6 @@ import FileChunks from './FileChunks';
|
|
|
12
12
|
import IntentUnderstanding from './IntentUnderstanding';
|
|
13
13
|
import Reasoning from './Reasoning';
|
|
14
14
|
import SearchGrounding from './SearchGrounding';
|
|
15
|
-
import Tool from './Tool';
|
|
16
15
|
|
|
17
16
|
export const AssistantMessageContent = memo<
|
|
18
17
|
UIChatMessage & {
|
|
@@ -67,23 +66,6 @@ export const AssistantMessageContent = memo<
|
|
|
67
66
|
/>
|
|
68
67
|
)}
|
|
69
68
|
{showImageItems && <ImageFileListViewer items={imageList} />}
|
|
70
|
-
{tools && (
|
|
71
|
-
<Flexbox gap={8}>
|
|
72
|
-
{tools.map((toolCall, index) => (
|
|
73
|
-
<Tool
|
|
74
|
-
apiName={toolCall.apiName}
|
|
75
|
-
arguments={toolCall.arguments}
|
|
76
|
-
id={toolCall.id}
|
|
77
|
-
identifier={toolCall.identifier}
|
|
78
|
-
index={index}
|
|
79
|
-
key={toolCall.id}
|
|
80
|
-
messageId={id}
|
|
81
|
-
payload={toolCall}
|
|
82
|
-
type={toolCall.type}
|
|
83
|
-
/>
|
|
84
|
-
))}
|
|
85
|
-
</Flexbox>
|
|
86
|
-
)}
|
|
87
69
|
</Flexbox>
|
|
88
70
|
);
|
|
89
71
|
});
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
+
import { ToolIntervention } from '@lobechat/types';
|
|
1
2
|
import { ActionIcon, Icon, Tooltip } from '@lobehub/ui';
|
|
2
3
|
import { createStyles } from 'antd-style';
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Ban,
|
|
6
|
+
Check,
|
|
7
|
+
LayoutPanelTop,
|
|
8
|
+
LogsIcon,
|
|
9
|
+
LucideBug,
|
|
10
|
+
LucideBugOff,
|
|
11
|
+
Trash2,
|
|
12
|
+
X,
|
|
13
|
+
} from 'lucide-react';
|
|
4
14
|
import { CSSProperties, memo, useState } from 'react';
|
|
5
15
|
import { useTranslation } from 'react-i18next';
|
|
6
16
|
import { Flexbox } from 'react-layout-kit';
|
|
7
17
|
|
|
8
18
|
import { LOADING_FLAT } from '@/const/message';
|
|
19
|
+
import { useChatStore } from '@/store/chat';
|
|
9
20
|
import { shinyTextStylish } from '@/styles/loading';
|
|
10
|
-
import { ToolIntervention } from '@/types/message';
|
|
11
21
|
|
|
12
22
|
import Debug from './Debug';
|
|
13
23
|
import Settings from './Settings';
|
|
@@ -63,12 +73,12 @@ export const useStyles = createStyles(({ css, token, cx }) => ({
|
|
|
63
73
|
interface InspectorProps {
|
|
64
74
|
apiName: string;
|
|
65
75
|
arguments?: string;
|
|
76
|
+
assistantMessageId: string;
|
|
66
77
|
hidePluginUI?: boolean;
|
|
67
78
|
id: string;
|
|
68
79
|
identifier: string;
|
|
69
80
|
index: number;
|
|
70
81
|
intervention?: ToolIntervention;
|
|
71
|
-
messageId: string;
|
|
72
82
|
result?: { content: string | null; error?: any; state?: any };
|
|
73
83
|
setShowPluginRender: (show: boolean) => void;
|
|
74
84
|
setShowRender: (show: boolean) => void;
|
|
@@ -81,7 +91,7 @@ interface InspectorProps {
|
|
|
81
91
|
|
|
82
92
|
const Inspectors = memo<InspectorProps>(
|
|
83
93
|
({
|
|
84
|
-
|
|
94
|
+
assistantMessageId,
|
|
85
95
|
index,
|
|
86
96
|
identifier,
|
|
87
97
|
apiName,
|
|
@@ -100,6 +110,8 @@ const Inspectors = memo<InspectorProps>(
|
|
|
100
110
|
|
|
101
111
|
const [showDebug, setShowDebug] = useState(false);
|
|
102
112
|
|
|
113
|
+
const [deleteAssistantMessage] = useChatStore((s) => [s.deleteAssistantMessage]);
|
|
114
|
+
|
|
103
115
|
const hasError = !!result?.error;
|
|
104
116
|
const hasSuccessResult = !!result?.content && result.content !== LOADING_FLAT;
|
|
105
117
|
|
|
@@ -128,7 +140,7 @@ const Inspectors = memo<InspectorProps>(
|
|
|
128
140
|
identifier={identifier}
|
|
129
141
|
index={index}
|
|
130
142
|
isLoading={isTitleLoading}
|
|
131
|
-
messageId={
|
|
143
|
+
messageId={assistantMessageId}
|
|
132
144
|
toolCallId={id}
|
|
133
145
|
/>
|
|
134
146
|
</Flexbox>
|
|
@@ -152,6 +164,15 @@ const Inspectors = memo<InspectorProps>(
|
|
|
152
164
|
size={'small'}
|
|
153
165
|
title={t(showDebug ? 'debug.off' : 'debug.on')}
|
|
154
166
|
/>
|
|
167
|
+
<ActionIcon
|
|
168
|
+
icon={Trash2}
|
|
169
|
+
onClick={() => {
|
|
170
|
+
deleteAssistantMessage(assistantMessageId);
|
|
171
|
+
}}
|
|
172
|
+
size={'small'}
|
|
173
|
+
title={t('inspector.delete')}
|
|
174
|
+
/>
|
|
175
|
+
|
|
155
176
|
<Settings id={identifier} />
|
|
156
177
|
</Flexbox>
|
|
157
178
|
{hasResult && (
|
|
@@ -60,11 +60,11 @@ const Tool = memo<GroupToolProps>(
|
|
|
60
60
|
<Inspectors
|
|
61
61
|
apiName={apiName}
|
|
62
62
|
arguments={requestArgs}
|
|
63
|
+
assistantMessageId={assistantMessageId}
|
|
63
64
|
id={id}
|
|
64
65
|
identifier={identifier}
|
|
65
66
|
index={index}
|
|
66
67
|
intervention={intervention}
|
|
67
|
-
messageId={assistantMessageId}
|
|
68
68
|
result={result}
|
|
69
69
|
setShowPluginRender={setShowCustomPluginUI}
|
|
70
70
|
setShowRender={setShowToolDetail}
|