f5276431ea
Visitors can ask questions about the CV via a floating chat panel. The agent uses Gemini to answer questions about experience, projects, skills, and education by querying the cached CV JSON data. - internal/chat/agent.go: LLM agent with query_cv tool that searches CV data by section (experience, projects, skills, etc.) with keyword filtering - internal/chat/handler.go: POST /api/chat endpoint with session management, graceful degradation when GOOGLE_API_KEY is not set - chat-widget.html: HTMX-powered floating chat panel with Hyperscript toggle - _chat.css: Responsive chat UI with dark theme support - Wired into existing architecture via dependency injection (CVHandler, routes, main.go) — zero breaking changes, all existing tests pass
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package handlers
|
|
|
|
import (
|
|
"github.com/juanatsap/cv-site/internal/cache"
|
|
c "github.com/juanatsap/cv-site/internal/constants"
|
|
"github.com/juanatsap/cv-site/internal/pdf"
|
|
"github.com/juanatsap/cv-site/internal/email"
|
|
"github.com/juanatsap/cv-site/internal/templates"
|
|
)
|
|
|
|
// CVHandler handles CV-related requests
|
|
// Methods are split across multiple files for better organization:
|
|
// - cv_pages.go: Page rendering (Home, CVContent, DefaultCVShortcut)
|
|
// - cv_pdf.go: PDF export (ExportPDF)
|
|
// - cv_htmx.go: HTMX toggles (ToggleLength, ToggleIcons, SwitchLanguage, ToggleTheme)
|
|
// - cv_contact.go: Contact form submission (HandleContact)
|
|
// - cv_helpers.go: Helper functions (skills, dates, git, templates, cookies)
|
|
type CVHandler struct {
|
|
templates *templates.Manager
|
|
pdfGenerator *pdf.Generator
|
|
emailService *email.Service
|
|
serverAddr string
|
|
dataCache *cache.DataCache
|
|
chatEnabled bool
|
|
}
|
|
|
|
// NewCVHandler creates a new CV handler
|
|
func NewCVHandler(tmpl *templates.Manager, serverAddr string, emailService *email.Service, dataCache *cache.DataCache, chatEnabled bool) *CVHandler {
|
|
return &CVHandler{
|
|
templates: tmpl,
|
|
pdfGenerator: pdf.NewGenerator(c.TimeoutPDFGeneration),
|
|
emailService: emailService,
|
|
serverAddr: serverAddr,
|
|
dataCache: dataCache,
|
|
chatEnabled: chatEnabled,
|
|
}
|
|
}
|