diff --git a/components/agents/AgentPresetCard.tsx b/components/agents/AgentPresetCard.tsx
index ecf288c69..d9f9685ad 100644
--- a/components/agents/AgentPresetCard.tsx
+++ b/components/agents/AgentPresetCard.tsx
@@ -40,10 +40,6 @@ export function AgentPresetCard({
day: "2-digit",
});
})();
- const categoryBadges = [
- preset.categoryPath?.productCategory,
- preset.categoryPath?.audienceTag,
- ].filter(Boolean) as string[];
return (
{preset.type === "video" ? "视频" : preset.type === "text" ? "生文" : "生图"}
- {preset.secondaryType ? (
-
- {preset.secondaryType}
-
- ) : null}
- {categoryBadges.map((item) => (
-
- {item}
-
- ))}
{preset.visibility === "private" && onEdit ? (
diff --git a/components/agents/AgentPresetDialog.tsx b/components/agents/AgentPresetDialog.tsx
index e93e03f39..c4f69559e 100644
--- a/components/agents/AgentPresetDialog.tsx
+++ b/components/agents/AgentPresetDialog.tsx
@@ -27,10 +27,11 @@ import { fetcher } from "@/lib/utils";
import { imageGenerationService } from "@/services/canvas";
import { agentService } from "@/services/agents";
import type {
+ AgentCreatePayload,
AgentPresetType,
- AgentCategoryTreeConfig,
AgentPreset,
AgentPresetSlot,
+ AgentUpdatePayload,
} from "@/types/agent";
type DialogSlotState = AgentPresetSlot & {
@@ -44,12 +45,6 @@ type DialogSlotState = AgentPresetSlot & {
interface AgentPresetDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
- categoryTreeConfig: AgentCategoryTreeConfig;
- secondaryTypeConfig: {
- image: string[];
- video: string[];
- text: string[];
- };
initialPreset?: AgentPreset | null;
onSaved?: (preset: AgentPreset) => void;
}
@@ -57,8 +52,6 @@ interface AgentPresetDialogProps {
export function AgentPresetDialog({
open,
onOpenChange,
- categoryTreeConfig,
- secondaryTypeConfig,
initialPreset,
onSaved,
}: AgentPresetDialogProps) {
@@ -74,19 +67,7 @@ export function AgentPresetDialog({
const [name, setName] = useState("");
const [type, setType] = useState<"image" | "video" | "text">("image");
- const [secondaryType, setSecondaryType] = useState("");
const [visibility, setVisibility] = useState<"public" | "private">("private");
- const [categoryPath, setCategoryPath] = useState<{
- productCategory: string;
- audienceTag: string;
- usageScenario: string;
- brand: string;
- }>({
- productCategory: "",
- audienceTag: "",
- usageScenario: "",
- brand: "",
- });
const [defaultModelId, setDefaultModelId] = useState("");
const [description, setDescription] = useState("");
const [avatarAssetId, setAvatarAssetId] = useState("");
@@ -130,10 +111,6 @@ export function AgentPresetDialog({
model.supportsImageGen && !videoProviderTypes.has(String(model.providerType || ""))
);
}, [modelsData?.models, type, videoProviderTypes]);
- const secondaryTypeOptions = useMemo(
- () => secondaryTypeConfig[type] || [],
- [secondaryTypeConfig, type]
- );
useEffect(() => {
if (!open) return;
@@ -161,14 +138,7 @@ export function AgentPresetDialog({
const resetState = () => {
setName("");
setType("image");
- setSecondaryType("");
setVisibility("private");
- setCategoryPath({
- productCategory: "",
- audienceTag: "",
- usageScenario: "",
- brand: "",
- });
setDefaultModelId("");
setDescription("");
setAvatarAssetId("");
@@ -197,14 +167,7 @@ export function AgentPresetDialog({
setName(initialPreset.name || "");
setType(initialPreset.type);
- setSecondaryType(String(initialPreset.secondaryType || ""));
setVisibility(initialPreset.visibility);
- setCategoryPath({
- productCategory: String(initialPreset.categoryPath?.productCategory || ""),
- audienceTag: String(initialPreset.categoryPath?.audienceTag || ""),
- usageScenario: String(initialPreset.categoryPath?.usageScenario || ""),
- brand: String(initialPreset.categoryPath?.brand || ""),
- });
setDefaultModelId(initialPreset.defaultModelId || "");
setDescription(initialPreset.description || "");
setAvatarAssetId(initialPreset.avatarAssetId || "");
@@ -349,17 +312,10 @@ export function AgentPresetDialog({
setIsSubmitting(true);
try {
- const payload = {
+ const basePayload: AgentCreatePayload = {
name: name.trim(),
type,
- secondaryType: secondaryType || undefined,
visibility,
- categoryPath: {
- productCategory: categoryPath.productCategory || undefined,
- audienceTag: categoryPath.audienceTag || undefined,
- usageScenario: categoryPath.usageScenario || undefined,
- brand: categoryPath.brand || undefined,
- },
description: description.trim() || undefined,
defaultModelId,
slots: slots.map((slot, index) => ({
@@ -372,11 +328,15 @@ export function AgentPresetDialog({
referenceAssetIds: slot.referenceAssetIds || [],
})),
avatarAssetId: avatarAssetId || undefined,
- } as const;
+ };
const result = initialPreset
- ? await agentService.updatePreset(initialPreset.id, payload)
- : await agentService.createPreset(payload);
+ ? await agentService.updatePreset(initialPreset.id, {
+ ...basePayload,
+ secondaryType: null,
+ categoryPath: null,
+ } satisfies AgentUpdatePayload)
+ : await agentService.createPreset(basePayload);
if (!result.success || !result.data) {
throw new Error(result.error || (initialPreset ? "更新智能体失败" : "创建智能体失败"));
@@ -404,7 +364,7 @@ export function AgentPresetDialog({
{initialPreset ? "编辑智能体" : "新建智能体"}
- 配置模型、槽位提示词和参考图。
+ 配置模式名称、预览图、模型和槽位提示词。
@@ -480,7 +440,6 @@ export function AgentPresetDialog({
value={type}
onValueChange={(value: AgentPresetType) => {
setType(value);
- setSecondaryType("");
setDefaultModelId("");
}}
>
@@ -494,52 +453,6 @@ export function AgentPresetDialog({
-
-
二级类型
-
-
- 二级类型由管理员在系统设置中统一配置。
-
-
-
-
产品品类
-
-
对应模型