Update AI search and compare pages
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
} from '@mui/material'
|
||||
import { Sparkles, ArrowRight } from 'lucide-react'
|
||||
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'
|
||||
|
||||
@@ -39,7 +39,8 @@ export default function AISearch() {
|
||||
const handleAnalyze = async () => {
|
||||
setStep('extracting')
|
||||
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)
|
||||
setStep('review')
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -58,12 +59,12 @@ function getRiskLabel(risk?: RiskLevel): string {
|
||||
interface CompareRow {
|
||||
label: string
|
||||
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
|
||||
isLowerBetter?: boolean
|
||||
}
|
||||
|
||||
function NumericCell({ value, isBest }: { value: React.ReactNode; isBest: boolean }) {
|
||||
function NumericCell({ value, isBest }: { value: ReactNode; isBest: boolean }) {
|
||||
return (
|
||||
<TableCell
|
||||
sx={{
|
||||
@@ -92,7 +93,7 @@ export default function Compare() {
|
||||
// Keep ordering same as tray
|
||||
const orderedProperties = compareTray
|
||||
.map(id => compareProperties.find(p => p.id === id))
|
||||
.filter((p): p is Property => p !== null)
|
||||
.filter((p): p is Property => p !== undefined)
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user