提交 4ac0163e 编写于 作者: View Design's avatar View Design

update Library

上级 7ed5e4a4
......@@ -13,7 +13,7 @@
</div>
<div class="flex items-center text-sm gap-0.5" :class="textColor">
<UIcon name="i-heroicons-clock" />
<span>{{formatTime}}</span>
<span>{{ useTime(item.create_time) }}</span>
</div>
</div>
<div class="flex gap-4">
......@@ -50,8 +50,4 @@ const props = defineProps({
function handleOpenSelect (id) {
$openLibrarySelect(id)
}
const formatTime = computed(() => {
return useTime(props.item.create_time)
})
</script>
\ No newline at end of file
export default () => {
// 查询主题列表
const getThemeList = async () => {
const { data, error } = await useRequest('/v1/chat/completion/list', {
method: 'get'
})
const getThreadsList = async () => {
const { data, error } = await useRequest('/v1/chat/completion/list')
if (error.value) {
return []
}
return data.value.data || []
}
return {
getThemeList
getThreadsList
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
<div class="flex flex-col flex-grow">
<div class="flex flex-col gap-4">
<ILibraryThread
v-for="item in themes"
v-for="item in threads"
:item="item"
:key="item.c_id"
/>
......@@ -28,6 +28,7 @@
<ILibraryCollect
v-for="item in collection"
:item="item"
:key="item.id"
/>
</div>
</div>
......@@ -38,7 +39,7 @@
<script setup>
const { $openLibraryCreate } = useLibraryStore()
const { getCollection } = useCollectionRequest()
const { getThemeList } = useThemeRequest()
const { getThreadsList } = useLibraryRequest()
function handleOpenCreateLibrary () {
$openLibraryCreate()
......@@ -46,15 +47,13 @@ function handleOpenCreateLibrary () {
// 合集列表
const collection = ref([])
// 主题列表
const themes = ref([])
const threads = ref([])
async function getCollectionData () {
collection.value = await getCollection()
}
async function getThemeListData() {
themes.value = await getThemeList()
async function getThreadData() {
threads.value = await getThreadsList()
}
nextTick(() => {
getThemeListData()
getCollectionData()
})
getThreadData()
getCollectionData()
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册