fix: Auto-Scroll bei Assistant-Antworten repariert [appimage]
All checks were successful
Build AppImage / build (push) Successful in 6m56s
All checks were successful
Build AppImage / build (push) Successful in 6m56s
Role-Change-Effect scrollt jetzt bei jedem Rollenwechsel (nicht nur user), Content-Tracker trackt auch parts-Array fuer Tool-Calls und Streaming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dcc42ee903
commit
c2f2cae2ef
1 changed files with 11 additions and 8 deletions
|
|
@ -105,6 +105,11 @@
|
||||||
$messages.length,
|
$messages.length,
|
||||||
$isProcessing,
|
$isProcessing,
|
||||||
last?.content?.length ?? 0,
|
last?.content?.length ?? 0,
|
||||||
|
last?.parts?.length ?? 0,
|
||||||
|
// Letzten Part tracken — bei Streaming waechst dessen content
|
||||||
|
(last?.parts && last.parts.length > 0)
|
||||||
|
? last.parts[last.parts.length - 1]?.content?.length ?? 0
|
||||||
|
: 0,
|
||||||
last?.toolCalls?.length ?? 0,
|
last?.toolCalls?.length ?? 0,
|
||||||
last?.toolCalls?.map((t) => t.status).join(',') ?? '',
|
last?.toolCalls?.map((t) => t.status).join(',') ?? '',
|
||||||
];
|
];
|
||||||
|
|
@ -120,14 +125,12 @@
|
||||||
const last = $messages[$messages.length - 1];
|
const last = $messages[$messages.length - 1];
|
||||||
const role = last?.role ?? null;
|
const role = last?.role ?? null;
|
||||||
if (role && role !== lastRole) {
|
if (role && role !== lastRole) {
|
||||||
if (role === 'user') {
|
// Beim Rollenwechsel (user→assistant oder assistant→user):
|
||||||
// Beim Senden: wieder ans Ende kleben — und sofort scrollen,
|
// Immer wieder ans Ende kleben. Ohne das bleibt userScrolledUp=true
|
||||||
// nicht auf den naechsten Stream-Token warten. Force=true geht
|
// wenn checkScroll zwischen User-Send und Assistant-Antwort feuert,
|
||||||
// am userScrolledUp-Guard vorbei. Ein rAF, damit das DOM die
|
// und der Auto-Scroll fuer die gesamte Antwort ist tot.
|
||||||
// neue Message schon gerendert hat.
|
userScrolledUp = false;
|
||||||
userScrolledUp = false;
|
requestAnimationFrame(() => scrollToBottom(true));
|
||||||
requestAnimationFrame(() => scrollToBottom(true));
|
|
||||||
}
|
|
||||||
lastRole = role;
|
lastRole = role;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue