2026-04-08 00:20:48 +01:00
{{define "chat-widget"}}
{{if .ChatEnabled}}
2026-04-08 10:49:19 +01:00
<!-- AI Chat Widget — CV Assistant Mascot -->
2026-04-08 00:20:48 +01:00
< button
id = "chat-toggle-btn"
class = "fixed-btn chat-toggle-btn no-print has-tooltip"
2026-04-08 10:49:19 +01:00
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 } } "
2026-04-08 00:20:48 +01:00
_ = "on click toggle .chat-open on #chat-panel
then if #chat-panel matches .chat-open
2026-04-08 10:49:19 +01:00
then add .mascot-active to me
2026-04-08 00:20:48 +01:00
then set #chat-input.focus to true
then call #chat-input.focus()
2026-04-08 10:49:19 +01:00
else
remove .mascot-active from me
2026-04-08 00:20:48 +01:00
end" >
2026-04-08 10:49:19 +01:00
< iconify-icon icon = "mdi:robot-happy-outline" class = "chat-icon-open" > < / iconify-icon >
< iconify-icon icon = "mdi:close" class = "chat-icon-close" > < / iconify-icon >
2026-04-08 00:20:48 +01:00
< / button >
< div id = "chat-panel" class = "chat-panel no-print" >
< div class = "chat-header" >
2026-04-08 10:49:19 +01:00
< 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 >
2026-04-08 00:20:48 +01:00
< / div >
2026-04-08 10:49:19 +01:00
<!-- 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 >
2026-04-08 00:20:48 +01:00
< div id = "chat-messages" class = "chat-messages" >
< div class = "chat-message chat-agent" >
2026-04-08 10:49:19 +01:00
{{if eq .Lang "es"}}¡Hola! Pregúntame lo que quieras sobre este CV.{{else}}Hi! Ask me anything about this CV.{{end}}
2026-04-08 00:20:48 +01:00
< / div >
< / div >
2026-04-08 10:49:19 +01:00
<!-- 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"}}
2026-04-08 11:31:09 +01:00
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to '¿Qué proyectos en Go ha hecho?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > ¿Proyectos en Go?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to '¿Cuántos años de experiencia tiene?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > ¿Años de experiencia?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to '¿En qué empresas ha trabajado?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > ¿Empresas?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to '¿Conoce React?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > ¿Conoce React?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to '¿Qué certificaciones tiene?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > ¿Certificaciones?< / button >
2026-04-08 10:49:19 +01:00
{{else}}
2026-04-08 11:31:09 +01:00
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to 'What Go projects has he built?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > Go projects?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to 'How many years of experience?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > Years of experience?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to 'What companies has he worked at?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > Companies?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to 'Does he know React?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > Knows React?< / button >
< button type = "button" class = "chat-chip"
2026-04-08 10:49:19 +01:00
_ = "on click set #chat-input.value to 'What certifications?'
2026-04-08 11:31:09 +01:00
then call htmx.trigger(#chat-form, 'submit')" > Certifications?< / button >
2026-04-08 10:49:19 +01:00
{{end}}
< / div >
2026-04-08 00:20:48 +01:00
< form id = "chat-form" class = "chat-input-area"
hx-post = "/api/chat"
hx-target = "#chat-messages"
hx-swap = "beforeend scroll:#chat-messages:bottom"
2026-04-08 10:49:19 +01:00
hx-indicator = "#chat-typing"
2026-04-08 00:20:48 +01:00
_ = "on htmx:afterRequest set #chat-input.value to ''" >
2026-04-08 11:31:09 +01:00
< input type = "hidden" id = "chat-session-id" name = "session_id" value = "" >
2026-04-08 00:20:48 +01:00
< input type = "hidden" name = "lang" value = "{{.Lang}}" >
< input
type = "text"
id = "chat-input"
name = "message"
class = "chat-input"
2026-04-08 10:49:19 +01:00
placeholder = "{{if eq .Lang " es " } } Pregunta algo sobre el CV . . . { { else } } Ask something about the CV . . . { { end } } "
2026-04-08 11:31:09 +01:00
autocomplete = "off" >
2026-04-08 00:20:48 +01:00
< button type = "submit" class = "chat-send-btn" aria-label = "Send" >
< iconify-icon icon = "mdi:send" > < / iconify-icon >
< / button >
< / form >
< / div >
{{end}}
{{end}}