From 11250811a6796dee8bcca154498293b5c416bb22 Mon Sep 17 00:00:00 2001 From: let5sne Date: Tue, 21 Jul 2026 05:01:43 +0800 Subject: [PATCH] fix: show work capture context before actions --- mobile-uni/src/pages/user/sop/index.vue | 25 +++++++++++++++++++++++-- mobile-uni/tests/ask-memory.test.mjs | 6 +++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/mobile-uni/src/pages/user/sop/index.vue b/mobile-uni/src/pages/user/sop/index.vue index 8bc1bfd7..4a98caaa 100644 --- a/mobile-uni/src/pages/user/sop/index.vue +++ b/mobile-uni/src/pages/user/sop/index.vue @@ -32,7 +32,13 @@ 查看 › - + @@ -61,7 +67,7 @@ - + @@ -428,6 +434,7 @@ const quickQuestionPlaceholder = computed(() => `例如: ${quickQuestions.value[ const messages = ref([]); const threadScrollTop = ref(0); +const threadScrollIntoView = ref(''); const composerRef = ref | null>(null); const summaryCard = ref(null); const loading = ref(false); @@ -496,10 +503,20 @@ const speechPlayback = createSpeechPlaybackController( const scrollToBottom = () => { void nextTick(() => { + threadScrollIntoView.value = ''; threadScrollTop.value = 100000 + (++scrollSeq * 200); }); }; +const scrollToMessageStart = (messageId: number) => { + void nextTick(() => { + threadScrollIntoView.value = ''; + void nextTick(() => { + threadScrollIntoView.value = `chat-message-${messageId}`; + }); + }); +}; + const pushMsg = (msg: Omit): T => { const withId = { ...msg, id: ++msgSeq } as T; messages.value = [...messages.value, withId]; @@ -511,6 +528,10 @@ const replaceMsg = (id: number, next: ChatMsg | null) => { messages.value = next ? messages.value.map((item) => (item.id === id ? next : item)) : messages.value.filter((item) => item.id !== id); + if (next?.role === 'master' && next.result.memoryCandidate) { + scrollToMessageStart(id); + return; + } scrollToBottom(); }; diff --git a/mobile-uni/tests/ask-memory.test.mjs b/mobile-uni/tests/ask-memory.test.mjs index e5fa81c3..db246c02 100644 --- a/mobile-uni/tests/ask-memory.test.mjs +++ b/mobile-uni/tests/ask-memory.test.mjs @@ -48,10 +48,14 @@ test('工作助手按项目名称选择并为文字、媒体和工具请求携 assert.match(auth, /reconcileCurrentProject/); }); -test('项目选择面板避开底栏且确认卡内容增长后重新滚到底部', async () => { +test('项目选择面板避开底栏,普通消息滚底且确认卡从识别结论处展示', async () => { const page = await read('../src/pages/user/sop/index.vue'); assert.match(page, /inset:\s*0 0 var\(--window-bottom, 0px\)/); assert.match(page, /let scrollSeq = 0/); assert.match(page, /threadScrollTop\.value = 100000 \+ \(\+\+scrollSeq \* 200\)/); + assert.match(page, /:scroll-into-view="threadScrollIntoView"/); + assert.match(page, /:id="`chat-message-\$\{msg\.id\}`"/); + assert.match(page, /next\?\.role === 'master' && next\.result\.memoryCandidate/); + assert.match(page, /scrollToMessageStart\(id\)/); });