fix: report
This commit is contained in:
1 parent
07e83132c0
commit
4445ff68d4
46 files changed
+3904
-897
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/kb/components/KbAdminPanel.vue
|
||||
* 知识库配置面板(治理面:分组、Dify、任务队列)。
|
||||
* 知识库配置面板(治理面:分组、Dify)。
|
||||
* 依赖:kb.api、DifySettingsDialog、DifyHealthDialog、DeleteConfirmDialog、Vue I18n。
|
||||
* 逻辑:管理控制台加载知识库分组与任务队列;分组列表在主表格过滤排序,新增/编辑通过右侧抽屉提交。
|
||||
* 逻辑:管理控制台加载知识库分组;分组列表在主表格过滤排序,新增/编辑通过右侧抽屉提交。
|
||||
*/
|
||||
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
Wrench,
|
||||
} from 'lucide-vue-next';
|
||||
import KbGroupDrawer, { type KbGroupFormValue } from './KbGroupDrawer.vue';
|
||||
import KbJobQueuePanel from './KbJobQueuePanel.vue';
|
||||
import DifyHealthDialog from './DifyHealthDialog.vue';
|
||||
import DifySettingsDialog from './DifySettingsDialog.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
@@ -30,11 +29,8 @@ import {
|
||||
createKbGroup,
|
||||
deleteKbGroup,
|
||||
getKbGroupsSafe,
|
||||
getKbJobsSafe,
|
||||
runKbJob,
|
||||
updateKbGroup,
|
||||
type KbGroup,
|
||||
type KbJob,
|
||||
} from '../api/kb.api';
|
||||
import { formatDateTime } from '../utils/kb-display.utils';
|
||||
|
||||
@@ -45,7 +41,6 @@ const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
const groups = ref<KbGroup[]>([]);
|
||||
const jobs = ref<KbJob[]>([]);
|
||||
const isSubmitting = ref(false);
|
||||
const isDeleting = ref(false);
|
||||
const isRefreshing = ref(false);
|
||||
@@ -53,7 +48,6 @@ const editingGroupId = ref<number | null>(null);
|
||||
const form = ref<KbGroupFormValue>({ name: '', description: '' });
|
||||
const feedback = ref('');
|
||||
const feedbackType = ref<'success' | 'error' | ''>('');
|
||||
const runningJobId = ref<number | string | null>(null);
|
||||
const settingsDialogOpen = ref(false);
|
||||
const healthDialogOpen = ref(false);
|
||||
const deleteDialogOpen = ref(false);
|
||||
@@ -103,20 +97,15 @@ const pagedGroups = computed(() => {
|
||||
/** 格式化分组更新时间,避免管理台表格直接暴露后端 ISO 时间字符串。 */
|
||||
const formatGroupUpdatedAt = (value?: string | null) => formatDateTime(value);
|
||||
|
||||
/** 加载知识库治理页的分组与任务队列,供页面初始渲染和操作后刷新复用。 */
|
||||
/** 加载知识库治理页的分组数据,供页面初始渲染和操作后刷新复用。 */
|
||||
const loadData = async () => {
|
||||
isRefreshing.value = true;
|
||||
const [groupsResult, jobsResult] = await Promise.all([getKbGroupsSafe(), getKbJobsSafe()]);
|
||||
const groupsResult = await getKbGroupsSafe();
|
||||
if (groupsResult.ok) groups.value = groupsResult.data;
|
||||
else {
|
||||
feedback.value = groupsResult.error || t('kbAdmin.msg.loadGroupsFailed');
|
||||
feedbackType.value = 'error';
|
||||
}
|
||||
if (jobsResult.ok) jobs.value = jobsResult.data;
|
||||
else {
|
||||
feedback.value = jobsResult.error || t('kbAdmin.msg.loadJobsFailed');
|
||||
feedbackType.value = 'error';
|
||||
}
|
||||
isRefreshing.value = false;
|
||||
};
|
||||
|
||||
@@ -199,23 +188,6 @@ const handleDeleteGroupConfirm = async () => {
|
||||
await loadData();
|
||||
};
|
||||
|
||||
/** 手动执行可重试的知识库任务,并将后端执行结果反馈到页面提示区。 */
|
||||
const handleRunJob = async (job: KbJob) => {
|
||||
runningJobId.value = job.id;
|
||||
const result = await runKbJob(job.id);
|
||||
runningJobId.value = null;
|
||||
|
||||
if (!result.ok) {
|
||||
feedback.value = result.error || t('kbAdmin.msg.runFailed');
|
||||
feedbackType.value = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
feedback.value = result.run_result || t('kbAdmin.msg.runDone');
|
||||
feedbackType.value = 'success';
|
||||
await loadData();
|
||||
};
|
||||
|
||||
watch([searchKeyword, filterMode, sortMode, pageSize], () => {
|
||||
currentPage.value = 1;
|
||||
});
|
||||
@@ -362,11 +334,6 @@ defineExpose({ loadData });
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<KbJobQueuePanel
|
||||
:jobs="jobs"
|
||||
:running-job-id="runningJobId"
|
||||
@run-job="handleRunJob"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user