This commit is contained in:
2026-02-20 09:32:02 +01:00
parent 8bd4a1cbec
commit 2362bd4b8a
2 changed files with 6 additions and 27 deletions

View File

@@ -147,7 +147,6 @@ class KIChat {
try {
// Build absolute URL to ensure correct path on any hosting
const apiUrl = new URL('/scripts/add/send.php', window.location.origin).href;
console.log('KI Chat: Sending to', apiUrl);
const response = await fetch(apiUrl, {
method: 'POST',
@@ -162,19 +161,15 @@ class KIChat {
})
});
console.log('KI Chat: Response status', response.status);
const data = await response.json();
console.log('KI Chat: Response data', data);
if (data.success && data.data && data.data.ai_response) {
this.addMessage('ki', data.data.ai_response, data.data.timestamp);
} else {
console.error('KI Chat: Invalid response structure', data);
this.addMessage('ki', 'Entschuldigung, es gab ein Problem. Bitte versuchen Sie es später erneut.');
this.addMessage('ki', 'Entschuldigung, es gab ein Problem. Bitte versuchen Sie es später erneut.');
}
} catch (error) {
console.error('Chat error:', error);
this.addMessage('ki', 'Verbindung zum Server fehlgeschlagen. Bitte überprüfen Sie Ihre Internetverbindung.');
this.addMessage('ki', 'Verbindung zum Server fehlgeschlagen. Bitte überprüfen Sie Ihre Internetverbindung.');
} finally {
this.hideTypingIndicator();
this.isTyping = false;