Commit 27112b70 authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

Beta

See merge request !201
parents ae7c34a4 01e68560
......@@ -91,8 +91,11 @@ export function fetchGetKnowledgeListByKdIds<T>(kdIds: number[]) {
* @query search 搜索值
* @returns 获取知识库文档列表
*/
export function fetchGetKnowledgeDocumentList<T>(knowledgeInfoId: number, search: string) {
return request.post<T>(`/knowledgeRest/searchDocuments.json?knowledgeInfoId=${knowledgeInfoId}&search=${search}`)
export function fetchGetKnowledgeDocumentList<T>(knowledgeInfoId: number, search: string, payload: object) {
return request.post<T>(
`/knowledgeRest/searchDocuments.json?knowledgeInfoId=${knowledgeInfoId}&search=${search}`,
payload,
)
}
/**
......
......@@ -581,7 +581,7 @@ personal_space_module:
segment_maximum_number_of_words_tip: 'The segmented word count should match the context length range of the model in the application. The longer the word count, the richer the context of the recall, the fewer the word count, the more concise the recall information, and the maximum word count cannot exceed 1000 words'
please_input_segment_word_number: 'Please input segment word number'
segment_overlap_word_proportion: 'Segment overlap word proportion'
segment_overlap_word_proportion_tip: 'The ratio of the "number of overlapping characters" between the current slice and the previous slice to the set "Maximum length of slice". If there are incomplete sentences in the overlapping part, this slice deletes the sentence, the larger the proportion, the more overlapping characters in the adjacent slice, the smaller the proportion, the fewer overlapping characters, and the maximum bit 25'
segment_overlap_word_proportion_tip: 'The ratio of the "segment maximum number of words" between the current slice and the previous slice to the set "Maximum length of slice". If there are incomplete sentences in the overlapping part, this slice deletes the sentence, the larger the proportion, the more overlapping characters in the adjacent slice, the smaller the proportion, the fewer overlapping characters, and the maximum is 25'
please_input_segment_overlap_word_proportion: 'Please input segment overlap word proportion'
data_process_tip_message: 'Click confirm does not affect the data processing, after processing can be referenced'
upload_QA_limit_tip_message: 'Support XLSX\XLS, up to 5 files can be uploaded, each file does not exceed 10MB'
......
......@@ -579,7 +579,7 @@ personal_space_module:
segment_maximum_number_of_words_tip: '分段字数应匹配应用中的模型上下文长度范围,字数越长,召回的上下文越丰富,字数越少,召回的信息更精简,最多字数不能超过1000字'
please_input_segment_word_number: '请输入分段字数'
segment_overlap_word_proportion: '分段重叠字数占比'
segment_overlap_word_proportion_tip: '当前切片与前后切片的“重叠部分字符数”相较于设置的“切片最大长度”的比例,如果重叠部分存在不完整的句子,则此切片舍去该句,占比越大,相邻切片重叠字符越多,占比越少,重叠字符越少,最大值位25'
segment_overlap_word_proportion_tip: '当前切片与前后切片的“重叠部分字符数”相较于设置的“分段最多字数”的比例,如果重叠部分存在不完整的句子,则此切片舍去该句,占比越大,相邻切片重叠字符越多,占比越少,重叠字符越少,最大值为25'
please_input_segment_overlap_word_proportion: '请输入分段重叠字数占比'
data_process_tip_message: '点击确认不影响数据处理,处理完毕后可进行引用'
upload_QA_limit_tip_message: '支持XLSX\XLS,最多可上传5个文件,每个文件不超过10MB'
......
......@@ -579,7 +579,7 @@ personal_space_module:
segment_maximum_number_of_words_tip: '分段字數應匹配應用中的模型上下文長度範圍,字數越長,召回的上下文越豐富,字數越少,召回的信息更精簡,最多字數不能超過1000字'
please_input_segment_word_number: '請輸入分段字數'
segment_overlap_word_proportion: '分段重疊字數佔比'
segment_overlap_word_proportion_tip: '當前切片與前後切片的“重疊部分字符數”相較於設置的“切片最大長度”的比例,如果重疊部分存在不完整的句子,則此切片捨去該句,佔比越大,相鄰切片重疊字符越多,佔比越少,重疊字符越少,最大值位25'
segment_overlap_word_proportion_tip: '當前切片與前後切片的“重疊部分字符數”相較於設置的“分段最多字數”的比例,如果重疊部分存在不完整的句子,則此切片捨去該句,佔比越大,相鄰切片重疊字符越多,佔比越少,重疊字符越少,最大值為25'
please_input_segment_overlap_word_proportion: '請輸入分段重疊字數佔比'
data_process_tip_message: '點擊確認不影響數據處理,處理完畢後可進行引用'
upload_QA_limit_tip_message: '支持XLSX\XLS,最多可上傳5個文件,每個文件不超過10MB'
......
......@@ -15,8 +15,10 @@ import {
fetchUpdateKnowledgeInfo,
} from '@/apis/knowledge'
import useTableScrollY from '@/composables/useTableScrollY'
import CustomPagination from '@/components/custom-pagination/custom-pagination.vue'
import EditKnowledgeModal, { KnowledgeFormDataInterface } from './components/edit-knowledge-modal.vue'
import { useUserStore } from '@/store/modules/user'
import { usePagination } from '@/composables/usePagination'
const { t } = useI18n()
......@@ -24,10 +26,12 @@ const router = useRouter()
const userStore = useUserStore()
const { pageContentWrapRef, tableContentY } = useTableScrollY(48 + 48)
const { pageContentWrapRef, tableContentY } = useTableScrollY(48 + 48 + 24 + 28)
const knowledgeDocumentColumn = createKnowledgeDocumentColumn(handleClickKnowledgeDocumentTableAction)
const { paginationData, handlePageNoChange, handlePageSizeChange } = usePagination()
const knowledgeDocumentTableLoading = ref(false)
const knowledgeDocumentList = ref<KnowledgeDocumentItem[]>([])
const checkedKdIdList = ref<number[]>([])
......@@ -74,10 +78,13 @@ const { pause: pauseIntervalFn, resume: resumeIntervalFn } = useIntervalFn(
const res = await fetchGetKnowledgeDocumentList<KnowledgeDocumentItem[]>(
currentKnowledgeId.value,
searchDocumentInputValue.value,
{ pagingInfo: paginationData },
)
if (res.code === 0) {
knowledgeDocumentList.value = res.data
paginationData.totalRows = res.pagingInfo?.totalRows || 0
paginationData.totalPages = res.pagingInfo?.totalPages || 0
isSearchEmptyList.value = !!searchDocumentInputValue.value && res.data.length === 0
}
},
......@@ -85,6 +92,10 @@ const { pause: pauseIntervalFn, resume: resumeIntervalFn } = useIntervalFn(
{ immediateCallback: false, immediate: false },
)
watch([() => paginationData.pageNo, () => paginationData.pageSize], () => {
handleGetKnowledgeDocumentList()
})
onMounted(async () => {
if (!router.currentRoute.value.params.id) {
window.$message.warning(t('personal_space_module.knowledge_module.not_find_knowledge_message'))
......@@ -112,16 +123,24 @@ async function handleGetKnowledgeDocumentList() {
const res = await fetchGetKnowledgeDocumentList<KnowledgeDocumentItem[]>(
currentKnowledgeId.value,
searchDocumentInputValue.value,
{ pagingInfo: paginationData },
)
if (res.code === 0) {
knowledgeDocumentList.value = res.data
knowledgeDocumentTableLoading.value = false
checkedKdIdList.value = []
paginationData.totalRows = res.pagingInfo?.totalRows || 0
paginationData.totalPages = res.pagingInfo?.totalPages || 0
isSearchEmptyList.value = !!searchDocumentInputValue.value && res.data.length === 0
}
}
async function handleSearchKnowledgeDocumentList() {
paginationData.pageNo = 1
await handleGetKnowledgeDocumentList()
}
function handleClickKnowledgeDocumentTableAction(actionType: string, knowledgeDocumentItem: KnowledgeDocumentItem) {
switch (actionType) {
case 'view':
......@@ -150,6 +169,9 @@ async function handleDeleteKnowledgeDocument(kdId: number) {
if (res.code === 0) {
window.$message.success(t('common_module.delete_success_message'))
if (knowledgeDocumentList.value.length <= 1 && paginationData.pageNo === paginationData.totalPages) {
paginationData.pageNo = paginationData.pageNo - 1 || 1
}
await userStore.fetchUpdateEquityInfo()
await handleGetKnowledgeDocumentList()
}
......@@ -197,6 +219,12 @@ async function handleBatchDelDocument() {
if (res.code === 0) {
window.$message.success(t('common_module.delete_success_message'))
if (
knowledgeDocumentList.value.length <= checkedKdIdList.value.length &&
paginationData.pageNo === paginationData.totalPages
) {
paginationData.pageNo = paginationData.pageNo - 1 || 1
}
await userStore.fetchUpdateEquityInfo()
await handleGetKnowledgeDocumentList()
}
......@@ -238,7 +266,7 @@ function handleBackKnowledgeList() {
v-model:value="searchDocumentInputValue"
:placeholder="t('personal_space_module.knowledge_module.search_knowledge_document_placeholder')"
class="w-[214px]!"
@keyup.enter="handleGetKnowledgeDocumentList"
@keyup.enter="handleSearchKnowledgeDocumentList"
>
<template #suffix>
<Search
......@@ -246,7 +274,7 @@ function handleBackKnowledgeList() {
size="16"
fill="#999"
class="cursor-pointer"
@click="handleGetKnowledgeDocumentList"
@click="handleSearchKnowledgeDocumentList"
/>
</template>
</NInput>
......@@ -287,6 +315,14 @@ function handleBackKnowledgeList() {
</template>
</NDataTable>
</div>
<div class="mt-6 flex justify-end">
<CustomPagination
:paging-info="paginationData"
@update-page-no="handlePageNoChange"
@update-page-size="handlePageSizeChange"
/>
</div>
</div>
<EditKnowledgeModal
......
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