@lobehub/chat 1.142.7 → 1.142.9

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 (28) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/changelog/v1.json +14 -0
  3. package/docs/usage/providers/comfyui.mdx +1 -1
  4. package/docs/usage/providers/comfyui.zh-CN.mdx +1 -1
  5. package/package.json +2 -2
  6. package/packages/context-engine/src/index.ts +1 -0
  7. package/packages/context-engine/src/processors/GroupMessageFlatten.ts +144 -0
  8. package/packages/context-engine/src/processors/__tests__/GroupMessageFlatten.test.ts +522 -0
  9. package/packages/context-engine/src/processors/index.ts +1 -0
  10. package/packages/database/src/models/__tests__/message.test.ts +72 -0
  11. package/packages/database/src/models/message.ts +50 -8
  12. package/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts +34 -0
  13. package/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts +12 -0
  14. package/packages/types/src/message/db/params.ts +26 -0
  15. package/packages/types/src/message/ui/params.ts +40 -0
  16. package/src/app/(backend)/oidc/consent/route.ts +0 -1
  17. package/src/envs/app.ts +2 -0
  18. package/src/libs/oidc-provider/config.ts +21 -0
  19. package/src/libs/oidc-provider/provider.test.ts +527 -0
  20. package/src/libs/oidc-provider/provider.ts +75 -0
  21. package/src/server/routers/lambda/message.ts +8 -0
  22. package/src/services/message/_deprecated.ts +8 -0
  23. package/src/services/message/client.ts +21 -12
  24. package/src/services/message/server.ts +7 -0
  25. package/src/services/message/type.ts +2 -0
  26. package/src/store/chat/slices/plugin/action.test.ts +37 -4
  27. package/src/store/chat/slices/plugin/action.ts +4 -2
  28. package/src/features/Conversation/Messages/Assistant/Block.tsx +0 -63
