webui: Fix branching logic on edit message (#21175)

* fix: Branching logic + small refactor

* chore: update webui build output
This commit is contained in:
Aleksander Grygier
2026-03-30 14:40:50 +02:00
committed by GitHub
parent 278521c33a
commit 389c7d4955
4 changed files with 22 additions and 6 deletions
@@ -17,6 +17,17 @@
import { MessageRole } from '$lib/enums';
/**
* Finds a message by its ID in the given messages array.
*/
export function findMessageById(
messages: readonly DatabaseMessage[],
id: string | null | undefined
): DatabaseMessage | undefined {
if (!id) return undefined;
return messages.find((m) => m.id === id);
}
/**
* Filters messages to get the conversation path from root to a specific leaf node.
* If the leafNodeId doesn't exist, returns the path with the latest timestamp.
@@ -22,6 +22,7 @@ export { default as autoResizeTextarea } from './autoresize-textarea';
// Branching utilities
export {
filterByLeafNodeId,
findMessageById,
findLeafNode,
findDescendantMessages,
getMessageSiblings,