diff --git a/internal/chat/agent.go b/internal/chat/agent.go index 6bde9f3..d60f901 100644 --- a/internal/chat/agent.go +++ b/internal/chat/agent.go @@ -33,6 +33,7 @@ You answer questions about the CV owner's experience, projects, skills, educatio RULES: - Use the query_cv tool to look up CV data before answering. Never make up information. +- For technology questions (e.g. "Java", "Go", "React"), ALWAYS use section="search" — this searches across experience, projects, courses, and skills simultaneously. Do NOT search only projects or only experience. - Answer in the SAME LANGUAGE the user writes in. If they ask in Spanish, answer in Spanish. - Be concise and direct — visitors want quick answers, not essays. - When listing items (projects, technologies, companies), use bullet points. @@ -42,18 +43,19 @@ RULES: - You represent the CV owner professionally — be friendly but not overly casual. EXAMPLES of questions you might receive: -- "How many years of experience does Juan have?" -- "What Go projects has he built?" -- "Has he worked with React?" -- "Tell me about his time at Olympic Broadcasting" -- "What certifications does he have?"`, +- "How many years of experience does Juan have?" → section="summary" +- "What Java experience does he have?" → section="search", query="java" +- "Has he worked with React?" → section="search", query="react" +- "Tell me about his time at Olympic Broadcasting" → section="search", query="olympic" +- "What certifications does he have?" → section="certifications" +- "List all his projects" → section="projects"`, Tools: []tool.Tool{queryTool}, }) } // QueryCVArgs is the input for the CV query tool. type QueryCVArgs struct { - Section string `json:"section" jsonschema:"CV section to query: 'experience', 'projects', 'skills', 'education', 'languages', 'certifications', 'courses', 'awards', 'summary', 'all'"` + Section string `json:"section" jsonschema:"CV section to query: 'search' (cross-section keyword search — recommended for technology queries), 'experience', 'projects', 'skills', 'education', 'languages', 'certifications', 'courses', 'awards', 'summary', 'all'"` Query string `json:"query" jsonschema:"Search term to filter results (e.g. 'Go', 'React', '2019', 'Olympic'). Empty returns all items in the section."` Language string `json:"language" jsonschema:"Language for CV data: 'en' or 'es'. Default: 'en'."` } @@ -71,6 +73,7 @@ func newQueryCVTool(dataCache *cache.DataCache) (tool.Tool, error) { Name: "query_cv", Description: `Query the CV data to answer questions about experience, projects, skills, education, certifications, and more. Use the 'section' parameter to target a specific area, and 'query' to filter by keyword. +For technology or keyword queries (e.g. "Java", "Go", "React", "Olympic"), use section="search" to search across experience, projects, skills, and courses simultaneously. This avoids missing results that appear in multiple sections. Always call this tool before answering CV-related questions.`, }, func(ctx tool.Context, args QueryCVArgs) (QueryCVResult, error) { lang := args.Language @@ -128,6 +131,31 @@ Always call this tool before answering CV-related questions.`, result.TotalFound = len(cv.Awards) result.Data = mustJSON(cv.Awards) + case "search": + // Cross-section search: search across experience, projects, skills, and courses simultaneously. + crossResult := make(map[string]any) + total := 0 + + if expMatches := filterExperience(cv.Experience, q); len(expMatches) > 0 { + crossResult["experience"] = expMatches + total += len(expMatches) + } + if projMatches := filterProjects(cv.Projects, q); len(projMatches) > 0 { + crossResult["projects"] = projMatches + total += len(projMatches) + } + if skillMatches := filterSkills(cv.Skills, q); len(skillMatches) > 0 { + crossResult["skills"] = skillMatches + total += len(skillMatches) + } + if courseMatches := filterCourses(cv.Courses, q); len(courseMatches) > 0 { + crossResult["courses"] = courseMatches + total += len(courseMatches) + } + + result.TotalFound = total + result.Data = mustJSON(crossResult) + case "all": // Return a high-level overview overview := map[string]int{ diff --git a/templates/partials/layout/head-styles.html b/templates/partials/layout/head-styles.html index 8e9a612..e9de501 100644 --- a/templates/partials/layout/head-styles.html +++ b/templates/partials/layout/head-styles.html @@ -1,7 +1,14 @@ {{define "head-styles"}} - - + {{if .IsProduction}} + + {{else}} + + + {{end}} + {{if .ChatEnabled}} + + {{end}} {{end}}