apac-ops-bot/backend
SamoilenkoVadym 29e6c2e442 Implement repository pattern and chat service orchestration
Repositories (Data Access Layer):
- BaseRepository: Generic CRUD operations with async support
- UserRepository: User management, Azure AD integration
- ConversationRepository: Conversation CRUD, archiving, search
- MessageRepository: Message creation, retrieval, search
- TokenUsageRepository: Usage tracking, cost calculation, analytics

Chat Service (Business Logic):
- Complete conversation lifecycle management
- Message sending with OpenAI integration
- Multi-turn conversation support via previous_response_id
- Automatic token usage tracking
- Cost calculation per message
- Permission checks for user access
- Conversation archiving and deletion
- Token usage analytics and reporting

Key Features:
- Repository pattern for clean data access
- Async/await throughout for performance
- Proper error handling and logging
- Permission verification for user actions
- Citation validation from OpenAI responses
- Automatic cost tracking per message
- File search results stored in message metadata

Integration Points:
- OpenAIService for AI responses
- All SQLAlchemy models
- Token cost calculation from settings
- Multi-turn conversations via last_response_id

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-27 14:28:41 +00:00
..
alembic Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
app Implement repository pattern and chat service orchestration 2026-01-27 14:28:41 +00:00
tests Implement OpenAI Responses API service with RAG enforcement 2026-01-27 14:26:43 +00:00
.env.example Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
alembic.ini Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
Dockerfile Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
requirements-dev.txt Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
requirements.txt Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00