feat: add fork assistant message to new session
Add fork button on assistant messages to start new execution session Include synthetic meta-instruction when forking to explain context
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import type { Part } from '@opencode-ai/sdk';
|
||||
|
||||
type TextLikePart = Part & { text?: string; content?: string };
|
||||
|
||||
export const flattenAssistantTextParts = (parts: Part[]): string => {
|
||||
const textParts = parts
|
||||
.filter((part): part is TextLikePart => part?.type === 'text')
|
||||
.map((part) => (part.text || part.content || '').trim())
|
||||
.filter((text) => text.length > 0);
|
||||
|
||||
const combined = textParts.join('\n');
|
||||
return combined.replace(/\n\s*\n+/g, '\n');
|
||||
};
|
||||
Reference in New Issue
Block a user