Spaces:
Running
Running
axeronis commited on
Commit ·
3e601dc
1
Parent(s): a11f752
fix(brain): prevent map on undefined for custom_fields
Browse files
frontend/app/settings/brain/page.tsx
CHANGED
|
@@ -139,11 +139,13 @@ export default function BrainSettingsPage() {
|
|
| 139 |
|
| 140 |
useEffect(() => {
|
| 141 |
if (tenantData) {
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
| 147 |
})
|
| 148 |
setPersona({
|
| 149 |
business_type: tenantData.business_type || 'hybrid',
|
|
@@ -1206,7 +1208,7 @@ export default function BrainSettingsPage() {
|
|
| 1206 |
</div>
|
| 1207 |
|
| 1208 |
<div className="flex flex-wrap gap-2 mb-6">
|
| 1209 |
-
{settings.custom_fields.map((field) => (
|
| 1210 |
<div
|
| 1211 |
key={field}
|
| 1212 |
className="inline-flex items-center gap-2 px-3 py-1.5 bg-indigo-500/20 text-indigo-700 border border-indigo-100 rounded-lg text-sm font-medium"
|
|
|
|
| 139 |
|
| 140 |
useEffect(() => {
|
| 141 |
if (tenantData) {
|
| 142 |
+
const aiSettings = tenantData.ai_settings || {}
|
| 143 |
+
setSettings({
|
| 144 |
+
business_description: aiSettings.business_description || '',
|
| 145 |
+
selling_style: aiSettings.selling_style || 'Consultative',
|
| 146 |
+
// Use qualification_fields (new) or custom_fields (legacy) or empty array
|
| 147 |
+
custom_fields: aiSettings.qualification_fields || aiSettings.custom_fields || [],
|
| 148 |
+
ideal_customer_profile: aiSettings.ideal_customer_profile || ''
|
| 149 |
})
|
| 150 |
setPersona({
|
| 151 |
business_type: tenantData.business_type || 'hybrid',
|
|
|
|
| 1208 |
</div>
|
| 1209 |
|
| 1210 |
<div className="flex flex-wrap gap-2 mb-6">
|
| 1211 |
+
{(settings.custom_fields || []).map((field) => (
|
| 1212 |
<div
|
| 1213 |
key={field}
|
| 1214 |
className="inline-flex items-center gap-2 px-3 py-1.5 bg-indigo-500/20 text-indigo-700 border border-indigo-100 rounded-lg text-sm font-medium"
|