Spaces:
Sleeping
Sleeping
Đỗ Hải Nam commited on
Commit ·
a172898
1
Parent(s): 3f03efa
chore: setup project infrastructure and configuration
Browse files- .env.example +10 -0
- .gitignore +80 -0
- .python-version +1 -0
- Dockerfile +38 -0
- pyproject.toml +47 -0
- pytest.ini +7 -0
- uv.lock +0 -0
.env.example
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Groq API Key (required)
|
| 2 |
+
GROQ_API_KEY=your_groq_api_key_here
|
| 3 |
+
|
| 4 |
+
# Wolfram Alpha App ID (required for Wolfram tool)
|
| 5 |
+
WOLFRAM_ALPHA_APP_ID=your_wolfram_alpha_app_id_here
|
| 6 |
+
|
| 7 |
+
# LangSmith Tracing (optional but recommended)
|
| 8 |
+
LANGSMITH_API_KEY=your_langsmith_api_key_here
|
| 9 |
+
LANGSMITH_PROJECT=algebra-chatbot
|
| 10 |
+
LANGSMITH_TRACING=true
|
.gitignore
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# === System & IDE ===
|
| 2 |
+
.DS_Store
|
| 3 |
+
.idea/
|
| 4 |
+
.vscode/
|
| 5 |
+
*.swp
|
| 6 |
+
*.swo
|
| 7 |
+
|
| 8 |
+
# === Environment & Secrets ===
|
| 9 |
+
.env
|
| 10 |
+
.env.*
|
| 11 |
+
!.env.example
|
| 12 |
+
venv/
|
| 13 |
+
.venv/
|
| 14 |
+
env/
|
| 15 |
+
.Python
|
| 16 |
+
|
| 17 |
+
# === Python ===
|
| 18 |
+
__pycache__/
|
| 19 |
+
*.py[oc]
|
| 20 |
+
build/
|
| 21 |
+
dist/
|
| 22 |
+
wheels/
|
| 23 |
+
*.egg-info/
|
| 24 |
+
.mypy_cache/
|
| 25 |
+
.dmypy.json
|
| 26 |
+
dmypy.json
|
| 27 |
+
|
| 28 |
+
# === Database & Data ===
|
| 29 |
+
*.db
|
| 30 |
+
*.sqlite
|
| 31 |
+
*.sqlite3
|
| 32 |
+
data/
|
| 33 |
+
!data/.gitkeep
|
| 34 |
+
# Exclude model weights or large files
|
| 35 |
+
*.pth
|
| 36 |
+
*.pt
|
| 37 |
+
*.bin
|
| 38 |
+
|
| 39 |
+
# === Logs ===
|
| 40 |
+
*.log
|
| 41 |
+
logs/
|
| 42 |
+
npm-debug.log*
|
| 43 |
+
yarn-debug.log*
|
| 44 |
+
yarn-error.log*
|
| 45 |
+
|
| 46 |
+
# === Frontend (Node.js/React) ===
|
| 47 |
+
node_modules/
|
| 48 |
+
frontend/node_modules/
|
| 49 |
+
frontend/dist/
|
| 50 |
+
frontend/build/
|
| 51 |
+
frontend/.eslintcache
|
| 52 |
+
frontend/coverage/
|
| 53 |
+
|
| 54 |
+
# === Testing & Quality Assurance ===
|
| 55 |
+
# Pytest
|
| 56 |
+
.pytest_cache/
|
| 57 |
+
.test_caches/
|
| 58 |
+
.wolfram_cache/
|
| 59 |
+
.test_wolfram_*/
|
| 60 |
+
.test_cache_*/
|
| 61 |
+
.cache/
|
| 62 |
+
.session_memory/
|
| 63 |
+
|
| 64 |
+
# Coverage
|
| 65 |
+
.coverage
|
| 66 |
+
.coverage.*
|
| 67 |
+
htmlcov/
|
| 68 |
+
coverage.xml
|
| 69 |
+
*.cover
|
| 70 |
+
|
| 71 |
+
# Test Results
|
| 72 |
+
# Test Results
|
| 73 |
+
backend/tests/debug_*.py
|
| 74 |
+
backend/tests/set_memory_*.py
|
| 75 |
+
test_results.txt
|
| 76 |
+
test-reports/
|
| 77 |
+
junit/
|
| 78 |
+
|
| 79 |
+
# some locals file
|
| 80 |
+
note.md
|
.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.11
|
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# Install Node.js for frontend build
|
| 6 |
+
RUN apt-get update && apt-get install -y curl && \
|
| 7 |
+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 8 |
+
apt-get install -y nodejs && \
|
| 9 |
+
apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Install uv
|
| 12 |
+
RUN pip install uv
|
| 13 |
+
|
| 14 |
+
# Copy Python dependencies
|
| 15 |
+
COPY pyproject.toml uv.lock* ./
|
| 16 |
+
RUN uv sync --frozen || uv sync
|
| 17 |
+
|
| 18 |
+
# Copy frontend and build
|
| 19 |
+
COPY frontend/ ./frontend/
|
| 20 |
+
WORKDIR /app/frontend
|
| 21 |
+
RUN npm ci && npm run build
|
| 22 |
+
|
| 23 |
+
# Copy backend
|
| 24 |
+
WORKDIR /app
|
| 25 |
+
COPY backend/ ./backend/
|
| 26 |
+
|
| 27 |
+
# Create data directory for SQLite
|
| 28 |
+
RUN mkdir -p /data
|
| 29 |
+
|
| 30 |
+
# Set environment variables
|
| 31 |
+
ENV DATABASE_URL=sqlite+aiosqlite:///data/algebra_chat.db
|
| 32 |
+
ENV PYTHONPATH=/app
|
| 33 |
+
|
| 34 |
+
# Expose port
|
| 35 |
+
EXPOSE 7860
|
| 36 |
+
|
| 37 |
+
# Run the application
|
| 38 |
+
CMD ["uv", "run", "uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
pyproject.toml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[project]
|
| 2 |
+
name = "calculus-chatbot"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = "Simple agent for calculus problem solving"
|
| 5 |
+
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.11"
|
| 7 |
+
dependencies = [
|
| 8 |
+
"aiosqlite>=0.22.1",
|
| 9 |
+
"cvxpy>=1.7.5",
|
| 10 |
+
"diskcache>=5.6.3",
|
| 11 |
+
"fastapi>=0.127.1",
|
| 12 |
+
"greenlet>=3.3.0",
|
| 13 |
+
"httpx>=0.28.1",
|
| 14 |
+
"langchain>=1.2.0",
|
| 15 |
+
"langchain-groq>=1.1.1",
|
| 16 |
+
"langgraph>=1.0.5",
|
| 17 |
+
"langsmith>=0.1.0",
|
| 18 |
+
"matplotlib>=3.10.8",
|
| 19 |
+
"mpmath>=1.3.0",
|
| 20 |
+
"networkx>=3.6.1",
|
| 21 |
+
"numexpr>=2.14.1",
|
| 22 |
+
"numpy>=2.4.0",
|
| 23 |
+
"pandas>=2.3.3",
|
| 24 |
+
"pillow>=12.0.0",
|
| 25 |
+
"pint>=0.25.2",
|
| 26 |
+
"plotly>=6.5.0",
|
| 27 |
+
"polars>=1.36.1",
|
| 28 |
+
"pulp>=3.3.0",
|
| 29 |
+
"python-dotenv>=1.2.1",
|
| 30 |
+
"python-multipart>=0.0.21",
|
| 31 |
+
"pywavelets>=1.9.0",
|
| 32 |
+
"scikit-learn>=1.8.0",
|
| 33 |
+
"scipy>=1.16.3",
|
| 34 |
+
"seaborn>=0.13.2",
|
| 35 |
+
"sqlalchemy>=2.0.45",
|
| 36 |
+
"statsmodels>=0.14.6",
|
| 37 |
+
"sympy>=1.14.0",
|
| 38 |
+
"uncertainties>=3.2.3",
|
| 39 |
+
"uvicorn>=0.40.0",
|
| 40 |
+
]
|
| 41 |
+
|
| 42 |
+
[dependency-groups]
|
| 43 |
+
dev = [
|
| 44 |
+
"httpx>=0.28.1",
|
| 45 |
+
"pytest>=9.0.2",
|
| 46 |
+
"pytest-asyncio>=1.3.0",
|
| 47 |
+
]
|
pytest.ini
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[tool.pytest.ini_options]
|
| 2 |
+
asyncio_mode = "auto"
|
| 3 |
+
testpaths = ["backend/tests"]
|
| 4 |
+
python_files = "test_*.py"
|
| 5 |
+
python_classes = "Test*"
|
| 6 |
+
python_functions = "test_*"
|
| 7 |
+
asyncio_default_fixture_loop_scope = "function"
|
uv.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|