refactor(edit): improve field labels and enhance fallback message handling

This commit is contained in:
mlogclub
2026-04-18 11:29:49 +08:00
parent f7eee62721
commit fe50149677
@@ -32,6 +32,12 @@ import {
} from "@/components/ui/popover"; } from "@/components/ui/popover";
import { Textarea } from "@/components/ui/textarea"; import { Textarea } from "@/components/ui/textarea";
import { import {
fetchAIAgent,
fetchAIConfigsAll,
fetchAgentTeamsAll,
fetchKnowledgeBasesAll,
fetchMCPCatalog,
fetchSkillDefinitionsAll,
type AIAgent, type AIAgent,
type AIConfig, type AIConfig,
type AdminAgentTeam, type AdminAgentTeam,
@@ -40,13 +46,8 @@ import {
type MCPToolCatalogItem, type MCPToolCatalogItem,
type MCPToolSourceType, type MCPToolSourceType,
type SkillDefinition, type SkillDefinition,
fetchAIAgent,
fetchAIConfigsAll,
fetchAgentTeamsAll,
fetchMCPCatalog,
fetchKnowledgeBasesAll,
fetchSkillDefinitionsAll,
} from "@/lib/api/admin"; } from "@/lib/api/admin";
import { getEnumOptions } from "@/lib/enums";
import { import {
AIAgentHandoffMode, AIAgentHandoffMode,
AIAgentHandoffModeLabels, AIAgentHandoffModeLabels,
@@ -55,8 +56,6 @@ import {
IMConversationServiceModeLabels, IMConversationServiceModeLabels,
Status, Status,
} from "@/lib/generated/enums"; } from "@/lib/generated/enums";
import { getEnumOptions } from "@/lib/enums";
import { FieldDescription } from "@base-ui/react";
type DirectToolItem = CreateAIAgentPayload["directTools"][number]; type DirectToolItem = CreateAIAgentPayload["directTools"][number];
@@ -731,7 +730,7 @@ function EditDialogBody({
</Field> </Field>
<Field data-invalid={!!errors.remark}> <Field data-invalid={!!errors.remark}>
<FieldLabel htmlFor="ai-agent-remark"></FieldLabel> <FieldLabel htmlFor="ai-agent-remark"></FieldLabel>
<FieldContent> <FieldContent>
<Textarea id="ai-agent-remark" rows={3} {...register("remark")} /> <Textarea id="ai-agent-remark" rows={3} {...register("remark")} />
<FieldError errors={[errors.remark]} /> <FieldError errors={[errors.remark]} />
@@ -1234,14 +1233,14 @@ function SectionCard({
children, children,
}: { }: {
title: string; title: string;
description: string; description?: string;
children: ReactNode; children: ReactNode;
}) { }) {
return ( return (
<section className="rounded-lg border bg-card p-5"> <section className="rounded-lg border bg-card p-5">
<div className="mb-3"> <div className="mb-3">
<div className="text-base font-semibold">{title}</div> <div className="text-base font-semibold">{title}</div>
<div className="mt-1 text-sm text-muted-foreground">{description}</div> {description && <div className="mt-1 text-sm text-muted-foreground">{description}</div>}
</div> </div>
<div className="space-y-4">{children}</div> <div className="space-y-4">{children}</div>
</section> </section>