Handle new-style suggestions (#152)

This commit is contained in:
Matt Rubens 2025-06-28 16:23:52 -04:00 committed by GitHub
parent e93daaf9ec
commit d56a9229ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,9 +9,11 @@ type MessagesProps = {
messages: Message[];
};
type SuggestionItem = string | { answer: string };
type QuestionData = {
question: string;
suggestions: string[];
suggestions: SuggestionItem[];
};
const parseQuestionData = (text: string): QuestionData | null => {
@ -97,7 +99,9 @@ export const Messages = ({ messages }: MessagesProps) => {
key={index}
className="px-4 py-3 bg-background border border-border rounded-md text-sm hover:bg-muted/50 cursor-pointer transition-colors"
>
{suggestion}
{typeof suggestion === 'string'
? suggestion
: suggestion.answer}
</div>
))}
</div>