diff --git a/app/admin/agents/AgentForm.tsx b/app/admin/agents/AgentForm.tsx index d5cde01..e9e4222 100644 --- a/app/admin/agents/AgentForm.tsx +++ b/app/admin/agents/AgentForm.tsx @@ -16,6 +16,8 @@ export default function AgentForm({ icon?: string categoryId?: number features?: string + hotQuestions?: string + quickQuestions?: string status?: string } }) { @@ -27,6 +29,8 @@ export default function AgentForm({ icon: agent?.icon || "", categoryId: agent?.categoryId || "", features: agent?.features || "", + hotQuestions: agent?.hotQuestions ? JSON.parse(agent.hotQuestions).join('\n') : '', + quickQuestions: agent?.quickQuestions ? JSON.parse(agent.quickQuestions).join('\n') : '', status: agent?.status || "active", }) const [loading, setLoading] = useState(false) @@ -44,10 +48,16 @@ export default function AgentForm({ const method = agent?.id ? "PUT" : "POST" + const body = { + ...formData, + hotQuestions: JSON.stringify(formData.hotQuestions.split('\n').filter(q => q.trim())), + quickQuestions: JSON.stringify(formData.quickQuestions.split('\n').filter(q => q.trim())), + } + const res = await fetch(url, { method, headers: { "Content-Type": "application/json" }, - body: JSON.stringify(formData), + body: JSON.stringify(body), }) if (res.ok) { @@ -175,6 +185,33 @@ export default function AgentForm({ /> +
+
+ +