feat: close hint for new responses

This commit is contained in:
Justin Lin committed 2025-04-26 11:27:44 +08:00
1 parent beb58e233e
commit 876cae6947
1 file changed
+8 -1
+8 -1
View File
@@ -5,6 +5,7 @@ import MarkdownText from '../MarkdownText.vue'
const sessionStore = useSession()
const current = ref(-1)
const hintDetails = ref<HTMLDetailsElement | null>(null)
const length = computed(() => {
return sessionStore.session?.responses?.length ?? 0
})
@@ -36,6 +37,12 @@ const response = computed(() => {
if (current.value >= sessionStore.session.responses.length) return null
return sessionStore.session.responses[current.value]
})
watch(response, () => {
if (hintDetails.value) {
hintDetails.value.open = false
}
})
</script>
<template>
@@ -89,7 +96,7 @@ const response = computed(() => {
v-if="response?.hint"
class="text-text-primary font-xl whitespace-pre-wrap"
>
<details>
<details ref="hintDetails">
<summary class="cursor-pointer">提示</summary>
<MarkdownText :content="response.hint" />
</details>