6
This commit is contained in:
@@ -563,16 +563,25 @@ function handleChatMessage($data) {
|
|||||||
if ($webhookResult['success']) {
|
if ($webhookResult['success']) {
|
||||||
// Try to parse response from webhook
|
// Try to parse response from webhook
|
||||||
$response = json_decode($webhookResult['response'], true);
|
$response = json_decode($webhookResult['response'], true);
|
||||||
$aiResponse = $response['message'] ?? 'Vielen Dank für Ihre Nachricht. Ich melde mich so schnell wie möglich bei Ihnen.';
|
$aiResponse = $response['message'] ?? $response['output'] ?? 'Vielen Dank für Ihre Nachricht. Ich melde mich so schnell wie möglich bei Ihnen.';
|
||||||
|
|
||||||
sendResponse(true, 'Nachricht gesendet', array_merge($debugData, [
|
sendResponse(true, 'Nachricht gesendet', array_merge($debugData ?? [], [
|
||||||
'session_id' => $sessionId,
|
'session_id' => $sessionId,
|
||||||
'ai_response' => $aiResponse,
|
'ai_response' => $aiResponse,
|
||||||
'timestamp' => date('c')
|
'timestamp' => date('c')
|
||||||
]));
|
]));
|
||||||
} else {
|
} else {
|
||||||
error_log('Chat webhook failed: ' . json_encode($webhookResult));
|
// Log detailed error for debugging
|
||||||
sendResponse(false, 'Chat-Service derzeit nicht verfügbar. Bitte versuchen Sie es später erneut.', $debugData, 503);
|
error_log('Chat webhook failed - URL: ' . KI_CHAT_WEBHOOK_URL . ' - Result: ' . json_encode($webhookResult));
|
||||||
|
|
||||||
|
// Return a friendly message but still allow chat to work with fallback
|
||||||
|
$fallbackResponse = 'Vielen Dank für Ihre Nachricht. Unser Team wird sich in Kürze bei Ihnen melden.';
|
||||||
|
sendResponse(true, 'Nachricht empfangen', array_merge($debugData ?? [], [
|
||||||
|
'session_id' => $sessionId,
|
||||||
|
'ai_response' => $fallbackResponse,
|
||||||
|
'timestamp' => date('c'),
|
||||||
|
'fallback' => true
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
maxOpacity: 0.6,
|
maxOpacity: 0.6,
|
||||||
magnetRadius: 200,
|
magnetRadius: 200,
|
||||||
maxDisplacement: 12,
|
maxDisplacement: 12,
|
||||||
returnSpeed: 0.1,
|
returnSpeed: 0.25, // Faster return to prevent color lag
|
||||||
// Base color (neutral gray)
|
// Base color (neutral gray)
|
||||||
baseR: 119, baseG: 119, baseB: 100,
|
baseR: 119, baseG: 119, baseB: 100,
|
||||||
// Colors for proximity effect (teal to orange)
|
// Colors for proximity effect (teal to orange)
|
||||||
@@ -170,8 +170,12 @@
|
|||||||
const horizSpacing = CONFIG.hexSize * Math.sqrt(3);
|
const horizSpacing = CONFIG.hexSize * Math.sqrt(3);
|
||||||
const vertSpacing = CONFIG.hexSize * 1.5;
|
const vertSpacing = CONFIG.hexSize * 1.5;
|
||||||
|
|
||||||
const cols = Math.ceil(window.innerWidth / horizSpacing) + 3;
|
// Use full screen dimensions
|
||||||
const rows = Math.ceil(window.innerHeight / vertSpacing) + 3;
|
const width = Math.max(window.innerWidth, document.documentElement.clientWidth);
|
||||||
|
const height = Math.max(window.innerHeight, document.documentElement.clientHeight);
|
||||||
|
|
||||||
|
const cols = Math.ceil(width / horizSpacing) + 4;
|
||||||
|
const rows = Math.ceil(height / vertSpacing) + 4;
|
||||||
|
|
||||||
for (let row = -1; row < rows; row++) {
|
for (let row = -1; row < rows; row++) {
|
||||||
for (let col = -1; col < cols; col++) {
|
for (let col = -1; col < cols; col++) {
|
||||||
@@ -193,10 +197,17 @@
|
|||||||
|
|
||||||
function resize() {
|
function resize() {
|
||||||
const dpr = window.devicePixelRatio || 1;
|
const dpr = window.devicePixelRatio || 1;
|
||||||
canvas.width = window.innerWidth * dpr;
|
// Use full document dimensions to cover entire scrollable page
|
||||||
canvas.height = window.innerHeight * dpr;
|
const width = Math.max(window.innerWidth, document.documentElement.clientWidth);
|
||||||
canvas.style.width = window.innerWidth + 'px';
|
const height = Math.max(window.innerHeight, document.documentElement.clientHeight);
|
||||||
canvas.style.height = window.innerHeight + 'px';
|
|
||||||
|
canvas.width = width * dpr;
|
||||||
|
canvas.height = height * dpr;
|
||||||
|
canvas.style.width = width + 'px';
|
||||||
|
canvas.style.height = height + 'px';
|
||||||
|
|
||||||
|
// Reset transform and apply new scale
|
||||||
|
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||||
ctx.scale(dpr, dpr);
|
ctx.scale(dpr, dpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,8 +237,12 @@
|
|||||||
const dx = mouse.x - hex.originX;
|
const dx = mouse.x - hex.originX;
|
||||||
const dy = mouse.y - hex.originY;
|
const dy = mouse.y - hex.originY;
|
||||||
const distance = Math.sqrt(dx * dx + dy * dy);
|
const distance = Math.sqrt(dx * dx + dy * dy);
|
||||||
|
|
||||||
|
// Check if position OR color needs to return to default
|
||||||
const isReturning = Math.abs(hex.currentX - hex.originX) > 0.1 ||
|
const isReturning = Math.abs(hex.currentX - hex.originX) > 0.1 ||
|
||||||
Math.abs(hex.currentY - hex.originY) > 0.1;
|
Math.abs(hex.currentY - hex.originY) > 0.1 ||
|
||||||
|
hex.colorInfluence > 0.01 ||
|
||||||
|
hex.opacity > CONFIG.baseOpacity + 0.01;
|
||||||
|
|
||||||
if (distance < updateRadius || isReturning) {
|
if (distance < updateRadius || isReturning) {
|
||||||
hex.update(mouse.x, mouse.y);
|
hex.update(mouse.x, mouse.y);
|
||||||
|
|||||||
Reference in New Issue
Block a user