(messages: ChatMessage[], parentId: string | undefined)
| 127 | } |
| 128 | |
| 129 | export function getNextBranchIndex(messages: ChatMessage[], parentId: string | undefined): number { |
| 130 | const children = getChildMessages(messages, parentId) |
| 131 | if (children.length === 0) return 0 |
| 132 | return Math.max(...children.map((c) => c.branchIndex ?? 0)) + 1 |
| 133 | } |
| 134 | |
| 135 | export async function switchBranch(pageId: string, messageId: string): Promise<void> { |
| 136 | const record = stores.message.get(pageId) |
nothing calls this directly
no test coverage detected