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
256 lines
4.7 KiB
CSS
256 lines
4.7 KiB
CSS
/* ============================================================================
|
|
CHAT WIDGET
|
|
Floating AI chat panel for CV questions
|
|
============================================================================ */
|
|
|
|
/* Toggle Button */
|
|
.chat-toggle-btn {
|
|
position: fixed;
|
|
bottom: 100px;
|
|
right: 24px;
|
|
z-index: 1000;
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 50%;
|
|
background: var(--accent-color, #2563eb);
|
|
color: #fff;
|
|
border: none;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 1.4rem;
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
|
|
transition: transform 0.2s, background 0.2s;
|
|
}
|
|
|
|
.chat-toggle-btn:hover {
|
|
transform: scale(1.1);
|
|
background: var(--accent-color-hover, #1d4ed8);
|
|
}
|
|
|
|
/* Panel */
|
|
.chat-panel {
|
|
position: fixed;
|
|
bottom: 160px;
|
|
right: 24px;
|
|
width: 380px;
|
|
max-height: 500px;
|
|
background: var(--bg-primary, #fff);
|
|
border: 1px solid var(--border-color, #e2e8f0);
|
|
border-radius: 12px;
|
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
|
|
display: none;
|
|
flex-direction: column;
|
|
z-index: 999;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.chat-panel.chat-open {
|
|
display: flex;
|
|
}
|
|
|
|
/* Header */
|
|
.chat-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 12px 16px;
|
|
background: var(--accent-color, #2563eb);
|
|
color: #fff;
|
|
font-size: 0.9rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.chat-header iconify-icon {
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.chat-close-btn {
|
|
margin-left: auto;
|
|
background: none;
|
|
border: none;
|
|
color: #fff;
|
|
cursor: pointer;
|
|
font-size: 1.1rem;
|
|
opacity: 0.8;
|
|
transition: opacity 0.2s;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.chat-close-btn:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
/* Messages Area */
|
|
.chat-messages {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 16px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
max-height: 340px;
|
|
min-height: 120px;
|
|
}
|
|
|
|
/* Message Bubbles */
|
|
.chat-message {
|
|
padding: 10px 14px;
|
|
border-radius: 12px;
|
|
font-size: 0.85rem;
|
|
line-height: 1.5;
|
|
max-width: 90%;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.chat-message p {
|
|
margin: 0 0 4px 0;
|
|
}
|
|
|
|
.chat-message p:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.chat-message ul {
|
|
margin: 4px 0;
|
|
padding-left: 18px;
|
|
}
|
|
|
|
.chat-message li {
|
|
margin-bottom: 2px;
|
|
}
|
|
|
|
.chat-agent {
|
|
background: var(--bg-secondary, #f1f5f9);
|
|
color: var(--text-primary, #1e293b);
|
|
align-self: flex-start;
|
|
border-bottom-left-radius: 4px;
|
|
}
|
|
|
|
.chat-user {
|
|
background: var(--accent-color, #2563eb);
|
|
color: #fff;
|
|
align-self: flex-end;
|
|
border-bottom-right-radius: 4px;
|
|
}
|
|
|
|
.chat-error {
|
|
background: #fef2f2;
|
|
color: #991b1b;
|
|
align-self: center;
|
|
font-style: italic;
|
|
border: 1px solid #fecaca;
|
|
}
|
|
|
|
/* Input Area */
|
|
.chat-input-area {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 12px;
|
|
border-top: 1px solid var(--border-color, #e2e8f0);
|
|
background: var(--bg-primary, #fff);
|
|
}
|
|
|
|
.chat-input {
|
|
flex: 1;
|
|
padding: 8px 12px;
|
|
border: 1px solid var(--border-color, #e2e8f0);
|
|
border-radius: 20px;
|
|
font-size: 0.85rem;
|
|
outline: none;
|
|
background: var(--bg-primary, #fff);
|
|
color: var(--text-primary, #1e293b);
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
.chat-input:focus {
|
|
border-color: var(--accent-color, #2563eb);
|
|
}
|
|
|
|
.chat-send-btn {
|
|
background: var(--accent-color, #2563eb);
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 50%;
|
|
width: 36px;
|
|
height: 36px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 1.1rem;
|
|
transition: background 0.2s;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.chat-send-btn:hover {
|
|
background: var(--accent-color-hover, #1d4ed8);
|
|
}
|
|
|
|
/* Spinner */
|
|
.chat-spinner {
|
|
display: none;
|
|
}
|
|
|
|
.chat-spinner.htmx-request {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.spin {
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
from { transform: rotate(0deg); }
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 480px) {
|
|
.chat-panel {
|
|
bottom: 0;
|
|
right: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
max-height: 60vh;
|
|
border-radius: 12px 12px 0 0;
|
|
}
|
|
|
|
.chat-toggle-btn {
|
|
bottom: 80px;
|
|
right: 16px;
|
|
}
|
|
}
|
|
|
|
/* Theme: Clean (dark) */
|
|
.theme-clean .chat-panel {
|
|
background: #1e293b;
|
|
border-color: #334155;
|
|
}
|
|
|
|
.theme-clean .chat-agent {
|
|
background: #334155;
|
|
color: #e2e8f0;
|
|
}
|
|
|
|
.theme-clean .chat-error {
|
|
background: #450a0a;
|
|
color: #fca5a5;
|
|
border-color: #7f1d1d;
|
|
}
|
|
|
|
.theme-clean .chat-input-area {
|
|
border-top-color: #334155;
|
|
background: #1e293b;
|
|
}
|
|
|
|
.theme-clean .chat-input {
|
|
background: #0f172a;
|
|
border-color: #334155;
|
|
color: #e2e8f0;
|
|
}
|