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]} />
@@ -807,7 +806,7 @@ function EditDialogBody({
<div className="mb-4 text-xs text-muted-foreground">
{selectedHandoffModeLabel}
{handoffMode ===
String(AIAgentHandoffMode.DefaultTeamPool)
String(AIAgentHandoffMode.DefaultTeamPool)
? "。该模式要求至少配置一个客服组。"
: "。仅在涉及转人工时生效。"}
</div>
@@ -872,19 +871,19 @@ function EditDialogBody({
</FieldContent>
</Field>
<Field data-invalid={!!errors.fallbackMessage}>
<FieldLabel htmlFor="ai-agent-fallback-message">
</FieldLabel>
<FieldContent>
<div className="text-xs text-muted-foreground mb-1">
使 AI Graph Tool
</div>
<Textarea
id="ai-agent-fallback-message"
rows={5}
{...register("fallbackMessage")}
/>
<Field data-invalid={!!errors.fallbackMessage}>
<FieldLabel htmlFor="ai-agent-fallback-message">
</FieldLabel>
<FieldContent>
<div className="text-xs text-muted-foreground mb-1">
使 AI Graph Tool
</div>
<Textarea
id="ai-agent-fallback-message"
rows={5}
{...register("fallbackMessage")}
/>
<FieldError errors={[errors.fallbackMessage]} />
</FieldContent>
</Field>
@@ -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>