b0e8e1ced7
- Mascot identity: robot-happy-outline icon, "CV Assistant" branding - Help popup: onboarding card explaining what the mascot can do (EN/ES) - Suggested questions: 5 clickable chips that auto-submit (bilingual) - Typing indicator: three bouncing dots during agent response - Icon swap: mascot icon ↔ close icon via Hyperscript class toggle - Dark theme support for all new elements - Modular CSS loading in development, chat CSS always loaded separately
124 lines
5.6 KiB
HTML
124 lines
5.6 KiB
HTML
{{define "chat-widget"}}
|
|
{{if .ChatEnabled}}
|
|
<!-- AI Chat Widget — CV Assistant Mascot -->
|
|
<button
|
|
id="chat-toggle-btn"
|
|
class="fixed-btn chat-toggle-btn no-print has-tooltip"
|
|
aria-label="{{if eq .Lang "es"}}Asistente del CV{{else}}CV Assistant{{end}}"
|
|
data-tooltip="{{if eq .Lang "es"}}Asistente del CV{{else}}CV Assistant{{end}}"
|
|
_="on click toggle .chat-open on #chat-panel
|
|
then if #chat-panel matches .chat-open
|
|
then add .mascot-active to me
|
|
then set #chat-input.focus to true
|
|
then call #chat-input.focus()
|
|
else
|
|
remove .mascot-active from me
|
|
end">
|
|
<iconify-icon icon="mdi:robot-happy-outline" class="chat-icon-open"></iconify-icon>
|
|
<iconify-icon icon="mdi:close" class="chat-icon-close"></iconify-icon>
|
|
</button>
|
|
|
|
<div id="chat-panel" class="chat-panel no-print">
|
|
<div class="chat-header">
|
|
<iconify-icon icon="mdi:robot-happy-outline"></iconify-icon>
|
|
<span>{{if eq .Lang "es"}}Asistente del CV{{else}}CV Assistant{{end}}</span>
|
|
<button class="chat-help-btn"
|
|
aria-label="{{if eq .Lang "es"}}Ayuda{{else}}Help{{end}}"
|
|
_="on click toggle .visible on #chat-help-card">
|
|
<iconify-icon icon="mdi:help-circle-outline"></iconify-icon>
|
|
</button>
|
|
<button class="chat-close-btn"
|
|
_="on click remove .chat-open from #chat-panel
|
|
then remove .mascot-active from #chat-toggle-btn">
|
|
<iconify-icon icon="mdi:close"></iconify-icon>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Help / Onboarding Card -->
|
|
<div id="chat-help-card" class="chat-help-card visible">
|
|
<div class="chat-help-icon">
|
|
<iconify-icon icon="mdi:robot-happy-outline"></iconify-icon>
|
|
</div>
|
|
<p class="chat-help-text">
|
|
{{if eq .Lang "es"}}¡Soy el Asistente del CV! Puedo responder preguntas sobre la experiencia profesional, proyectos, habilidades y formación de Juan. Prueba a hacer clic en una sugerencia o escribe tu propia pregunta.{{else}}I'm the CV Assistant! I can answer questions about Juan's professional experience, projects, skills, and education. Try clicking a suggestion or type your own question.{{end}}
|
|
</p>
|
|
<button class="chat-help-dismiss"
|
|
_="on click remove .visible from #chat-help-card">
|
|
{{if eq .Lang "es"}}Entendido{{else}}Got it{{end}}
|
|
</button>
|
|
</div>
|
|
|
|
<div id="chat-messages" class="chat-messages">
|
|
<div class="chat-message chat-agent">
|
|
{{if eq .Lang "es"}}¡Hola! Pregúntame lo que quieras sobre este CV.{{else}}Hi! Ask me anything about this CV.{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Typing Indicator -->
|
|
<div id="chat-typing" class="chat-typing">
|
|
<span class="chat-typing-dot"></span>
|
|
<span class="chat-typing-dot"></span>
|
|
<span class="chat-typing-dot"></span>
|
|
</div>
|
|
|
|
<!-- Suggested Questions -->
|
|
<div class="chat-suggestions">
|
|
{{if eq .Lang "es"}}
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to '¿Qué proyectos en Go ha hecho?'
|
|
then send submit to #chat-form">¿Proyectos en Go?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to '¿Cuántos años de experiencia tiene?'
|
|
then send submit to #chat-form">¿Años de experiencia?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to '¿En qué empresas ha trabajado?'
|
|
then send submit to #chat-form">¿Empresas?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to '¿Conoce React?'
|
|
then send submit to #chat-form">¿Conoce React?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to '¿Qué certificaciones tiene?'
|
|
then send submit to #chat-form">¿Certificaciones?</button>
|
|
{{else}}
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to 'What Go projects has he built?'
|
|
then send submit to #chat-form">Go projects?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to 'How many years of experience?'
|
|
then send submit to #chat-form">Years of experience?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to 'What companies has he worked at?'
|
|
then send submit to #chat-form">Companies?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to 'Does he know React?'
|
|
then send submit to #chat-form">Knows React?</button>
|
|
<button class="chat-chip"
|
|
_="on click set #chat-input.value to 'What certifications?'
|
|
then send submit to #chat-form">Certifications?</button>
|
|
{{end}}
|
|
</div>
|
|
|
|
<form id="chat-form" class="chat-input-area"
|
|
hx-post="/api/chat"
|
|
hx-target="#chat-messages"
|
|
hx-swap="beforeend scroll:#chat-messages:bottom"
|
|
hx-indicator="#chat-typing"
|
|
_="on htmx:afterRequest set #chat-input.value to ''">
|
|
<input type="hidden" name="session_id" value="">
|
|
<input type="hidden" name="lang" value="{{.Lang}}">
|
|
<input
|
|
type="text"
|
|
id="chat-input"
|
|
name="message"
|
|
class="chat-input"
|
|
placeholder="{{if eq .Lang "es"}}Pregunta algo sobre el CV...{{else}}Ask something about the CV...{{end}}"
|
|
autocomplete="off"
|
|
required>
|
|
<button type="submit" class="chat-send-btn" aria-label="Send">
|
|
<iconify-icon icon="mdi:send"></iconify-icon>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|