Commit b358d39e authored by tyyin lan's avatar tyyin lan
parents 5242c5cb 4981f775
......@@ -206,6 +206,10 @@ function handleUploadAvatarOversize() {
}
async function handleAIGenerateAgentAvatar() {
if (generateAgentAvatarLoading.value || !personalAppConfig.value.baseInfo.agentTitle) {
return
}
generateAgentAvatarLoading.value = true
generateAgentAvatarController = new AbortController()
......@@ -223,6 +227,10 @@ async function handleAIGenerateAgentAvatar() {
}
async function handleAIGeneratePreamble() {
if (generatePreambleLoading.value) {
return
}
!commConfigExpandedNames.value.includes('preamble') && commConfigExpandedNames.value.push('preamble')
generatePreambleLoading.value = true
......@@ -252,6 +260,10 @@ async function handleAIGeneratePreamble() {
}
async function handleAIGenerateFeaturedQuestions() {
if (generateFeaturedQuestionsLoading.value) {
return
}
!commConfigExpandedNames.value.includes('featuredQuestions') &&
commConfigExpandedNames.value.push('featuredQuestions')
......@@ -278,6 +290,7 @@ async function handleSettingAgent(autoConfigInputValue: string) {
await handleCreateAgentTitleAndDesc(autoConfigInputValue)
.then(() => {
personalAppFormRef.value?.validate()
Promise.all([
handleAIGenerateAgentAvatar(),
handleAIGeneratePreamble(),
......@@ -443,7 +456,7 @@ function handleStopGenerate() {
<div
class="text-theme-color mt-3 flex h-[28px] items-center justify-between rounded-md border border-[#d4d6d9] px-2"
:class="
generateAgentAvatarLoading
generateAgentAvatarLoading || !personalAppConfig.baseInfo.agentTitle
? 'cursor-not-allowed opacity-50'
: 'cursor-pointer hover:border-[#d4e5ff] hover:bg-[#e6f0ff]'
"
......
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { ScrollbarInst } from 'naive-ui'
......@@ -23,7 +23,7 @@ const { t } = useI18n()
const router = useRouter()
const { paginationData, handlePageNoChange, handlePageSizeChange } = usePagination()
const { paginationData } = usePagination()
const currentKdId = ref(0)
const currentKnowledgeDocumentName = ref('')
......@@ -61,11 +61,6 @@ const emptyKnowledgeChunkListText = computed(() => {
return isSearchEmptyList.value ? t('common_module.search_empty_data') : t('common_module.empty_data')
})
watch([() => paginationData.pageNo, () => paginationData.pageSize], async () => {
await handleGetKnowledgeChunkList()
scrollBarRef.value?.scrollTo({ top: 0 })
})
onMounted(async () => {
if (!router.currentRoute.value.params.kdId) {
window.$message.warning(t('personal_space_module.knowledge_module.not_find_knowledge_document_message'))
......@@ -201,6 +196,19 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
chunkItem.isOpen = isOpen === 'Y' ? 'N' : 'Y'
}
}
async function handleGetKnowledgeChunkListUpdatePageNo(pageNo: number) {
paginationData.pageNo = pageNo
await handleGetKnowledgeChunkList()
scrollBarRef.value?.scrollTo({ top: 0 })
}
async function handleGetKnowledgeChunkListUpdatePageSize(pageSize: number) {
paginationData.pageNo = 1
paginationData.pageSize = pageSize
await handleGetKnowledgeChunkList()
scrollBarRef.value?.scrollTo({ top: 0 })
}
</script>
<template>
......@@ -247,7 +255,8 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
</div>
<n-spin :show="knowledgeChunkListLoading" class="w-full flex-1 overflow-hidden" content-class="flex w-full h-full">
<div v-if="knowledgeChunkList.length && !knowledgeChunkListLoading" class="flex flex-1">
<div v-if="knowledgeChunkList.length" class="flex flex-1">
<div v-show="!knowledgeChunkListLoading" class="flex flex-1">
<n-scrollbar ref="scrollBarRef" class="grid w-full flex-1 overflow-hidden">
<div class="grid gap-5">
<KnowledgeChuckItem
......@@ -264,6 +273,7 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
</div>
</n-scrollbar>
</div>
</div>
<div
v-show="!knowledgeChunkListLoading && knowledgeChunkList.length === 0"
......@@ -282,8 +292,8 @@ async function handleUpdateOpenKnowledgeChunk(chunkItem: KnowledgeChunkItem) {
<div class="mt-4 flex justify-end">
<CustomPagination
:paging-info="paginationData"
@update-page-no="handlePageNoChange"
@update-page-size="handlePageSizeChange"
@update-page-no="handleGetKnowledgeChunkListUpdatePageNo"
@update-page-size="handleGetKnowledgeChunkListUpdatePageSize"
/>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment