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;

View File

@@ -33,23 +33,12 @@ class DemoChat {
this.sendBtn = document.querySelector('.chat-demo .chat-send-btn')
|| document.querySelector('.chat-demo button');
console.log('Demo Chat Setup:', {
messagesFound: !!this.chatMessages,
inputFound: !!this.chatInput,
sendBtnFound: !!this.sendBtn
});
if (!this.chatMessages || !this.chatInput || !this.sendBtn) {
console.warn('Demo chat elements not found', {
chatMessages: this.chatMessages,
chatInput: this.chatInput,
sendBtn: this.sendBtn
});
return;
return;
}
this.bindEvents();
console.log('Demo Chat: Events bound successfully');
}
generateSessionId() {
@@ -96,7 +85,6 @@ class DemoChat {
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('Demo Chat: Sending to', apiUrl);
const response = await fetch(apiUrl, {
method: 'POST',
@@ -111,19 +99,15 @@ class DemoChat {
})
});
console.log('Demo Chat: Response status', response.status);
const data = await response.json();
console.log('Demo Chat: Response data', JSON.stringify(data, null, 2));
if (data.success && data.data && data.data.ai_response) {
this.addMessageToUI('ki', data.data.ai_response);
} else {
console.error('Demo Chat: Invalid response structure', data);
this.addMessageToUI('ki', 'Entschuldigung, es gab ein Problem. Bitte versuchen Sie es später erneut.');
this.addMessageToUI('ki', 'Entschuldigung, es gab ein Problem. Bitte versuchen Sie es später erneut.');
}
} catch (error) {
console.error('Demo chat error:', error);
this.addMessageToUI('ki', 'Verbindung zum Server fehlgeschlagen. Bitte überprüfen Sie Ihre Internetverbindung.');
this.addMessageToUI('ki', 'Verbindung zum Server fehlgeschlagen. Bitte überprüfen Sie Ihre Internetverbindung.');
} finally {
this.hideTypingIndicator();
this.isTyping = false;