提交 89226cb8 编写于 作者: D DebugIsFalse

Merge branch 'main' of gitcode.com:git_bot/ai-fe

<template>
<Transition
@enter="onEnter"
@after-enter="onAfterEnter"
@before-leave="onBeforeLeave"
@leave="onLeave"
>
<div v-show="open" class="flex transition-[height] overflow-hidden"><slot /></div>
</Transition>
</template>
<script setup>
const props = defineProps({
open: {
type: Boolean,
default: true
}
})
function onEnter(_el, done) {
const el = _el
el.style.height = '0'
el.offsetHeight
el.style.height = el.scrollHeight + 'px'
el.addEventListener('transitionend', done, { once: true })
}
function onBeforeLeave(_el) {
const el = _el
el.style.height = el.scrollHeight + 'px'
el.offsetHeight
}
function onAfterEnter(_el) {
const el = _el
el.style.height = 'auto'
}
function onLeave(_el, done) {
const el = _el
el.style.height = '0'
el.addEventListener('transitionend', done, { once: true })
}
</script>
......@@ -25,6 +25,7 @@
color="red"
trailing-icon="i-heroicons-stop-20-solid"
size="xl"
variant="ghost"
@click="handleStop"
/>
</UTooltip>
......
<template>
<UCard :ui="{ body: { padding: 'p-4 sm:p-4' } }">
<UAccordion :items="[{}]" default-open>
<template #default="{ open }">
<div class="flex justify-between items-center">
<div class="flex items-center gap-2 text-lg">
<UIcon name="i-heroicons-sparkles-20-solid" />
......@@ -11,13 +9,13 @@
size="md"
color="gray"
variant="ghost"
:icon="open ? 'i-heroicons-chevron-up-20-solid' : 'i-heroicons-chevron-down-20-solid'"
:icon="openCollapse ? 'i-heroicons-chevron-up-20-solid' : 'i-heroicons-chevron-down-20-solid'"
:ui="{ rounded: 'rounded-full' }"
@click="handleToggleCollapse"
/>
</div>
</template>
<template #item>
<div class="flex flex-col gap-2">
<ICollapse :open="openCollapse" class="mt-2">
<div class="flex flex-col gap-2 w-full text-gray-500 dark:text-gray-400">
<div class="text-base flex items-center gap-1">
<UIcon name="i-heroicons-inbox-arrow-down" />
理解问题
......@@ -43,10 +41,8 @@
整理答案
</div>
</div>
</template>
</UAccordion>
</ICollapse>
</UCard>
<div class="text-xl flex items-center space-x-1" v-if="item.ansLoading !== undefined">
<UIcon name="i-heroicons-chat-bubble-left-right-20-solid" />
<span>{{ item.ansLoading ? '回答中' : '回答' }}</span>
......@@ -92,7 +88,25 @@ const props = defineProps({
}
})
const emits = defineEmits(['regenerate'])
const openCollapse = ref(true)
function handleToggleCollapse () {
openCollapse.value = !openCollapse.value
}
function handleCollapse (state) {
openCollapse.value = state
}
watch(
() => props.item.ansLoading,
(value, oldValue) => {
if (oldValue === undefined) {
setTimeout(() => {
handleCollapse(false)
}, 500)
}
}
)
function handleReGenerate () {
handleCollapse(true)
emits('regenerate', props.index)
}
function handleCopyMD () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册