mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-07 20:28:46 +02:00
feat: allow branching from both user and assistant messages
- Relax branchSessionRecord validation to accept user or assistant roles - Show "Branch from here" hover button on all conversation messages - Contextual tooltip: "starting from this message" vs "continuing from this response" - Add test for branching from assistant message - Replace non-user rejection test with non-conversation rejection test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -237,8 +237,8 @@ export function branchSessionRecord(
|
||||
throw new Error(`Message ${messageId} not found in session ${session.id}.`);
|
||||
}
|
||||
|
||||
if (sourceMessage.role !== 'user') {
|
||||
throw new Error('Only user messages can be used as a branch point.');
|
||||
if (sourceMessage.role !== 'user' && sourceMessage.role !== 'assistant') {
|
||||
throw new Error('Only user or assistant messages can be used as a branch point.');
|
||||
}
|
||||
|
||||
const branchedMessages = session.messages.slice(0, sourceMessageIndex + 1).map(cloneChatMessageRecord);
|
||||
|
||||
Reference in New Issue
Block a user