web: ask panel interpretation chips wrap and skip null/object values
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 changed file +9 −5
modified
apps/web/src/app/search/page.tsx
+9 −5
@@ -65,11 +65,15 @@ export default async function SearchPage({ searchParams }: { searchParams: Promi | ||
| 65 | 65 | {Object.keys(answer.interpretation ?? {}).length > 0 && ( |
| 66 | 66 | <p className="mt-2 flex flex-wrap items-center gap-1 text-xs text-ink-3"> |
| 67 | 67 | Interpreted as: |
| 68 | − {Object.entries(answer.interpretation).map(([k, v]) => ( | |
| 69 | − <Chip key={k} tone="outline"> | |
| 70 | − {k} = {String(v)} | |
| 71 | − </Chip> | |
| 72 | − ))} | |
| 68 | + {Object.entries(answer.interpretation) | |
| 69 | + .filter(([k, v]) => v !== null && v !== undefined && v !== '' && !(Array.isArray(v) && v.length === 0) && typeof v !== 'object' || Array.isArray(v)) | |
| 70 | + .filter(([k]) => !['question', 'source', 'parser_version', 'llm_model', 'prompt_version', 'answer_style', 'filters'].includes(k)) | |
| 71 | + .filter(([, v]) => !(Array.isArray(v) && v.length === 0)) | |
| 72 | + .map(([k, v]) => ( | |
| 73 | + <Chip key={k} tone="outline" className="max-w-full whitespace-normal break-words"> | |
| 74 | + {k.replace(/_/g, ' ')} = {Array.isArray(v) ? v.join(', ') : String(v)} | |
| 75 | + </Chip> | |
| 76 | + ))} | |
| 73 | 77 | </p> |
| 74 | 78 | )} |
| 75 | 79 | {answer.companies.length > 0 && ( |
| 76 | 80 | |