fix(pipelines): retain debug chat image history

This commit is contained in:
RockChinQ
2026-08-26 00:32:03 +08:00
parent 94fd3d274c
commit 47f5515fa9
7 changed files with 105 additions and 36 deletions
@@ -457,7 +457,7 @@ export default function DebugDialog({
return;
}
const messageChain = [];
const messageChain: MessageChainComponent[] = [];
// Add quoted message if present
if (quotedMessage) {
@@ -511,17 +511,21 @@ export default function DebugDialog({
type: 'Image',
path: result.file_key,
});
} else {
} else if (attachment.kind === 'voice') {
// Voice / File go through the generic document upload endpoint,
// which returns a storage key the backend resolves into the
// sandbox inbox just like images.
const result = await httpClient.uploadDocumentFile(attachment.file);
messageChain.push({
type: attachment.kind === 'voice' ? 'Voice' : 'File',
type: 'Voice',
path: result.file_id,
...(attachment.kind === 'file'
? { name: attachment.file.name }
: {}),
});
} else {
const result = await httpClient.uploadDocumentFile(attachment.file);
messageChain.push({
type: 'File',
path: result.file_id,
name: attachment.file.name,
});
}
} catch (error) {
+1 -1
View File
@@ -19,7 +19,7 @@ export interface Plain extends MessageComponent {
// Quote component
export interface Quote extends MessageComponent {
type: 'Quote';
id?: number;
id?: number | string;
group_id?: number | string;
sender_id?: number | string;
target_id?: number | string;
@@ -3,12 +3,13 @@
* 用于管理WebSocket连接和消息处理
*/
import { getActiveWorkspaceUuid } from '@/app/infra/http/workspaceContext';
import type { MessageChainComponent } from '@/app/infra/entities/message';
export interface WebSocketMessage {
id: number;
role: 'user' | 'assistant';
content: string;
message_chain: Array<{ type: string; text?: string; target?: string }>;
message_chain: MessageChainComponent[];
timestamp: string;
is_final?: boolean;
connection_id?: string;
@@ -16,7 +17,12 @@ export interface WebSocketMessage {
export interface WebSocketResponse {
type:
'connected' | 'response' | 'user_message' | 'pong' | 'broadcast' | 'error';
| 'connected'
| 'response'
| 'user_message'
| 'pong'
| 'broadcast'
| 'error';
connection_id?: string;
pipeline_uuid?: string;
session_type?: string;
@@ -262,7 +268,7 @@ export class WebSocketClient {
* 发送消息
*/
public sendMessage(
messageChain: Array<{ type: string; text?: string; target?: string }>,
messageChain: MessageChainComponent[],
stream: boolean = true,
) {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {