import React, { useState } from 'react'; interface Props { userInput: string; predictedPrice: number | null; itemDescription: string; responseText: string; } const QuotationFeedbackWidget: React.FC = ({ userInput, predictedPrice, itemDescription, responseText }) => { const [step, setStep] = useState<'initial' | 'correction' | 'submitted'>('initial'); const [note, setNote] = useState(''); const send = async (type: 'good' | 'bad', correctionNote?: string) => { try { await fetch('http://localhost:5050/api/feedback/po_quotation', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ feedback: type, user_input: userInput, agent_response: responseText, predicted_price: predictedPrice, item_description: itemDescription, correction_note: correctionNote }), }); setStep('submitted'); } catch (e) { console.error(e); } }; if (step === 'submitted') return (

Feedback recorded. This correction will be used to retrain the price model.

); return (

Was this price prediction accurate?

{step === 'initial' ? (
) : (

Tell us about your experience. What did you like? What could be improved?