Route Afia through the platform AI relay when no local API key is set.
Deploy Ladill Frontdesk / deploy (push) Successful in 45s
Deploy Ladill Frontdesk / deploy (push) Successful in 45s
Frontdesk now calls ladill.com/api/afia/chat using IDENTITY_API_KEY_FRONTDESK so production does not need a separate OpenAI key in the frontdesk .env. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+5
-1
@@ -110,7 +110,11 @@ Alpine.data('afia', (config = {}) => ({
|
||||
body: JSON.stringify({ message: text, history }),
|
||||
});
|
||||
const data = await res.json();
|
||||
this.messages.push({ role: 'assistant', text: data.reply || data.message || 'Sorry, I could not respond.' });
|
||||
if (! res.ok) {
|
||||
this.messages.push({ role: 'assistant', text: data.message || data.reply || 'Sorry, I could not respond.' });
|
||||
} else {
|
||||
this.messages.push({ role: 'assistant', text: data.reply || data.message || 'Sorry, I could not respond.' });
|
||||
}
|
||||
} catch (e) {
|
||||
this.messages.push({ role: 'assistant', text: 'Network error — please try again.' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user