Update AI search and compare pages

This commit is contained in:
Benjamin Sutter
2026-05-15 00:49:11 +02:00
parent 9e827c50f9
commit 39427c4835
2 changed files with 7 additions and 5 deletions
+3 -2
View File
@@ -13,7 +13,7 @@ import {
} from '@mui/material' } from '@mui/material'
import { Sparkles, ArrowRight } from 'lucide-react' import { Sparkles, ArrowRight } from 'lucide-react'
import { useNavigate } from 'react-router' import { useNavigate } from 'react-router'
import { MockupAIServiceProvider, type CriteriaExtractionResult } from '../../services/aiService' import { aiService, type CriteriaExtractionResult } from '../../services/aiService'
type Step = 'input' | 'extracting' | 'review' | 'done' type Step = 'input' | 'extracting' | 'review' | 'done'
@@ -39,7 +39,8 @@ export default function AISearch() {
const handleAnalyze = async () => { const handleAnalyze = async () => {
setStep('extracting') setStep('extracting')
await new Promise(r => setTimeout(r, 1500)) await new Promise(r => setTimeout(r, 1500))
const result = await MockupAIServiceProvider.extractCriteria(inputText) const resp = await aiService.extractCriteria(inputText)
const result = resp.data
setExtractedCriteria(result) setExtractedCriteria(result)
setStep('review') setStep('review')
} }
+4 -3
View File
@@ -1,3 +1,4 @@
import type { ReactNode } from 'react'
import { import {
Box, Box,
Button, Button,
@@ -58,12 +59,12 @@ function getRiskLabel(risk?: RiskLevel): string {
interface CompareRow { interface CompareRow {
label: string label: string
getValue: (p: Property) => string | number | null getValue: (p: Property) => string | number | null
format?: (v: string | number | null, p: Property) => React.ReactNode format?: (v: string | number | null, p: Property) => ReactNode
isHigherBetter?: boolean isHigherBetter?: boolean
isLowerBetter?: boolean isLowerBetter?: boolean
} }
function NumericCell({ value, isBest }: { value: React.ReactNode; isBest: boolean }) { function NumericCell({ value, isBest }: { value: ReactNode; isBest: boolean }) {
return ( return (
<TableCell <TableCell
sx={{ sx={{
@@ -92,7 +93,7 @@ export default function Compare() {
// Keep ordering same as tray // Keep ordering same as tray
const orderedProperties = compareTray const orderedProperties = compareTray
.map(id => compareProperties.find(p => p.id === id)) .map(id => compareProperties.find(p => p.id === id))
.filter((p): p is Property => p !== null) .filter((p): p is Property => p !== undefined)
if (isLoading) { if (isLoading) {
return ( return (