Commit 45b0bf3
committed
fix: load up to existing message ID when continuing a truncated response
When the user clicks "Continue" on a stopped/truncated assistant message,
the frontend reuses the existing message's ID as message_id while
parent_message_id still points to the user message.
Previously load_messages_from_db used parent_message_id, so the partial
assistant message was excluded from the DB load. The model received context
ending at the user message, generated a complete fresh response, which then
got appended to the existing partial content → duplication.
Fix: detect the "continue" case by checking whether message_id already
exists in the DB. If so, load messages up to and including that message so
the model sees the partial and generates only the suffix.1 parent 0f1b3b0 commit 45b0bf3
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2101 | 2101 | | |
2102 | 2102 | | |
2103 | 2103 | | |
2104 | | - | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
2105 | 2114 | | |
2106 | 2115 | | |
2107 | 2116 | | |
| |||
0 commit comments