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.
This commit is contained in:
matevip 2026-06-26 16:56:44 +08:00
parent 65f6a8c6b2
commit 20b8b63320
2 changed files with 7 additions and 5 deletions

View File

@ -2060,7 +2060,7 @@ export function useChat(options: UseChatOptions): UseChatReturn {
&& (m.status === 'generating' || m.status === 'awaiting_approval') && (m.status === 'generating' || m.status === 'awaiting_approval')
) )
if (existingAsst) { if (existingAsst) {
updateMessage(existingAsst.id, { updateMessage(existingAsst.id as string, {
...existingAsst, ...existingAsst,
content: '', content: '',
contentParts: [], contentParts: [],

View File

@ -127,9 +127,11 @@ export function useStickToBottom(
} }
// 处理滚动事件 // 处理滚动事件
const handleScroll = () => { const handleScroll = () => {
if (!scrollRef.value) return if (!scrollRef.value) return
if (isScrolling) { 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 const currentScrollTop = scrollRef.value.scrollTop
if (currentScrollTop < lastScrollTop) { if (currentScrollTop < lastScrollTop) {
isScrolling = false isScrolling = false
@ -138,7 +140,7 @@ export function useStickToBottom(
} }
lastScrollTop = scrollRef.value.scrollTop lastScrollTop = scrollRef.value.scrollTop
return return
} }
const element = scrollRef.value const element = scrollRef.value
const currentScrollTop = element.scrollTop const currentScrollTop = element.scrollTop