update translation
This commit is contained in:
1 parent
02d0c1dcd6
commit
1689347494
9 files changed
+1170
-324
No files matched your search
@@ -9,6 +9,7 @@
|
||||
* - 对 Office 文档在可公网 HTTPS 访问时走 Office 在线预览,否则降级为打开/下载
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { marked } from 'marked';
|
||||
import * as XLSX from 'xlsx';
|
||||
import { useMessage } from '../composables/useMessage';
|
||||
@@ -44,6 +45,7 @@ const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: boolean): void;
|
||||
}>();
|
||||
const msg = useMessage();
|
||||
const { t } = useI18n();
|
||||
|
||||
const isLoading = ref(false);
|
||||
const error = ref('');
|
||||
@@ -146,7 +148,7 @@ const downloadFile = async () => {
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (err: any) {
|
||||
console.error('Download failed:', err);
|
||||
msg.error('下载失败: ' + (err.message || '未知错误'));
|
||||
msg.error(t('filePreview.msg.downloadFailed', { reason: err.message || t('filePreview.msg.unknownError') }));
|
||||
} finally {
|
||||
isDownloading.value = false;
|
||||
}
|
||||
@@ -419,7 +421,7 @@ watch(
|
||||
<div class="bg-white dark:bg-slate-900 rounded-2xl shadow-xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden border border-slate-200 dark:border-slate-700">
|
||||
<div class="px-6 py-4 border-b border-slate-200 dark:border-slate-700 flex items-start justify-between gap-4">
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm font-medium text-slate-500 dark:text-slate-400 tracking-wide">文件预览</div>
|
||||
<div class="text-sm font-medium text-slate-500 dark:text-slate-400 tracking-wide">{{ t('filePreview.title') }}</div>
|
||||
<div class="mt-1 font-semibold text-slate-900 dark:text-slate-100 break-words">{{ file.name }}</div>
|
||||
<button type="button" @click="downloadFile" :disabled="isDownloading" class="mt-2 inline-flex items-center justify-center px-3 py-1.5 text-xs font-medium rounded-lg bg-brand-50 text-brand-700 hover:bg-brand-100 border border-brand-200 dark:bg-brand-900/30 dark:text-brand-300 dark:border-brand-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed">
|
||||
<svg v-if="!isDownloading" xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
@@ -429,20 +431,20 @@ watch(
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
||||
{{ isDownloading ? '下载中...' : '下载文件' }}
|
||||
{{ isDownloading ? t('filePreview.downloading') : t('filePreview.download') }}
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" @click="close" class="shrink-0 whitespace-nowrap inline-flex items-center justify-center px-4 py-2 rounded-xl border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 bg-white/80 dark:bg-slate-900/80 hover:bg-slate-100 dark:hover:bg-slate-800">关闭</button>
|
||||
<button type="button" @click="close" class="shrink-0 whitespace-nowrap inline-flex items-center justify-center px-4 py-2 rounded-xl border border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-300 bg-white/80 dark:bg-slate-900/80 hover:bg-slate-100 dark:hover:bg-slate-800">{{ t('common.close') }}</button>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 overflow-auto p-4 bg-slate-50 dark:bg-slate-950">
|
||||
<div v-if="isLoading" class="text-sm text-slate-500 dark:text-slate-400">加载中...</div>
|
||||
<div v-if="isLoading" class="text-sm text-slate-500 dark:text-slate-400">{{ t('common.loading') }}</div>
|
||||
<div v-else-if="error" class="text-sm text-red-600 bg-red-50 border border-red-200 rounded-lg p-3">
|
||||
<template v-if="previewTooLarge">
|
||||
文件较大,暂不支持在线预览,请直接点击上方“下载文件”获取原文件。
|
||||
{{ t('filePreview.tooLarge') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
预览失败:{{ error }}
|
||||
{{ t('filePreview.previewFailed') }}{{ error }}
|
||||
</template>
|
||||
</div>
|
||||
<div
|
||||
@@ -532,7 +534,7 @@ watch(
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
||||
{{ isDownloading ? '下载中...' : '下载文件' }}
|
||||
{{ isDownloading ? t('filePreview.downloading') : t('filePreview.download') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { MessageSquareText, X } from 'lucide-vue-next';
|
||||
|
||||
interface Props {
|
||||
@@ -20,11 +21,23 @@ const emit = defineEmits<{
|
||||
(e: 'submitted'): void;
|
||||
}>();
|
||||
|
||||
const typeOptions = ['功能建议', '问题反馈', '体验优化'];
|
||||
const moduleOptions = ['知识库', '通用', '工作流', '账号权限'];
|
||||
const { t } = useI18n();
|
||||
|
||||
const selectedType = ref<string>('功能建议');
|
||||
const selectedModule = ref<string>('知识库');
|
||||
const typeOptions = computed(() => [
|
||||
t('feedback.type.featureSuggestion'),
|
||||
t('feedback.type.issueReport'),
|
||||
t('feedback.type.experienceOptimization'),
|
||||
]);
|
||||
|
||||
const moduleOptions = computed(() => [
|
||||
t('feedback.module.knowledgeBase'),
|
||||
t('feedback.module.general'),
|
||||
t('feedback.module.workflow'),
|
||||
t('feedback.module.accountPermission'),
|
||||
]);
|
||||
|
||||
const selectedType = ref<string>(t('feedback.type.featureSuggestion'));
|
||||
const selectedModule = ref<string>(t('feedback.module.knowledgeBase'));
|
||||
const content = ref('');
|
||||
const submitting = ref(false);
|
||||
const error = ref('');
|
||||
@@ -36,8 +49,8 @@ const closeDialog = () => {
|
||||
};
|
||||
|
||||
const resetForm = () => {
|
||||
selectedType.value = '功能建议';
|
||||
selectedModule.value = '知识库';
|
||||
selectedType.value = t('feedback.type.featureSuggestion');
|
||||
selectedModule.value = t('feedback.module.knowledgeBase');
|
||||
content.value = '';
|
||||
error.value = '';
|
||||
submitting.value = false;
|
||||
@@ -46,20 +59,19 @@ const resetForm = () => {
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
resetForm();
|
||||
}
|
||||
if (visible) resetForm();
|
||||
},
|
||||
);
|
||||
|
||||
const submitFeedback = async () => {
|
||||
if (!canSubmit.value) {
|
||||
error.value = '请填写反馈内容';
|
||||
error.value = t('feedback.msg.fillContent');
|
||||
return;
|
||||
}
|
||||
|
||||
submitting.value = true;
|
||||
error.value = '';
|
||||
|
||||
try {
|
||||
const payload: Record<string, unknown> = {
|
||||
feedback_type: selectedType.value,
|
||||
@@ -67,6 +79,7 @@ const submitFeedback = async () => {
|
||||
content: content.value.trim(),
|
||||
source_page: props.sourcePage,
|
||||
};
|
||||
|
||||
if (props.chatLogId !== null && props.chatLogId !== undefined) {
|
||||
payload.chat_log_id = props.chatLogId;
|
||||
}
|
||||
@@ -82,14 +95,14 @@ const submitFeedback = async () => {
|
||||
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
error.value = data?.error || '提交失败,请稍后重试';
|
||||
error.value = data?.error || t('feedback.msg.submitFailed');
|
||||
return;
|
||||
}
|
||||
|
||||
emit('submitted');
|
||||
closeDialog();
|
||||
} catch {
|
||||
error.value = '提交失败,请稍后重试';
|
||||
error.value = t('feedback.msg.submitFailed');
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
@@ -103,7 +116,7 @@ const submitFeedback = async () => {
|
||||
>
|
||||
<div class="flex max-h-[92vh] w-full max-w-2xl flex-col rounded-2xl bg-white shadow-2xl">
|
||||
<div class="flex items-center justify-between border-b border-gray-100 px-5 pb-4 pt-5 sm:px-8 sm:pb-4 sm:pt-7">
|
||||
<h3 class="text-2xl font-bold text-gray-900">意见反馈</h3>
|
||||
<h3 class="text-2xl font-bold text-gray-900">{{ t('feedback.title') }}</h3>
|
||||
<button
|
||||
@click="closeDialog"
|
||||
class="rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600"
|
||||
@@ -115,7 +128,7 @@ const submitFeedback = async () => {
|
||||
|
||||
<div class="space-y-5 overflow-y-auto px-5 py-5 sm:px-8">
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-sm font-semibold text-gray-600">反馈类型</label>
|
||||
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.type') }}</label>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
<button
|
||||
v-for="item in typeOptions"
|
||||
@@ -134,7 +147,7 @@ const submitFeedback = async () => {
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-sm font-semibold text-gray-600">反馈模块</label>
|
||||
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.module') }}</label>
|
||||
<select
|
||||
v-model="selectedModule"
|
||||
class="w-full rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
|
||||
@@ -144,13 +157,13 @@ const submitFeedback = async () => {
|
||||
</div>
|
||||
|
||||
<div class="space-y-1.5">
|
||||
<label class="block text-sm font-semibold text-gray-600">反馈内容<span class="ml-0.5 text-red-500">*</span></label>
|
||||
<label class="block text-sm font-semibold text-gray-600">{{ t('feedback.labels.content') }}<span class="ml-0.5 text-red-500">*</span></label>
|
||||
<textarea
|
||||
v-model="content"
|
||||
rows="5"
|
||||
maxlength="2000"
|
||||
class="w-full resize-none rounded-xl border-gray-200 bg-gray-50 px-4 py-3 text-base shadow-sm outline-none transition-all focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-500/20"
|
||||
placeholder="请描述你的问题或建议,帮助我们持续优化。"
|
||||
:placeholder="t('feedback.placeholder.content')"
|
||||
/>
|
||||
<div class="mt-2 flex items-center justify-between">
|
||||
<div v-if="error" class="text-base text-red-600">{{ error }}</div>
|
||||
@@ -166,7 +179,7 @@ const submitFeedback = async () => {
|
||||
class="rounded-xl px-5 py-2.5 text-base font-medium text-gray-600 transition-colors hover:bg-gray-100"
|
||||
:disabled="submitting"
|
||||
>
|
||||
取消
|
||||
{{ t('feedback.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
@click="submitFeedback"
|
||||
@@ -174,7 +187,7 @@ const submitFeedback = async () => {
|
||||
:disabled="!canSubmit"
|
||||
>
|
||||
<MessageSquareText class="h-5 w-5" />
|
||||
{{ submitting ? '提交中' : '提交' }}
|
||||
{{ submitting ? t('feedback.submitting') : t('feedback.submit') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { listWorkspaceScheduleRuns, workspaceRunExcelUrl, type ScheduleRun } from '../api/schedule';
|
||||
|
||||
const { t } = useI18n();
|
||||
const isLoading = ref(false);
|
||||
const error = ref('');
|
||||
const runs = ref<ScheduleRun[]>([]);
|
||||
@@ -12,7 +14,7 @@ const loadRuns = async () => {
|
||||
try {
|
||||
runs.value = await listWorkspaceScheduleRuns();
|
||||
} catch (e: any) {
|
||||
error.value = e?.message || '加载排程记录失败';
|
||||
error.value = e?.message || t('scheduleRuns.msg.loadFailed');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
@@ -26,27 +28,27 @@ onMounted(() => {
|
||||
<template>
|
||||
<div class="mt-6 rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-slate-900">排程记录</h3>
|
||||
<h3 class="text-lg font-semibold text-slate-900">{{ t('scheduleRuns.title') }}</h3>
|
||||
<button class="rounded-lg border border-slate-300 px-3 py-1.5 text-sm text-slate-700 hover:bg-slate-50" @click="loadRuns">
|
||||
刷新
|
||||
{{ t('scheduleRuns.refresh') }}
|
||||
</button>
|
||||
</div>
|
||||
<p class="mb-3 text-xs text-slate-500">仅展示你是 owner 或在通知名单中的记录</p>
|
||||
<div v-if="isLoading" class="py-6 text-sm text-slate-500">加载中...</div>
|
||||
<p class="mb-3 text-xs text-slate-500">{{ t('scheduleRuns.tip') }}</p>
|
||||
<div v-if="isLoading" class="py-6 text-sm text-slate-500">{{ t('scheduleRuns.loading') }}</div>
|
||||
<div v-else-if="error" class="py-6 text-sm text-rose-500">{{ error }}</div>
|
||||
<div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400">暂无可见记录</div>
|
||||
<div v-else-if="runs.length === 0" class="py-6 text-sm text-slate-400">{{ t('scheduleRuns.empty') }}</div>
|
||||
<div v-else class="overflow-x-auto">
|
||||
<table class="w-full min-w-[920px] text-sm">
|
||||
<thead>
|
||||
<tr class="border-b border-slate-200 text-left text-slate-500">
|
||||
<th class="px-2 py-2">执行单号</th>
|
||||
<th class="px-2 py-2">排程</th>
|
||||
<th class="px-2 py-2">开始</th>
|
||||
<th class="px-2 py-2">结束</th>
|
||||
<th class="px-2 py-2">状态</th>
|
||||
<th class="px-2 py-2">处理</th>
|
||||
<th class="px-2 py-2">成功</th>
|
||||
<th class="px-2 py-2">失败</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.runNo') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.schedule') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.start') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.end') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.status') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.total') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.success') }}</th>
|
||||
<th class="px-2 py-2">{{ t('scheduleRuns.columns.failed') }}</th>
|
||||
<th class="px-2 py-2">Excel</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -61,7 +63,7 @@ onMounted(() => {
|
||||
<td class="px-2 py-2">{{ run.success_count }}</td>
|
||||
<td class="px-2 py-2">{{ run.failed_count }}</td>
|
||||
<td class="px-2 py-2">
|
||||
<a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">查看Excel</a>
|
||||
<a class="text-brand-600 hover:underline" :href="workspaceRunExcelUrl(run.id)" target="_blank">{{ t('scheduleRuns.viewExcel') }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getKbDifyHealth, type KbDifyHealth } from '../../api/kb';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
error: [message: string];
|
||||
}>();
|
||||
const props = defineProps<{ open: boolean }>();
|
||||
const emit = defineEmits<{ close: []; error: [message: string] }>();
|
||||
const { t } = useI18n();
|
||||
|
||||
const loading = ref(false);
|
||||
const payload = ref<KbDifyHealth | null>(null);
|
||||
@@ -20,94 +16,61 @@ const loadHealth = async () => {
|
||||
loading.value = true;
|
||||
payload.value = await getKbDifyHealth();
|
||||
loading.value = false;
|
||||
if (!payload.value) {
|
||||
emit('error', '加载 Dify 健康状态失败');
|
||||
}
|
||||
if (!payload.value) emit('error', t('kbDifyHealth.msg.loadFailed'));
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
(open) => {
|
||||
if (open) {
|
||||
void loadHealth();
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(() => props.open, (open) => {
|
||||
if (open) void loadHealth();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm"
|
||||
@click="close"
|
||||
>
|
||||
<div v-if="open" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm" @click="close">
|
||||
<div class="w-full max-w-4xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">Dify 健康检查</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">
|
||||
查看知识库模块当前的 Dify 连接情况和本地同步概况。
|
||||
</p>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ t('kbDifyHealth.title') }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.subtitle') }}</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="loadHealth">
|
||||
刷新
|
||||
{{ t('common.refresh') }}
|
||||
</button>
|
||||
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close">
|
||||
关闭
|
||||
{{ t('common.close') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">正在检测...</div>
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">{{ t('kbDifyHealth.loading') }}</div>
|
||||
<div v-else-if="payload" class="mt-6 grid gap-4 md:grid-cols-2 xl:grid-cols-3">
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">Dify API</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">
|
||||
{{ payload.api.reachable ? '可访问' : '不可访问' }}
|
||||
</div>
|
||||
<div class="mt-2 break-all text-xs text-slate-500 dark:text-slate-400">
|
||||
{{ payload.dify_base_url || '未配置' }}
|
||||
</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.api.reachable ? t('kbDifyHealth.reachable') : t('kbDifyHealth.unreachable') }}</div>
|
||||
<div class="mt-2 break-all text-xs text-slate-500 dark:text-slate-400">{{ payload.dify_base_url || t('kbDifyHealth.notConfigured') }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">Dataset 数量</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">
|
||||
{{ payload.api.dataset_count ?? '--' }}
|
||||
</div>
|
||||
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">
|
||||
配置完成:{{ payload.dify_api_configured ? '是' : '否' }}
|
||||
</div>
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.datasetCount') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.api.dataset_count ?? '--' }}</div>
|
||||
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.configured') }}{{ payload.dify_api_configured ? t('common.yes') : t('common.no') }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">已绑定分组</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">
|
||||
{{ payload.local_sync_health.dataset_bound_groups }}
|
||||
</div>
|
||||
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">
|
||||
本地同步记录:{{ payload.local_sync_health.sync_records }}
|
||||
</div>
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.boundGroups') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.dataset_bound_groups }}</div>
|
||||
<div class="mt-2 text-xs text-slate-500 dark:text-slate-400">{{ t('kbDifyHealth.localSyncRecords') }}{{ payload.local_sync_health.sync_records }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">同步中版本</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">
|
||||
{{ payload.local_sync_health.syncing_versions }}
|
||||
</div>
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.syncingVersions') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.syncing_versions }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">已同步版本</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">
|
||||
{{ payload.local_sync_health.synced_versions }}
|
||||
</div>
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.syncedVersions') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.synced_versions }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl border border-slate-200 px-4 py-4 dark:border-slate-700">
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">待同步任务</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">
|
||||
{{ payload.local_sync_health.pending_sync_jobs }}
|
||||
</div>
|
||||
<div class="mt-2 text-xs text-rose-500" v-if="payload.api.error">
|
||||
{{ payload.api.error }}
|
||||
</div>
|
||||
<div class="text-xs font-semibold uppercase tracking-[0.18em] text-slate-400">{{ t('kbDifyHealth.pendingSyncJobs') }}</div>
|
||||
<div class="mt-3 text-2xl font-semibold text-slate-900 dark:text-slate-100">{{ payload.local_sync_health.pending_sync_jobs }}</div>
|
||||
<div class="mt-2 text-xs text-rose-500" v-if="payload.api.error">{{ payload.api.error }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { getKbDifySettings, updateKbDifySettings } from '../../api/kb';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
saved: [message: string];
|
||||
error: [message: string];
|
||||
}>();
|
||||
const props = defineProps<{ open: boolean }>();
|
||||
const emit = defineEmits<{ close: []; saved: [message: string]; error: [message: string] }>();
|
||||
const { t } = useI18n();
|
||||
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
@@ -30,7 +25,7 @@ const loadSettings = async () => {
|
||||
const settings = await getKbDifySettings();
|
||||
loading.value = false;
|
||||
if (!settings) {
|
||||
emit('error', '加载 Dify 设置失败');
|
||||
emit('error', t('kbDifySettings.msg.loadFailed'));
|
||||
return;
|
||||
}
|
||||
Object.assign(form, settings);
|
||||
@@ -41,43 +36,32 @@ const save = async () => {
|
||||
const result = await updateKbDifySettings(form);
|
||||
saving.value = false;
|
||||
if (!result.ok) {
|
||||
emit('error', result.error || '保存 Dify 设置失败');
|
||||
emit('error', result.error || t('kbDifySettings.msg.saveFailed'));
|
||||
return;
|
||||
}
|
||||
emit('saved', 'Dify 设置已保存');
|
||||
emit('saved', t('kbDifySettings.msg.saved'));
|
||||
emit('close');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
(open) => {
|
||||
if (open) {
|
||||
void loadSettings();
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(() => props.open, (open) => {
|
||||
if (open) void loadSettings();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm"
|
||||
@click="close"
|
||||
>
|
||||
<div v-if="open" class="fixed inset-0 z-50 flex items-center justify-center bg-slate-950/35 px-4 py-8 backdrop-blur-sm" @click="close">
|
||||
<div class="w-full max-w-3xl rounded-3xl border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-900" @click.stop>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">Dify 设置</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">
|
||||
管理知识库模块使用的 Dify 连接和默认同步参数。
|
||||
</p>
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-slate-100">{{ t('kbDifySettings.title') }}</h3>
|
||||
<p class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ t('kbDifySettings.subtitle') }}</p>
|
||||
</div>
|
||||
<button class="rounded-2xl border border-slate-200 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800" @click="close">
|
||||
关闭
|
||||
{{ t('common.close') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">正在加载设置...</div>
|
||||
<div v-if="loading" class="py-16 text-center text-sm text-slate-400">{{ t('kbDifySettings.loading') }}</div>
|
||||
<div v-else class="mt-6 grid gap-4 md:grid-cols-2">
|
||||
<label class="space-y-2 md:col-span-2">
|
||||
<span class="text-sm font-medium text-slate-600 dark:text-slate-300">Dify Base URL</span>
|
||||
@@ -119,14 +103,10 @@ watch(
|
||||
|
||||
<div class="mt-6 flex justify-end gap-3">
|
||||
<button class="rounded-2xl border border-slate-200 px-4 py-2.5 text-sm font-medium text-slate-700 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800" @click="close">
|
||||
取消
|
||||
{{ t('common.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
class="rounded-2xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
:disabled="saving"
|
||||
@click="save"
|
||||
>
|
||||
{{ saving ? '保存中...' : '保存设置' }}
|
||||
<button class="rounded-2xl bg-brand-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-60" :disabled="saving" @click="save">
|
||||
{{ saving ? t('kbDifySettings.saving') : t('kbDifySettings.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Activity, FolderPlus, Pencil, Play, Settings, Trash2, Wrench, X } from 'lucide-vue-next';
|
||||
import DifyHealthDialog from './DifyHealthDialog.vue';
|
||||
import DifySettingsDialog from './DifySettingsDialog.vue';
|
||||
import DeleteConfirmDialog from '../DeleteConfirmDialog.vue';
|
||||
import {
|
||||
createKbGroup,
|
||||
deleteKbGroup,
|
||||
@@ -16,6 +18,7 @@ import {
|
||||
} from '../../api/kb';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
const groups = ref<KbGroup[]>([]);
|
||||
const jobs = ref<KbJob[]>([]);
|
||||
@@ -31,14 +34,16 @@ const feedbackType = ref<'success' | 'error' | ''>('');
|
||||
const runningJobId = ref<number | string | null>(null);
|
||||
const settingsDialogOpen = ref(false);
|
||||
const healthDialogOpen = ref(false);
|
||||
const deleteDialogOpen = ref(false);
|
||||
const deletingGroup = ref<KbGroup | null>(null);
|
||||
|
||||
const formTitle = computed(() => editingGroupId.value ? '编辑知识库分组' : '新建知识库分组');
|
||||
const formTitle = computed(() => editingGroupId.value ? t('kbAdmin.form.editTitle') : t('kbAdmin.form.createTitle'));
|
||||
const formDescription = computed(() => editingGroupId.value
|
||||
? '修改知识库分组名称和描述,保存后会立即刷新列表。'
|
||||
: '用于验证主平台里的知识库管理入口和基础接口壳。');
|
||||
? t('kbAdmin.form.editDesc')
|
||||
: t('kbAdmin.form.createDesc'));
|
||||
const submitText = computed(() => {
|
||||
if (isSubmitting.value) return editingGroupId.value ? '保存中...' : '提交中...';
|
||||
return editingGroupId.value ? '保存修改' : '创建分组';
|
||||
if (isSubmitting.value) return editingGroupId.value ? t('kbAdmin.form.saving') : t('kbAdmin.form.submitting');
|
||||
return editingGroupId.value ? t('kbAdmin.form.saveChanges') : t('kbAdmin.form.create');
|
||||
});
|
||||
|
||||
const loadData = async () => {
|
||||
@@ -47,13 +52,13 @@ const loadData = async () => {
|
||||
if (groupsResult.ok) {
|
||||
groups.value = groupsResult.data;
|
||||
} else {
|
||||
feedback.value = groupsResult.error || '加载知识库分组失败';
|
||||
feedback.value = groupsResult.error || t('kbAdmin.msg.loadGroupsFailed');
|
||||
feedbackType.value = 'error';
|
||||
}
|
||||
if (jobsResult.ok) {
|
||||
jobs.value = jobsResult.data;
|
||||
} else {
|
||||
feedback.value = jobsResult.error || '加载任务列表失败';
|
||||
feedback.value = jobsResult.error || t('kbAdmin.msg.loadJobsFailed');
|
||||
feedbackType.value = 'error';
|
||||
}
|
||||
isRefreshing.value = false;
|
||||
@@ -66,7 +71,7 @@ const resetForm = () => {
|
||||
|
||||
const handleCreateGroup = async () => {
|
||||
if (!form.value.name.trim()) {
|
||||
feedback.value = '请输入知识库分组名称';
|
||||
feedback.value = t('kbAdmin.msg.nameRequired');
|
||||
feedbackType.value = 'error';
|
||||
return;
|
||||
}
|
||||
@@ -81,12 +86,12 @@ const handleCreateGroup = async () => {
|
||||
isSubmitting.value = false;
|
||||
|
||||
if (!result.ok) {
|
||||
feedback.value = result.error || '创建失败';
|
||||
feedback.value = result.error || t('kbAdmin.msg.createFailed');
|
||||
feedbackType.value = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
feedback.value = editingGroupId.value ? '知识库分组已更新' : '知识库分组创建成功';
|
||||
feedback.value = editingGroupId.value ? t('kbAdmin.msg.updated') : t('kbAdmin.msg.created');
|
||||
feedbackType.value = 'success';
|
||||
resetForm();
|
||||
await loadData();
|
||||
@@ -103,21 +108,26 @@ const handleEditGroup = (group: KbGroup) => {
|
||||
};
|
||||
|
||||
const handleDeleteGroup = async (group: KbGroup) => {
|
||||
const confirmed = window.confirm(`确认删除知识库分组「${group.name}」吗?`);
|
||||
if (!confirmed) return;
|
||||
deletingGroup.value = group;
|
||||
deleteDialogOpen.value = true;
|
||||
};
|
||||
|
||||
const result = await deleteKbGroup(group.id);
|
||||
const handleDeleteGroupConfirm = async () => {
|
||||
if (!deletingGroup.value) return;
|
||||
const result = await deleteKbGroup(deletingGroup.value.id);
|
||||
if (!result.ok) {
|
||||
feedback.value = result.error || '删除失败';
|
||||
feedback.value = result.error || t('kbAdmin.msg.deleteFailed');
|
||||
feedbackType.value = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
if (editingGroupId.value === group.id) {
|
||||
if (editingGroupId.value === deletingGroup.value.id) {
|
||||
resetForm();
|
||||
}
|
||||
feedback.value = '知识库分组已删除';
|
||||
feedback.value = t('kbAdmin.msg.deleted');
|
||||
feedbackType.value = 'success';
|
||||
deleteDialogOpen.value = false;
|
||||
deletingGroup.value = null;
|
||||
await loadData();
|
||||
};
|
||||
|
||||
@@ -127,12 +137,12 @@ const handleRunJob = async (job: KbJob) => {
|
||||
runningJobId.value = null;
|
||||
|
||||
if (!result.ok) {
|
||||
feedback.value = result.error || '任务执行失败';
|
||||
feedback.value = result.error || t('kbAdmin.msg.runFailed');
|
||||
feedbackType.value = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
feedback.value = result.run_result || '任务已执行';
|
||||
feedback.value = result.run_result || t('kbAdmin.msg.runDone');
|
||||
feedbackType.value = 'success';
|
||||
await loadData();
|
||||
};
|
||||
@@ -148,34 +158,34 @@ defineExpose({ loadData });
|
||||
<div class="animate-fade-in-up">
|
||||
<div class="flex flex-col gap-4 border-b border-gray-100 bg-white px-8 py-6 dark:border-slate-700 dark:bg-slate-900 lg:flex-row lg:items-start lg:justify-between">
|
||||
<div class="min-w-0 flex-1">
|
||||
<h2 class="text-xl font-bold text-gray-900 dark:text-slate-100">知识库管理</h2>
|
||||
<h2 class="text-xl font-bold text-gray-900 dark:text-slate-100">{{ t('kbAdmin.title') }}</h2>
|
||||
<p class="mt-1 text-sm text-gray-500 dark:text-slate-400">
|
||||
第一阶段先承接分组、任务和 Dify 管理入口,后续再接入清洗链路。
|
||||
{{ t('kbAdmin.subtitle') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex w-full shrink-0 flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:justify-end">
|
||||
<div
|
||||
class="inline-flex w-full items-stretch divide-x divide-slate-200 overflow-hidden rounded-xl border border-slate-200 bg-slate-50 dark:divide-slate-600 dark:border-slate-600 dark:bg-slate-800/80 sm:w-auto"
|
||||
role="toolbar"
|
||||
aria-label="知识库工具操作"
|
||||
:aria-label="t('kbAdmin.toolbar')"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
@click="settingsDialogOpen = true"
|
||||
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
|
||||
title="Dify 设置"
|
||||
:title="t('kbAdmin.difySettings')"
|
||||
>
|
||||
<Settings class="h-4 w-4 shrink-0" />
|
||||
<span class="whitespace-nowrap">Dify 设置</span>
|
||||
<span class="whitespace-nowrap">{{ t('kbAdmin.difySettings') }}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="healthDialogOpen = true"
|
||||
class="inline-flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-sm font-medium text-slate-700 transition-colors hover:bg-white dark:text-slate-200 dark:hover:bg-slate-700 sm:flex-none sm:px-4"
|
||||
title="健康检查"
|
||||
:title="t('kbAdmin.healthCheck')"
|
||||
>
|
||||
<Activity class="h-4 w-4 shrink-0" />
|
||||
<span class="whitespace-nowrap">健康检查</span>
|
||||
<span class="whitespace-nowrap">{{ t('kbAdmin.healthCheck') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
@@ -184,7 +194,7 @@ defineExpose({ loadData });
|
||||
class="inline-flex w-full items-center justify-center gap-2 rounded-xl bg-blue-600 px-5 py-2.5 text-sm font-medium text-white shadow-lg shadow-blue-200 transition-colors hover:bg-blue-700 sm:w-auto"
|
||||
>
|
||||
<Wrench class="h-4 w-4 shrink-0" />
|
||||
<span class="whitespace-nowrap">前往工作台</span>
|
||||
<span class="whitespace-nowrap">{{ t('kbAdmin.goWorkspace') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -203,16 +213,16 @@ defineExpose({ loadData });
|
||||
|
||||
<div class="space-y-4">
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组名称</label>
|
||||
<input v-model="form.name" class="input-field" placeholder="例如:财务制度库" />
|
||||
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">{{ t('kbAdmin.form.groupName') }}</label>
|
||||
<input v-model="form.name" class="input-field" :placeholder="t('kbAdmin.form.groupNamePlaceholder')" />
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">分组描述</label>
|
||||
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">{{ t('kbAdmin.form.groupDesc') }}</label>
|
||||
<textarea
|
||||
v-model="form.description"
|
||||
rows="4"
|
||||
class="input-field"
|
||||
placeholder="描述该知识库分组的业务范围或清洗目标"
|
||||
:placeholder="t('kbAdmin.form.groupDescPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center justify-end gap-2 border-t border-slate-100 pt-4 dark:border-slate-700">
|
||||
@@ -232,7 +242,7 @@ defineExpose({ loadData });
|
||||
class="inline-flex items-center gap-1.5 rounded-xl border border-slate-200 px-4 py-2 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
|
||||
>
|
||||
<X class="h-4 w-4 shrink-0" />
|
||||
取消编辑
|
||||
{{ t('kbAdmin.form.cancelEdit') }}
|
||||
</button>
|
||||
</div>
|
||||
<p
|
||||
@@ -248,11 +258,11 @@ defineExpose({ loadData });
|
||||
<div class="space-y-6">
|
||||
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">知识库分组概览</h3>
|
||||
<span class="text-xs text-slate-400">{{ isRefreshing ? '加载中...' : '/api/kb/groups' }}</span>
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('kbAdmin.groupsTitle') }}</h3>
|
||||
<span class="text-xs text-slate-400">{{ isRefreshing ? t('common.loading') : '/api/kb/groups' }}</span>
|
||||
</div>
|
||||
<div v-if="groups.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
|
||||
当前暂无分组,或知识库接口尚未联调完成。
|
||||
{{ t('kbAdmin.groupsEmpty') }}
|
||||
</div>
|
||||
<div v-else class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||
<div
|
||||
@@ -263,15 +273,15 @@ defineExpose({ loadData });
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ group.name }}</div>
|
||||
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ group.description || '暂无描述' }}</div>
|
||||
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ group.description || t('kbAdmin.noDescription') }}</div>
|
||||
</div>
|
||||
<div class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
|
||||
{{ group.document_count ?? 0 }} 文档
|
||||
{{ t('kbAdmin.documentCount', { count: group.document_count ?? 0 }) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 flex flex-wrap items-center justify-between gap-3">
|
||||
<div class="text-xs text-slate-400">
|
||||
更新时间:{{ group.updated_at || '--' }}
|
||||
{{ t('kbAdmin.updatedAt') }}{{ group.updated_at || '--' }}
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
@@ -279,14 +289,14 @@ defineExpose({ loadData });
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-slate-200 px-3 py-2 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
>
|
||||
<Pencil class="h-3.5 w-3.5" />
|
||||
编辑
|
||||
{{ t('common.edit') }}
|
||||
</button>
|
||||
<button
|
||||
@click="handleDeleteGroup(group)"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-rose-200 px-3 py-2 text-xs font-medium text-rose-600 transition-colors hover:bg-rose-50 dark:border-rose-500/30 dark:text-rose-400 dark:hover:bg-rose-500/10"
|
||||
>
|
||||
<Trash2 class="h-3.5 w-3.5" />
|
||||
删除
|
||||
{{ t('common.delete') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -296,11 +306,11 @@ defineExpose({ loadData });
|
||||
|
||||
<section class="rounded-2xl border border-slate-200 p-6 dark:border-slate-700">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">任务队列占位</h3>
|
||||
<h3 class="text-lg font-semibold text-slate-900 dark:text-slate-100">{{ t('kbAdmin.jobsTitle') }}</h3>
|
||||
<span class="text-xs text-slate-400">/api/kb/jobs</span>
|
||||
</div>
|
||||
<div v-if="jobs.length === 0" class="rounded-2xl border border-dashed border-slate-200 px-4 py-10 text-center text-sm text-slate-400 dark:border-slate-700">
|
||||
暂无任务。第二阶段会在这里接入清洗、同步和重试任务。
|
||||
{{ t('kbAdmin.jobsEmpty') }}
|
||||
</div>
|
||||
<div v-else class="space-y-3">
|
||||
<div
|
||||
@@ -313,10 +323,10 @@ defineExpose({ loadData });
|
||||
<div class="font-semibold text-slate-900 dark:text-slate-100">{{ job.job_type }}</div>
|
||||
<div class="mt-1 text-sm text-slate-500 dark:text-slate-400">{{ job.created_at || '--' }}</div>
|
||||
<div class="mt-2 text-sm text-slate-500 dark:text-slate-400">
|
||||
{{ job.message || '暂无任务说明' }}
|
||||
{{ job.message || t('kbAdmin.noJobMessage') }}
|
||||
</div>
|
||||
<div class="mt-2 text-xs text-slate-400">
|
||||
文档:{{ job.document_id ?? '--' }} · 版本:{{ job.document_version_id ?? '--' }} · 进度:{{ job.progress ?? 0 }}%
|
||||
{{ t('kbAdmin.jobMeta', { docId: job.document_id ?? '--', versionId: job.document_version_id ?? '--', progress: job.progress ?? 0 }) }}
|
||||
</div>
|
||||
</div>
|
||||
<span class="rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300">
|
||||
@@ -330,7 +340,7 @@ defineExpose({ loadData });
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-brand-200 px-3 py-2 text-xs font-medium text-brand-700 transition-colors hover:bg-brand-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-brand-500/30 dark:text-brand-300 dark:hover:bg-brand-500/10"
|
||||
>
|
||||
<Play class="h-3.5 w-3.5" />
|
||||
{{ runningJobId === job.id ? '执行中...' : '执行任务' }}
|
||||
{{ runningJobId === job.id ? t('kbAdmin.running') : t('kbAdmin.runJob') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -351,4 +361,11 @@ defineExpose({ loadData });
|
||||
@close="healthDialogOpen = false"
|
||||
@error="(message) => { feedback = message; feedbackType = 'error'; }"
|
||||
/>
|
||||
<DeleteConfirmDialog
|
||||
v-model="deleteDialogOpen"
|
||||
:title="t('kbAdmin.deleteDialog.title')"
|
||||
:message="t('kbAdmin.deleteDialog.message', { name: deletingGroup?.name || '' })"
|
||||
@confirm="handleDeleteGroupConfirm"
|
||||
@cancel="() => { deleteDialogOpen = false; deletingGroup = null; }"
|
||||
/>
|
||||
</template>
|
||||
Reference in new issue
Block a user