diff --git a/frontend/src/app/knowledge-bases/page.tsx b/frontend/src/app/knowledge-bases/page.tsx
index 2e88e992..9b346f48 100644
--- a/frontend/src/app/knowledge-bases/page.tsx
+++ b/frontend/src/app/knowledge-bases/page.tsx
@@ -58,6 +58,12 @@ const { Title, Text, Paragraph } = Typography;
type KnowledgeBaseFormValues = {
name: string;
description?: string;
+ note?: string;
+ source_type?: string;
+ authority?: string;
+ effective_date?: string;
+ region?: string;
+ tags?: string;
};
type KnowledgeBaseRollbackFormValues = {
@@ -843,9 +849,9 @@ export default function KnowledgeBasesPage() {
) : document.failure_reason ? (
{document.failure_reason}
) : null}
- {document.tags?.length > 0 && (
+ {(document.tags?.length ?? 0) > 0 && (
- {document.tags.slice(0, 5).map((tag) => {tag})}
+ {(document.tags ?? []).slice(0, 5).map((tag) => {tag})}
)}
@@ -1035,7 +1041,8 @@ export default function KnowledgeBasesPage() {
}
// Helper function for rendering status tags inline
-function renderStatusTag(value: string, metaMap: Record) {
- const meta = metaMap[value] ?? { color: "default", label: value || "未知" };
+function renderStatusTag(value: string | null | undefined, metaMap: Record) {
+ if (!value) return 未知;
+ const meta = metaMap[value] ?? { color: "default", label: value };
return {meta.label};
}
diff --git a/frontend/src/app/legal-articles/page.tsx b/frontend/src/app/legal-articles/page.tsx
index 11564957..d636efd0 100644
--- a/frontend/src/app/legal-articles/page.tsx
+++ b/frontend/src/app/legal-articles/page.tsx
@@ -92,8 +92,9 @@ function formatHash(value: string | null | undefined) {
return value ? `${value.slice(0, 12)}...` : "-";
}
-function renderStatusTag(value: string, metaMap: Record) {
- const meta = metaMap[value] ?? { color: "default", label: value || "未知" };
+function renderStatusTag(value: string | null | undefined, metaMap: Record) {
+ if (!value) return 未知;
+ const meta = metaMap[value] ?? { color: "default", label: value };
return {meta.label};
}
@@ -407,7 +408,7 @@ export default function LegalArticlesPage() {
description={item.content ? {item.content} : null}
/>
{item.source_id && (
- } size="small" onClick={() => void openArticleDetail(item.source_id)}>
+ } size="small" onClick={() => void openArticleDetail(item.source_id!)}>
查看
)}