fix: show work capture context before actions
This commit is contained in:
@@ -32,7 +32,13 @@
|
||||
<text class="today-result-arrow">查看 ›</text>
|
||||
</button>
|
||||
|
||||
<scroll-view scroll-y class="chat-thread" :scroll-top="threadScrollTop" :scroll-with-animation="true">
|
||||
<scroll-view
|
||||
scroll-y
|
||||
class="chat-thread"
|
||||
:scroll-top="threadScrollTop"
|
||||
:scroll-into-view="threadScrollIntoView"
|
||||
:scroll-with-animation="true"
|
||||
>
|
||||
<view class="thread-inner">
|
||||
<view class="bubble-row left">
|
||||
<image class="avatar master-avatar" src="/static/mentor-female-avatar.png" mode="aspectFill" />
|
||||
@@ -61,7 +67,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else class="bubble-row left">
|
||||
<view v-else :id="`chat-message-${msg.id}`" class="bubble-row left">
|
||||
<image class="avatar master-avatar" src="/static/mentor-female-avatar.png" mode="aspectFill" />
|
||||
<view class="master-col">
|
||||
<view v-if="msg.voiceStatus !== 'unavailable'" class="voice-line">
|
||||
@@ -428,6 +434,7 @@ const quickQuestionPlaceholder = computed(() => `例如: ${quickQuestions.value[
|
||||
|
||||
const messages = ref<ChatMsg[]>([]);
|
||||
const threadScrollTop = ref(0);
|
||||
const threadScrollIntoView = ref('');
|
||||
const composerRef = ref<InstanceType<typeof ChatComposer> | null>(null);
|
||||
const summaryCard = ref<SummaryCardResponse | null>(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 = <T extends ChatMsg>(msg: Omit<T, 'id'>): 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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user