Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions frontend/src/components/AISuggestions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,34 @@ export default function AISuggestions({ ticketId }) {
<button
onClick={run}
disabled={loading || !ticketId}
aria-busy={loading}
className="bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700 text-sm disabled:opacity-50"
>
{loading ? "Thinking…" : "Suggest Fixes"}
</button>
</div>

{error && (
<div className="text-sm text-red-600 bg-red-50 border border-red-100 rounded px-3 py-2 mt-2">
<div
role="alert"
className="text-sm text-red-600 bg-red-50 border border-red-100 rounded px-3 py-2 mt-2"
>
{error}
</div>
)}

{note && !error && (
<p className="text-sm text-gray-500 mt-2">{note}</p>
<p role="status" className="text-sm text-gray-500 mt-2">{note}</p>
)}

{matches && matches.length === 0 && !note && !error && (
<p className="text-sm text-gray-500 mt-2">No similar resolved tickets found yet.</p>
<p role="status" className="text-sm text-gray-500 mt-2">
No similar resolved tickets found yet.
</p>
)}

{matches && matches.length > 0 && (
<div className="mt-4 space-y-3">
<div role="status" aria-label="Suggested similar tickets" className="mt-4 space-y-3">
{matches.map((m, i) => (
<div
key={m.ticket_id || i}
Expand Down
Loading