优化表单提交错误处理逻辑,调整错误提示的属性名称;移除未使用的文档获取函数,简化知识查询逻辑。

This commit is contained in:
ccmjga
2025-06-28 22:51:52 +08:00
parent a767613b58
commit e646bdffa8
2 changed files with 4 additions and 16 deletions

View File

@@ -78,14 +78,14 @@ const handleSubmit = async () => {
} catch (error) { } catch (error) {
if (error instanceof z.ZodError) { if (error instanceof z.ZodError) {
alertStore.showAlert({ alertStore.showAlert({
type: "error", level: "error",
message: error.errors[0].message, content: error.errors[0].message,
}); });
} else { } else {
console.error("表单提交错误:", error); console.error("表单提交错误:", error);
alertStore.showAlert({ alertStore.showAlert({
type: "error", level: "error",
message: "表单提交失败,请重试", content: "表单提交失败,请重试",
}); });
} }
} }

View File

@@ -30,17 +30,6 @@ export const useKnowledgeQuery = () => {
docs.value = data || []; docs.value = data || [];
}; };
const fetchDocById = async (docId: number) => {
const { data } = await client.GET("/knowledge/docs", {
params: {
query: {},
},
});
if (data && Array.isArray(data)) {
doc.value = data.find((item) => item.id === docId) || null;
}
};
const fetchDocSegments = async (params: SegmentQueryParams) => { const fetchDocSegments = async (params: SegmentQueryParams) => {
const { data } = await client.GET("/knowledge/segments", { const { data } = await client.GET("/knowledge/segments", {
params: { params: {
@@ -58,7 +47,6 @@ export const useKnowledgeQuery = () => {
docs, docs,
fetchLibraryDocs, fetchLibraryDocs,
doc, doc,
fetchDocById,
segments, segments,
fetchDocSegments, fetchDocSegments,
}; };