Dein persönlicher Transformations-Coach. Schreib einfach los.
A
const SYSTEM_PROMPT = `Du bist AXIOM, ein KI-Transformations-Coach von Quantum Dynamix AG (Schweiz). Entwickelt von jemandem, der selbst Typ-2-Diabetiker ist und diese Krankheit durch Lifestyle-Transformation umkehren will – nicht theoretisch, persönlich.
## IDENTITÄT
- Evidenzbasiert, menschlich, direkt
- Coach auf Augenhöhe, kein Besserwisser
- Schweizer Präzision trifft Wärme
- KEIN Arzt, KEIN Therapeut, KEIN Ersatz für medizinische Betreuung
## TONALITÄT
- IMMER "du", nie "Sie"
- Direkt und warm wie ein kluger Freund
- Keine Floskeln ("Tolle Frage!", "Es freut mich...")
- Kurz, konkret, keine Textwände
- Max 1-2 Fragen pro Nachricht
## T.R.A.N.S.F.O.R.M.-METHODIK
T – Tiny Steps: Jede Veränderung beginnt lächerlich klein. "Was ist die KLEINSTE Version?"
R – Reality Check: Ambivalenz ist normal. Mit Widerstand rollen, nicht dagegen.
A – Anchor Habits: Neue Gewohnheiten an bestehende ankoppeln.
N – Neuroplastizität: Das Gehirn ist formbar. Wiederholung + Emotion = neue Bahnen.
S – Sinn finden: "Wofür lohnt sich das? Was willst du erleben?"
F – Functional Imagery Training: Multi-sensorische Visualisierung. "Stell dir vor... Was siehst du? Hörst du? Fühlst du?"
O – One Day at a Time: Fokus auf HEUTE, nicht auf Perfektion.
R – Rückschläge reframen: Scheitern ist Daten, nicht Versagen.
M – Messbar machen: Die richtigen Metriken für jeden Menschen finden.
## GESPRÄCHSABLAUF
Erstes Gespräch:
1. "Hey! Ich bin AXIOM, dein Transformations-Coach. Wie heisst du?"
2. "Freut mich, [Name]! Was führt dich her – wo drückt der Schuh?"
Bei Rückschlägen:
1. Normalisieren: "Das passiert. Wirklich."
2. Verstehen: "Was ist passiert?"
3. Kein Urteil
4. Nächster kleiner Schritt: "Was wäre morgen ein winziger Schritt zurück auf Kurs?"
## DEINE STIMME
- Warm, aber nicht soft
- Direkt, aber nie harsch
- Experte, aber nie überheblich
- Optimistisch, aber realistisch
## DEIN VERSPRECHEN
"Ich bin kein Arzt und ersetze keine Therapie. Aber ich bin verdammt gut darin, dich jeden Tag einen Schritt weiterzubringen. Nicht perfekt – nur besser als gestern."`;
// Conversation history
let conversationHistory = [];
// DOM Elements
const messagesContainer = document.getElementById('messages');
const userInput = document.getElementById('user-input');
const sendBtn = document.getElementById('send-btn');
const typingIndicator = document.getElementById('typing-indicator');
// Scroll to bottom
function scrollToBottom() {
requestAnimationFrame(() => {
messagesContainer.scrollTop = messagesContainer.scrollHeight;
});
}
// Add message to chat
function addMessage(content, role) {
const welcome = messagesContainer.querySelector('.welcome-message');
if (welcome) welcome.remove();
const messageDiv = document.createElement('div');
messageDiv.className = `message ${role}`;
const avatar = document.createElement('div');
avatar.className = 'message-avatar';
avatar.textContent = role === 'assistant' ? 'A' : 'Du';
const messageContent = document.createElement('div');
messageContent.className = 'message-content';
messageContent.textContent = content;
messageDiv.appendChild(avatar);
messageDiv.appendChild(messageContent);
messagesContainer.appendChild(messageDiv);
scrollToBottom();
}
// Send message via Netlify Function
async function sendMessage(userMessage) {
conversationHistory.push({
role: 'user',
content: userMessage
});
typingIndicator.classList.add('active');
scrollToBottom();
sendBtn.disabled = true;
try {
const response = await fetch('/.netlify/functions/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
messages: conversationHistory,
system: SYSTEM_PROMPT
})
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.error || `Error: ${response.status}`);
}
const assistantMessage = data.content[0].text;
conversationHistory.push({
role: 'assistant',
content: assistantMessage
});
typingIndicator.classList.remove('active');
addMessage(assistantMessage, 'assistant');
} catch (error) {
typingIndicator.classList.remove('active');
console.error('Error:', error);
const errorDiv = document.createElement('div');
errorDiv.className = 'error-notice';
errorDiv.textContent = `Fehler: ${error.message}`;
messagesContainer.appendChild(errorDiv);
scrollToBottom();
} finally {
sendBtn.disabled = false;
userInput.focus();
}
}
// Handle send
function handleSend() {
const message = userInput.value.trim();
if (!message) return;
addMessage(message, 'user');
userInput.value = '';
userInput.style.height = 'auto';
sendMessage(message);
}
// Event listeners
sendBtn.addEventListener('click', handleSend);
userInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
handleSend();
}
});
// Auto-resize textarea
userInput.addEventListener('input', () => {
userInput.style.height = 'auto';
userInput.style.height = Math.min(userInput.scrollHeight, 150) + 'px';
});
// Initial greeting
setTimeout(() => {
const greeting = 'Hey! Ich bin AXIOM, dein Transformations-Coach. Wie heisst du?';
conversationHistory.push({
role: 'assistant',
content: greeting
});
addMessage(greeting, 'assistant');
}, 500);