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

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) {
if (error instanceof z.ZodError) {
alertStore.showAlert({
type: "error",
message: error.errors[0].message,
level: "error",
content: error.errors[0].message,
});
} else {
console.error("表单提交错误:", error);
alertStore.showAlert({
type: "error",
message: "表单提交失败,请重试",
level: "error",
content: "表单提交失败,请重试",
});
}
}

View File

@@ -30,17 +30,6 @@ export const useKnowledgeQuery = () => {
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 { data } = await client.GET("/knowledge/segments", {
params: {
@@ -58,7 +47,6 @@ export const useKnowledgeQuery = () => {
docs,
fetchLibraryDocs,
doc,
fetchDocById,
segments,
fetchDocSegments,
};