提交 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 @@ ...@@ -25,6 +25,7 @@
color="red" color="red"
trailing-icon="i-heroicons-stop-20-solid" trailing-icon="i-heroicons-stop-20-solid"
size="xl" size="xl"
variant="ghost"
@click="handleStop" @click="handleStop"
/> />
</UTooltip> </UTooltip>
......
<template> <template>
<UCard :ui="{ body: { padding: 'p-4 sm:p-4' } }"> <UCard :ui="{ body: { padding: 'p-4 sm:p-4' } }">
<UAccordion :items="[{}]" default-open> <div class="flex justify-between items-center">
<template #default="{ open }"> <div class="flex items-center gap-2 text-lg">
<div class="flex justify-between items-center"> <UIcon name="i-heroicons-sparkles-20-solid" />
<div class="flex items-center gap-2 text-lg"> 搜索过程
<UIcon name="i-heroicons-sparkles-20-solid" /> </div>
搜索过程 <UButton
</div> size="md"
<UButton color="gray"
size="md" variant="ghost"
color="gray" :icon="openCollapse ? 'i-heroicons-chevron-up-20-solid' : 'i-heroicons-chevron-down-20-solid'"
variant="ghost" :ui="{ rounded: 'rounded-full' }"
:icon="open ? 'i-heroicons-chevron-up-20-solid' : 'i-heroicons-chevron-down-20-solid'" @click="handleToggleCollapse"
:ui="{ rounded: 'rounded-full' }" />
/> </div>
<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" />
理解问题
</div> </div>
</template> <template v-if="item.desLoading">
<template #item> <USkeleton class="h-4" />
<div class="flex flex-col gap-2"> <USkeleton class="h-4 w-2/3" />
</template>
<IMdMdc v-else :content="item.description" />
<template v-if="item.searchLoading !== undefined">
<div class="text-base flex items-center gap-1"> <div class="text-base flex items-center gap-1">
<UIcon name="i-heroicons-inbox-arrow-down" /> <UIcon name="i-heroicons-magnifying-glass" />
理解问题 搜索项目
</div> </div>
<template v-if="item.desLoading"> <template v-if="item.searchLoading">
<USkeleton class="h-4" /> <USkeleton class="h-4" />
<USkeleton class="h-4 w-2/3" /> <USkeleton class="h-4 w-2/3" />
</template> </template>
<IMdMdc v-else :content="item.description" /> <div class="text-xs pl-5" v-else>找到 {{ sourceCount }} 条来源</div>
<template v-if="item.searchLoading !== undefined"> </template>
<div class="text-base flex items-center gap-1"> <div class="text-base flex items-center gap-1" v-if="item.ansLoading !== undefined">
<UIcon name="i-heroicons-magnifying-glass" /> <UIcon name="i-heroicons-pencil-square" />
搜索项目 整理答案
</div>
<template v-if="item.searchLoading">
<USkeleton class="h-4" />
<USkeleton class="h-4 w-2/3" />
</template>
<div class="text-xs pl-5" v-else>找到 {{ sourceCount }} 条来源</div>
</template>
<div class="text-base flex items-center gap-1" v-if="item.ansLoading !== undefined">
<UIcon name="i-heroicons-pencil-square" />
整理答案
</div>
</div> </div>
</template> </div>
</UAccordion> </ICollapse>
</UCard> </UCard>
<div class="text-xl flex items-center space-x-1" v-if="item.ansLoading !== undefined"> <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" /> <UIcon name="i-heroicons-chat-bubble-left-right-20-solid" />
<span>{{ item.ansLoading ? '回答中' : '回答' }}</span> <span>{{ item.ansLoading ? '回答中' : '回答' }}</span>
...@@ -92,7 +88,25 @@ const props = defineProps({ ...@@ -92,7 +88,25 @@ const props = defineProps({
} }
}) })
const emits = defineEmits(['regenerate']) 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 () { function handleReGenerate () {
handleCollapse(true)
emits('regenerate', props.index) emits('regenerate', props.index)
} }
function handleCopyMD () { function handleCopyMD () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册