package/CHANGELOG.md CHANGED
@@ -2,6 +2,48 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 1.142.9](https://github.com/lobehub/lobe-chat/compare/v1.142.8...v1.142.9)
6
+
7
+ <sup>Released on **2025-11-02**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: OIDC error when connecting to self-host instance.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: OIDC error when connecting to self-host instance, closes [#9916](https://github.com/lobehub/lobe-chat/issues/9916) ([2e2b9c4](https://github.com/lobehub/lobe-chat/commit/2e2b9c4))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 1.142.8](https://github.com/lobehub/lobe-chat/compare/v1.142.7...v1.142.8)
31
+
32
+ <sup>Released on **2025-10-30**</sup>
33
+
34
+ <br/>
35
+
36
+ <details>
37
+ <summary><kbd>Improvements and Fixes</kbd></summary>
38
+
39
+ </details>
40
+
41
+ <div align="right">
42
+
43
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
44
+
45
+ </div>
46
+
5
47
  ### [Version 1.142.7](https://github.com/lobehub/lobe-chat/compare/v1.142.6...v1.142.7)
6
48
 
7
49
  <sup>Released on **2025-10-28**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "OIDC error when connecting to self-host instance."
6
+ ]
7
+ },
8
+ "date": "2025-11-02",
9
+ "version": "1.142.9"
10
+ },
11
+ {
12
+ "children": {},
13
+ "date": "2025-10-30",
14
+ "version": "1.142.8"
15
+ },
2
16
  {
3
17
  "children": {
4
18
  "improvements": [
@@ -11,7 +11,7 @@ tags:
11
11
 
12
12
  # Using ComfyUI in LobeChat
13
13
 
14
- <Image alt={'Using ComfyUI in LobeChat'} cover src={'https://github.com/lobehub/lobe-chat/assets/17870709/c9e5eafc-ca22-496b-a88d-cc0ae53bf720'} />
14
+ <Image alt={'Using ComfyUI in LobeChat'} cover src={'https://hub-apac-1.lobeobjects.space/docs/e9b811f248a1db2bd1be1af888cf9b9d.png'} />
15
15
 
16
16
  This documentation will guide you on how to use [ComfyUI](https://github.com/comfyanonymous/ComfyUI) in LobeChat for high-quality AI image generation and editing.
17
17
 
@@ -11,7 +11,7 @@ tags:
11
11
 
12
12
  # 在 LobeChat 中使用 ComfyUI
13
13
 
14
- <Image alt={'在 LobeChat 中使用 ComfyUI'} cover src={'https://github.com/lobehub/lobe-chat/assets/17870709/c9e5eafc-ca22-496b-a88d-cc0ae53bf720'} />
14
+ <Image alt={'在 LobeChat 中使用 ComfyUI'} cover src={'https://hub-apac-1.lobeobjects.space/docs/e9b811f248a1db2bd1be1af888cf9b9d.png'} />
15
15
 
16
16
  本文档将指导你如何在 LobeChat 中使用 [ComfyUI](https://github.com/comfyanonymous/ComfyUI) 进行高质量的 AI 图像生成和编辑。
17
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.142.7",
3
+ "version": "1.142.9",
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",
@@ -236,7 +236,7 @@
236
236
  "modern-screenshot": "^4.6.6",
237
237
  "nanoid": "^5.1.6",
238
238
  "next": "~15.3.5",
239
- "next-auth": "5.0.0-beta.29",
239
+ "next-auth": "5.0.0-beta.30",
240
240
  "next-mdx-remote": "^5.0.0",
241
241
  "nextjs-toploader": "^3.9.17",
242
242
  "node-machine-id": "^1.1.12",
@@ -19,6 +19,7 @@ export {
19
19
 
20
20
  // Processors
21
21
  export {
22
+ GroupMessageFlattenProcessor,
22
23
  HistoryTruncateProcessor,
23
24
  InputTemplateProcessor,
24
25
  MessageCleanupProcessor,
@@ -0,0 +1,144 @@
1
+ import debug from 'debug';
2
+
3
+ import { BaseProcessor } from '../base/BaseProcessor';
4
+ import type { PipelineContext, ProcessorOptions } from '../types';
5
+
6
+ const log = debug('context-engine:processor:GroupMessageFlattenProcessor');
7
+
8
+ /**
9
+ * Group Message Flatten Processor
10
+ * Responsible for flattening role=group messages into standard assistant + tool message sequences
11
+ *
12
+ * Group messages are created when assistant messages with tools are merged with their tool results.
13
+ * This processor converts them back to a flat structure that AI models can understand.
14
+ */
15
+ export class GroupMessageFlattenProcessor extends BaseProcessor {
16
+ readonly name = 'GroupMessageFlattenProcessor';
17
+
18
+ constructor(options: ProcessorOptions = {}) {
19
+ super(options);
20
+ }
21
+
22
+ protected async doProcess(context: PipelineContext): Promise<PipelineContext> {
23
+ const clonedContext = this.cloneContext(context);
24
+
25
+ let processedCount = 0;
26
+ let groupMessagesFlattened = 0;
27
+ let assistantMessagesCreated = 0;
28
+ let toolMessagesCreated = 0;
29
+
30
+ const newMessages: any[] = [];
31
+
32
+ // Process each message
33
+ for (const message of clonedContext.messages) {
34
+ // Check if this is a group message with children field
35
+ if (message.role === 'group' && message.children) {
36
+ // If children array is empty, skip this message entirely (no content to flatten)
37
+ if (message.children.length === 0) {
38
+ continue;
39
+ }
40
+
41
+ processedCount++;
42
+ groupMessagesFlattened++;
43
+
44
+ log(`Flattening group message ${message.id} with ${message.children.length} children`);
45
+
46
+ // Flatten each child
47
+ for (const child of message.children) {
48
+ // 1. Create assistant message from child
49
+ const assistantMsg: any = {
50
+ content: child.content || '',
51
+ createdAt: message.createdAt,
52
+ id: child.id,
53
+ meta: message.meta,
54
+ role: 'assistant',
55
+ updatedAt: message.updatedAt,
56
+ };
57
+
58
+ // Add tools if present (excluding result, which will be separate tool messages)
59
+ if (child.tools && child.tools.length > 0) {
60
+ assistantMsg.tools = child.tools.map((tool: any) => ({
61
+ apiName: tool.apiName,
62
+ arguments: tool.arguments,
63
+ id: tool.id,
64
+ identifier: tool.identifier,
65
+ type: tool.type,
66
+ }));
67
+ }
68
+
69
+ // Add reasoning if present (for models that support reasoning)
70
+ if (message.reasoning) {
71
+ assistantMsg.reasoning = message.reasoning;
72
+ }
73
+
74
+ // Preserve other fields that might be needed
75
+ if (message.parentId) assistantMsg.parentId = message.parentId;
76
+ if (message.threadId) assistantMsg.threadId = message.threadId;
77
+ if (message.groupId) assistantMsg.groupId = message.groupId;
78
+ if (message.agentId) assistantMsg.agentId = message.agentId;
79
+ if (message.targetId) assistantMsg.targetId = message.targetId;
80
+ if (message.topicId) assistantMsg.topicId = message.topicId;
81
+
82
+ newMessages.push(assistantMsg);
83
+ assistantMessagesCreated++;
84
+
85
+ log(`Created assistant message ${assistantMsg.id} from child`);
86
+
87
+ // 2. Create tool messages for each tool that has a result
88
+ if (child.tools) {
89
+ for (const tool of child.tools) {
90
+ if (tool.result) {
91
+ const toolMsg: any = {
92
+ content: tool.result.content,
93
+ createdAt: message.createdAt,
94
+ id: tool.result.id,
95
+ meta: message.meta,
96
+ plugin: {
97
+ apiName: tool.apiName,
98
+ arguments: tool.arguments,
99
+ id: tool.id,
100
+ identifier: tool.identifier,
101
+ type: tool.type,
102
+ },
103
+ pluginError: tool.result.error || undefined,
104
+ pluginState: tool.result.state || undefined,
105
+ role: 'tool',
106
+ tool_call_id: tool.id,
107
+ updatedAt: message.updatedAt,
108
+ };
109
+
110
+ // Preserve parent message references
111
+ if (message.parentId) toolMsg.parentId = message.parentId;
112
+ if (message.threadId) toolMsg.threadId = message.threadId;
113
+ if (message.groupId) toolMsg.groupId = message.groupId;
114
+ if (message.topicId) toolMsg.topicId = message.topicId;
115
+
116
+ newMessages.push(toolMsg);
117
+ toolMessagesCreated++;
118
+
119
+ log(`Created tool message ${toolMsg.id} for tool call ${tool.id}`);
120
+ }
121
+ }
122
+ }
123
+ }
124
+ } else {
125
+ // Non-group message, keep as-is
126
+ newMessages.push(message);
127
+ }
128
+ }
129
+
130
+ clonedContext.messages = newMessages;
131
+
132
+ // Update metadata
133
+ clonedContext.metadata.groupMessagesFlattenProcessed = processedCount;
134
+ clonedContext.metadata.groupMessagesFlattened = groupMessagesFlattened;
135
+ clonedContext.metadata.assistantMessagesCreated = assistantMessagesCreated;
136
+ clonedContext.metadata.toolMessagesCreated = toolMessagesCreated;
137
+
138
+ log(
139
+ `Group message flatten processing completed: ${groupMessagesFlattened} groups flattened, ${assistantMessagesCreated} assistant messages created, ${toolMessagesCreated} tool messages created`,
140
+ );
141
+
142
+ return this.markAsExecuted(clonedContext);
143
+ }
144
+ }