Claude: Improve robustness of chat scrolling
This commit is contained in:
parent
7a3531be01
commit
109063e433
@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { apiState, setApiKey, addMessage, messageList, currentMessage } from '$lib/anthropic.js'
|
import { apiState, setApiKey, addMessage, messageList, currentMessage } from '$lib/anthropic.js'
|
||||||
|
import { tick } from 'svelte';
|
||||||
import PanelButton from './PanelButton.svelte';
|
import PanelButton from './PanelButton.svelte';
|
||||||
export let handleTool;
|
export let handleTool;
|
||||||
function handleKeyEnter(e)
|
function handleKeyEnter(e)
|
||||||
@ -30,13 +31,18 @@
|
|||||||
var textArea = e.target;
|
var textArea = e.target;
|
||||||
textArea.style.height = textArea.scrollHeight + "px";
|
textArea.style.height = textArea.scrollHeight + "px";
|
||||||
}
|
}
|
||||||
|
async function scrollToBottom(node)
|
||||||
|
{
|
||||||
|
await tick();
|
||||||
|
node.scrollTop = node.scrollHeight;
|
||||||
|
}
|
||||||
function scrollMessage(node, messageList)
|
function scrollMessage(node, messageList)
|
||||||
{
|
{
|
||||||
// Make sure the messages are always scrolled to the bottom
|
// Make sure the messages are always scrolled to the bottom
|
||||||
node.scrollTop = node.scrollHeight;
|
scrollToBottom(node);
|
||||||
return {
|
return {
|
||||||
update(messageList) {
|
update(messageList) {
|
||||||
node.scrollTop = node.scrollHeight;
|
scrollToBottom(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user