fix: preserve image attachments in live and restored conversations
This commit is contained in:
@@ -104,7 +104,9 @@ export interface PiConversationRuntimeOptions {
|
||||
pool: PiWorkerPool;
|
||||
registry: PiSessionRegistry;
|
||||
resolveModel(model: ProductModelRef): Promise<PiProviderSelection>;
|
||||
resolveImages?(attachments: Array<{ attachmentId: string }>): Promise<unknown[]>;
|
||||
resolveImages?(attachments: Array<{ attachmentId: string }>): Promise<Array<{
|
||||
type: 'image'; data: string; mimeType: string;
|
||||
}>>;
|
||||
projectImage?: PiEventProjectorOptions['projectImage'];
|
||||
createId?(kind: RuntimeIdKind): string;
|
||||
now?: () => number;
|
||||
@@ -813,9 +815,17 @@ export class PiConversationRuntime implements CodingConversationRuntime {
|
||||
clientRequestId: input.clientRequestId,
|
||||
role: 'user',
|
||||
status: 'optimistic',
|
||||
blocks: input.text.length > 0
|
||||
? [{ kind: 'text', id: `${messageId}:content:0`, text: input.text, status: 'complete' }]
|
||||
: [],
|
||||
blocks: [
|
||||
...(input.text.length > 0
|
||||
? [{ kind: 'text' as const, id: `${messageId}:content:0`, text: input.text, status: 'complete' as const }]
|
||||
: []),
|
||||
...input.attachments.map(({ attachmentId }, index) => ({
|
||||
kind: 'image' as const,
|
||||
id: `${messageId}:content:${index + (input.text.length > 0 ? 1 : 0)}`,
|
||||
attachmentId,
|
||||
mime: images[index].mimeType,
|
||||
})),
|
||||
],
|
||||
},
|
||||
});
|
||||
const command: PiRpcCommand = {
|
||||
|
||||
Reference in New Issue
Block a user