From 20b8b633200544f93a95d840ad1abdee15095146 Mon Sep 17 00:00:00 2001 From: matevip Date: Fri, 26 Jun 2026 16:56:44 +0800 Subject: [PATCH] fix(chat): fix type error and indentation in reconnect/scroll-lock change - useChat.ts reconnectStream: cast the reused assistant message id to string when calling updateMessage; the id is optional in the Message type, so the raw value broke the vue-tsc build (TS2345, undefined not assignable). - useStickToBottom.ts handleScroll: restore the block's indentation (it had drifted to 1/3-space) and add a comment for the scroll-up release branch. Verified: vue-tsc --noEmit passes; snowflake precision check clean. --- mateclaw-ui/src/composables/chat/useChat.ts | 2 +- mateclaw-ui/src/composables/chat/useStickToBottom.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mateclaw-ui/src/composables/chat/useChat.ts b/mateclaw-ui/src/composables/chat/useChat.ts index 9da575e3..b90a6910 100644 --- a/mateclaw-ui/src/composables/chat/useChat.ts +++ b/mateclaw-ui/src/composables/chat/useChat.ts @@ -2060,7 +2060,7 @@ export function useChat(options: UseChatOptions): UseChatReturn { && (m.status === 'generating' || m.status === 'awaiting_approval') ) if (existingAsst) { - updateMessage(existingAsst.id, { + updateMessage(existingAsst.id as string, { ...existingAsst, content: '', contentParts: [], diff --git a/mateclaw-ui/src/composables/chat/useStickToBottom.ts b/mateclaw-ui/src/composables/chat/useStickToBottom.ts index 278bc9fe..b08d44a4 100644 --- a/mateclaw-ui/src/composables/chat/useStickToBottom.ts +++ b/mateclaw-ui/src/composables/chat/useStickToBottom.ts @@ -127,9 +127,11 @@ export function useStickToBottom( } // 处理滚动事件 - const handleScroll = () => { - if (!scrollRef.value) return - if (isScrolling) { + const handleScroll = () => { + if (!scrollRef.value) return + if (isScrolling) { + // User scrolled up during a programmatic scroll — release the lock so the + // view stops snapping back to the bottom. const currentScrollTop = scrollRef.value.scrollTop if (currentScrollTop < lastScrollTop) { isScrolling = false @@ -138,7 +140,7 @@ export function useStickToBottom( } lastScrollTop = scrollRef.value.scrollTop return - } + } const element = scrollRef.value const currentScrollTop = element.scrollTop