Backend (FastAPI + SQLAlchemy + Claude API + RAG): - Config management with Pydantic v2 - Database engine with connection pooling and SQL injection prevention - AI engine with Claude API integration (support custom base URL) - RAG engine with ChromaDB and sentence-transformers - Requirement analysis service - Config generation service - Executor engine with SQL validation - REST API endpoints: /analyze, /generate, /execute Frontend (Vue 3 + Element Plus + Pinia): - Complete 3-step workflow: analyze → generate → execute - Step indicator with progress visualization - Analysis result display with field table - SQL preview with monospace font - Execute confirmation dialog with safety warning - Execution result display - State management with Pinia - API service integration Security: - SQL injection prevention with parameterized queries - Dangerous SQL operation blocking - Database password URL encoding - Transaction auto-rollback - Pydantic config validation Features: - Natural language requirement analysis - Automated SQL configuration generation - Safe execution with human review - LAN access support - Custom Claude API endpoint support Documentation: - README with quick start guide - Quick start guide - LAN access configuration - Dependency fixes guide - Claude API configuration - Git operation guide - Implementation report Dependencies fixed: - numpy<2.0.0 for chromadb compatibility - sentence-transformers==2.7.0 for huggingface_hub compatibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
796 B
Python
27 lines
796 B
Python
import pytest
|
|
from app.config import get_settings
|
|
|
|
|
|
@pytest.fixture
|
|
def test_settings():
|
|
"""Test settings"""
|
|
return get_settings()
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_db_engine(mocker):
|
|
"""Mock database engine"""
|
|
from app.core.db_engine import DatabaseEngine
|
|
return mocker.MagicMock(spec=DatabaseEngine)
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_ai_engine(mocker):
|
|
"""Mock AI engine with default parse_json_response behavior"""
|
|
from app.core.ai_engine import ClaudeEngine
|
|
mock_engine = mocker.MagicMock(spec=ClaudeEngine)
|
|
# Default behavior: returns a test function dict
|
|
# Can be overridden in individual tests via mock_ai_engine.parse_json_response.return_value = {...}
|
|
mock_engine.parse_json_response.return_value = {"function_name": "test_function"}
|
|
return mock_engine
|