Fuad — Technical Lines Assistant
1
Chat with Fuad 👋
👋 Hi! I'm Fuad from Technical Lines! Ask me anything about our signs, printing, vehicle wraps, flags, exhibition booths , and more — or I can help you get a quote!
🪧 Signs
🖨️ Printing
🚗 Wraps
🚩 Flags
💬 Quote
📍 Contact
`;
}
function appendMsg(text, role) {
const msgs = document.getElementById('messages');
const typingRow = document.getElementById('typing');
const row = document.createElement('div');
row.className = 'msg-row ' + role;
row.innerHTML = (role === 'bot' ? fuadAvatar() : userAvatar()) + `
${text}
`;
msgs.insertBefore(row, typingRow);
msgs.scrollTop = msgs.scrollHeight;
}
function sendChip(text) {
document.getElementById('user-input').value = text;
sendMsg();
}
async function sendMsg() {
const input = document.getElementById('user-input');
const text = input.value.trim();
if (!text) return;
input.value = '';
appendMsg(text, 'user');
history.push({ role: 'user', content: text });
const typingRow = document.getElementById('typing');
typingRow.style.display = 'flex';
document.getElementById('messages').scrollTop = 99999;
try {
const res = await fetch('https://api.anthropic.com/v1/messages', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'claude-sonnet-4-20250514',
max_tokens: 1000,
system: SYSTEM_PROMPT,
messages: history
})
});
const data = await res.json();
const reply = data.content?.[0]?.text || "I'm having trouble connecting right now. Please contact us at sales@tec-lines.com or WhatsApp +966 531870667.";
typingRow.style.display = 'none';
history.push({ role: 'assistant', content: reply });
appendMsg(reply.replace(/\n\n/g, '
').replace(/\n/g, '
'), 'bot');
} catch (err) {
typingRow.style.display = 'none';
appendMsg('Connection issue. Please contact us at
sales@tec-lines.com or WhatsApp
+966 531870667 .', 'bot');
}
}