feat(receipt-import): enhance product search functionality and error handling
This commit is contained in:
@@ -76,6 +76,11 @@ export default function AiAdminClient({ keyHint, hasKey, aiFunctions }: Props) {
|
||||
<h2 style={{ fontSize: '1.05rem', marginBottom: '1rem', display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
|
||||
🔑 Mistral API-nyckel
|
||||
</h2>
|
||||
{!hasKey && (
|
||||
<div style={{ background: '#fef2f2', border: '1px solid #fecaca', borderRadius: '8px', padding: '0.75rem 1rem', marginBottom: '1rem', fontSize: '0.9rem', color: '#991b1b' }}>
|
||||
⚠️ <strong>MISTRAL_API_KEY är inte konfigurerad</strong> — alla AI-funktioner är inaktiva tills nyckeln sätts i miljövariablerna.
|
||||
</div>
|
||||
)}
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '0.5rem 1.5rem', alignItems: 'center', marginBottom: '1.25rem' }}>
|
||||
<span style={{ color: '#555', fontSize: '0.9rem' }}>Status</span>
|
||||
<span>
|
||||
@@ -135,6 +140,7 @@ export default function AiAdminClient({ keyHint, hasKey, aiFunctions }: Props) {
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '0.88rem' }}>
|
||||
<thead>
|
||||
<tr style={{ borderBottom: '2px solid #e5e7eb', textAlign: 'left' }}>
|
||||
<th style={{ padding: '0.5rem 0.75rem', color: '#374151', fontWeight: 600 }}>Status</th>
|
||||
<th style={{ padding: '0.5rem 0.75rem', color: '#374151', fontWeight: 600 }}>Funktion</th>
|
||||
<th style={{ padding: '0.5rem 0.75rem', color: '#374151', fontWeight: 600 }}>Modell</th>
|
||||
<th style={{ padding: '0.5rem 0.75rem', color: '#374151', fontWeight: 600 }}>Åtkomst</th>
|
||||
@@ -144,8 +150,14 @@ export default function AiAdminClient({ keyHint, hasKey, aiFunctions }: Props) {
|
||||
</thead>
|
||||
<tbody>
|
||||
{aiFunctions.map((fn, i) => (
|
||||
<tr key={i} style={{ borderBottom: '1px solid #f3f4f6', verticalAlign: 'top' }}>
|
||||
<tr key={i} style={{ borderBottom: '1px solid #f3f4f6', verticalAlign: 'top', opacity: hasKey ? 1 : 0.55 }}>
|
||||
<td style={{ padding: '0.65rem 0.75rem' }}>
|
||||
{hasKey ? (
|
||||
<span title="Aktiv — API-nyckel konfigurerad" style={{ fontSize: '1.1rem' }}>✅</span>
|
||||
) : (
|
||||
<span title="Inaktiv — MISTRAL_API_KEY saknas" style={{ fontSize: '1.1rem' }}>🔴</span>
|
||||
)}
|
||||
</td>
|
||||
<div style={{ fontWeight: 500, marginBottom: '0.2rem' }}>{fn.name}</div>
|
||||
<div style={{ color: '#6b7280', fontSize: '0.8rem', lineHeight: 1.4 }}>{fn.description}</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user