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";
import { Textarea } from "@/components/ui/textarea";
import {
fetchAIAgent,
fetchAIConfigsAll,
fetchAgentTeamsAll,
fetchKnowledgeBasesAll,
fetchMCPCatalog,
fetchSkillDefinitionsAll,
type AIAgent,
type AIConfig,
type AdminAgentTeam,
@@ -40,13 +46,8 @@ import {
type MCPToolCatalogItem,
type MCPToolSourceType,
type SkillDefinition,
fetchAIAgent,
fetchAIConfigsAll,
fetchAgentTeamsAll,
fetchMCPCatalog,
fetchKnowledgeBasesAll,
fetchSkillDefinitionsAll,
} from "@/lib/api/admin";
import { getEnumOptions } from "@/lib/enums";
import {
AIAgentHandoffMode,
AIAgentHandoffModeLabels,
@@ -55,8 +56,6 @@ import {
IMConversationServiceModeLabels,
Status,
} from "@/lib/generated/enums";
import { getEnumOptions } from "@/lib/enums";
import { FieldDescription } from "@base-ui/react";
type DirectToolItem = CreateAIAgentPayload["directTools"][number];
@@ -731,7 +730,7 @@ function EditDialogBody({
</Field>
<Field data-invalid={!!errors.remark}>
<FieldLabel htmlFor="ai-agent-remark"></FieldLabel>
<FieldLabel htmlFor="ai-agent-remark"></FieldLabel>
<FieldContent>
<Textarea id="ai-agent-remark" rows={3} {...register("remark")} />
<FieldError errors={[errors.remark]} />
@@ -1234,14 +1233,14 @@ function SectionCard({
children,
}: {
title: string;
description: string;
description?: string;
children: ReactNode;
}) {
return (
<section className="rounded-lg border bg-card p-5">
<div className="mb-3">
<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 className="space-y-4">{children}</div>
</section>