fix: keep generated prompts scrolled into view

Force chat to bottom on normal sends
Scroll generated commit prompts into view
Preserve saved scroll restore for passive navigation
This commit is contained in:
Bohdan Triapitsyn
2026-05-01 13:48:07 +03:00
parent 1991736ebf
commit d820e25ea1
2 changed files with 28 additions and 4 deletions
+9
View File
@@ -51,6 +51,13 @@ const getRuntimeGit = () => {
return null;
};
const requestChatForceScrollBottom = (sessionId: string) => {
if (typeof window === 'undefined') return;
window.dispatchEvent(new CustomEvent('openchamber:chat-force-scroll-bottom', {
detail: { sessionId },
}));
};
export async function checkIsGitRepository(directory: string): Promise<boolean> {
const runtime = getRuntimeGit();
if (runtime) return runtime.checkIsGitRepository(directory);
@@ -373,6 +380,8 @@ const runStructuredGenerationInActiveSession = async ({
throw new Error('Generation prompts are empty');
}
requestChatForceScrollBottom(generationSession.sessionId);
const response = await opencodeClient.withDirectory(directory, async () => {
return opencodeClient.getApiClient().session.prompt({
sessionID: generationSession.sessionId,