How hasanazir1/ai-opportunity-agent works
AI Opportunity Agent is an Arabic Flask web app that turns an uploaded text-based CV into ranked job matches, then lets the user explore results and request job-specific help. Its main workflow extracts CV text, analyzes it, embeds the profile, fetches jobs, ranks candidates by cosine similarity, and asks an LLM to score shortlisted matches; saved results and progress appear in the browser. Separate chat roles answer questions, suggest CV edits, and draft cover letters. The graph reflects README capabilities; omitted app code limits certainty about some internal call details.
Main entry points: app.py Flask workflow · llm_service.py Chat model client · db.py SQLite data access · prompts.py Role prompts
Components 20
Web interface
- Arabic interface
flask_app/templates/index.html - Browser client
flask_app/static/js/main.js - Flask workflow
flask_app/app.py - Live progress events
flask_app/app.py
CV and matching
- PDF extraction
flask_app/utils/pdf_parser.py - CV analysis expert
flask_app/agents/cv_analyzer.py - Embedding service
flask_app/utils/embedding_service.py - Job feed and fallback
flask_app/utils/jobs_fetcher.py - Semantic shortlist
flask_app/utils/embedding_service.py - Match scoring expert
flask_app/agents/match_scorer.py
Chat assistance
- Chat orchestrator
flask_app/agents/chat_orchestrator.py - Chat query expert
flask_app/agents/chat_query.py - CV improvement expert
flask_app/agents/cv_improvement.py - Cover letter expert
flask_app/agents/cover_letter.py
Integrations and storage
- Role prompts
flask_app/utils/prompts.py - Chat model client
flask_app/utils/llm_service.py - SQLite data access
flask_app/database/db.py
Other components
- CV user
- Jobs.ps RSS
- OpenRouter API
Connections 40
- CV user → Arabic interface: uploads CV
- Arabic interface → Browser client: submits actions
- Browser client → Flask workflow: sends requests
- Flask workflow → PDF extraction: extracts text
- Flask workflow → SQLite data access: creates profile
- Flask workflow → CV analysis expert: analyzes CV
- CV analysis expert → Role prompts: builds prompt
- CV analysis expert → Chat model client: requests analysis
- Flask workflow → Embedding service: embeds profile
- Flask workflow → Job feed and fallback: fetches listings
- Job feed and fallback → Jobs.ps RSS: reads feed
- Job feed and fallback → SQLite data access: reads cached jobs
- Flask workflow → SQLite data access: stores profile analysis
- Flask workflow → Semantic shortlist: ranks job vectors
- Semantic shortlist → Embedding service: creates missing vectors
- Semantic shortlist → SQLite data access: reads and saves vectors
- Flask workflow → Match scoring expert: evaluates shortlist
- Match scoring expert → Role prompts: builds prompt
- Match scoring expert → Chat model client: scores match
- Flask workflow → SQLite data access: saves match results
- Flask workflow → Live progress events: emits status
- Live progress events → Browser client: streams updates
- Flask workflow → Chat orchestrator: routes free message
- Flask workflow → Chat query expert: handles direct question
- Flask workflow → CV improvement expert: handles CV request
- Flask workflow → Cover letter expert: handles letter request
- Chat orchestrator → Role prompts: builds prompt
- Chat orchestrator → Chat model client: selects expert
- Chat query expert → SQLite data access: reads saved matches
- Chat query expert → Role prompts: builds prompt
- Chat query expert → Chat model client: answers question
- CV improvement expert → Role prompts: builds prompt
- CV improvement expert → Chat model client: suggests edits
- Cover letter expert → SQLite data access: reads role settings
- Cover letter expert → Role prompts: builds prompt
- Cover letter expert → Chat model client: drafts letter
- Chat model client → OpenRouter API: sends completion
- Embedding service → OpenRouter API: requests vectors
- Chat model client → Browser client: returns assistant text
- SQLite data access → Browser client: serves saved results