feat: restore learning feedback and knowledge capabilities
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
<div class="head-actions">
|
||||
<span class="status-pill" :class="apiPill.type">{{ apiPill.label }}</span>
|
||||
<span class="status-pill" :class="flowStatus.type">{{ flowStatus.label }}</span>
|
||||
<el-select v-model="uploadSpaceCodes" multiple collapse-tags placeholder="选择上传空间" style="width: 230px">
|
||||
<el-option v-for="space in manageableSpaces" :key="space.code" :label="space.name" :value="space.code" />
|
||||
</el-select>
|
||||
<el-upload
|
||||
accept=".txt,.md,.markdown,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx"
|
||||
:auto-upload="false"
|
||||
@@ -183,6 +186,7 @@ import {
|
||||
type SopRecord,
|
||||
type SopSearchResponse
|
||||
} from '@/api/aihr/sop';
|
||||
import { listKnowledgeSpaces, type KnowledgeSpace } from '@/api/aihr/space';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -286,6 +290,8 @@ const pendingReviewStatus = ref('待复核');
|
||||
const pendingReviewLoading = ref(false);
|
||||
const reviewingFeedbackId = ref<number | null>(null);
|
||||
const pendingReviews = ref<AnswerFeedbackItem[]>([]);
|
||||
const manageableSpaces = ref<KnowledgeSpace[]>([]);
|
||||
const uploadSpaceCodes = ref<string[]>([]);
|
||||
|
||||
const activeSeed = computed(() => sopSeeds[selectedCategory.value]);
|
||||
const answerText = computed(() => apiResult.value?.answer ?? activeSeed.value.answer);
|
||||
@@ -364,6 +370,7 @@ async function runSearch() {
|
||||
const { data } = await searchKnowledgeSop({
|
||||
queryText: queryText.value,
|
||||
category: selectedCategory.value,
|
||||
spaceCodes: uploadSpaceCodes.value,
|
||||
limit: 3
|
||||
});
|
||||
apiResult.value = data;
|
||||
@@ -437,12 +444,16 @@ async function handleDocSelected(uploadFile: UploadFile) {
|
||||
ElMessage.warning('文件不能超过 100MB');
|
||||
return;
|
||||
}
|
||||
if (uploadSpaceCodes.value.length === 0) {
|
||||
ElMessage.warning('请先选择至少一个可管理的知识空间');
|
||||
return;
|
||||
}
|
||||
|
||||
uploading.value = true;
|
||||
try {
|
||||
const form = new FormData();
|
||||
form.append('file', raw);
|
||||
form.append('category', selectedCategory.value);
|
||||
uploadSpaceCodes.value.forEach((code) => form.append('spaceCodes', code));
|
||||
const { data } = await uploadKnowledgeDoc(form);
|
||||
uploadedRecords.value.unshift({
|
||||
title: data.fileName,
|
||||
@@ -469,8 +480,14 @@ async function generateTraining() {
|
||||
ElMessage.success('已基于引用片段生成训练题');
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
loadPendingReviews();
|
||||
try {
|
||||
manageableSpaces.value = ((await listKnowledgeSpaces()).data || []).filter((item) => item.status === 'ACTIVE');
|
||||
uploadSpaceCodes.value = manageableSpaces.value.slice(0, 1).map((item) => item.code);
|
||||
} catch {
|
||||
manageableSpaces.value = [];
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user