🌟 Initial project setup with backend (FastAPI), frontend (Streamlit), Milvus, and Flowise in Docker 🧱📦
* Added backend infrastructure (FastAPI, Dockerfile, requirements) * Set up frontend (Streamlit, Dockerfile, requirements) * Configured docker-compose with Milvus and Flowise services * Created project structure with .env.template and .dockerignore * Added initial gitignore and project metadata
This commit is contained in:
parent
bf9d953912
commit
0fffbcfba4
14 changed files with 217 additions and 1 deletions
12
backend/.dockerignore
Normal file
12
backend/.dockerignore
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Python build and runtime artifacts
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyo
|
||||
venv/
|
||||
requirements/
|
||||
|
||||
# Version control
|
||||
.git
|
||||
|
||||
# OS-specific files
|
||||
.DS_Store
|
17
backend/Dockerfile
Normal file
17
backend/Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Use the official Python 3.13 image as the base
|
||||
FROM python:3.13-slim
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Expose the port the app will run on
|
||||
EXPOSE 5000
|
||||
|
||||
# Copy the current directory contents into the container
|
||||
COPY . .
|
||||
|
||||
# Install dependencies (ensure you have a requirements.txt file)
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Command to run the app using Uvicorn
|
||||
CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5000"]
|
67
backend/main.py
Normal file
67
backend/main.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
from fastapi import FastAPI, APIRouter, HTTPException
|
||||
import uuid
|
||||
|
||||
app = FastAPI(title="Retro API", description="Retro content management system")
|
||||
|
||||
# Routers
|
||||
import_router = APIRouter(prefix="/import", tags=["Import"])
|
||||
analyse_router = APIRouter(prefix="/analyse", tags=["Analyse"])
|
||||
export_router = APIRouter(prefix="/export", tags=["Export"])
|
||||
generate_router = APIRouter(prefix="/generate", tags=["Generate"])
|
||||
|
||||
# Sample data storage (replace with Milvus/DB integration)
|
||||
data_store = {}
|
||||
|
||||
# Import Router
|
||||
@import_router.post("/data")
|
||||
def import_data(data: dict):
|
||||
"""
|
||||
Import data (e.g., text, files, or structured data).
|
||||
"""
|
||||
data_id = str(uuid.uuid4())
|
||||
data_store[data_id] = data
|
||||
return {"message": "Data imported successfully", "data_id": data_id}
|
||||
|
||||
# Analyse Router
|
||||
@analyse_router.get("/{data_id}")
|
||||
def analyse_data(data_id: str):
|
||||
"""
|
||||
Analyse imported data (e.g., sentiment, keywords, or patterns).
|
||||
"""
|
||||
if data_id not in data_store:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
# Placeholder for analysis logic
|
||||
return {
|
||||
"data_id": data_id,
|
||||
"analysis": {"word_count": len(data_store[data_id].get("text", ""))},
|
||||
}
|
||||
|
||||
# Export Router
|
||||
@export_router.get("/{data_id}")
|
||||
def export_data(data_id: str):
|
||||
"""
|
||||
Export analysed data (e.g., as JSON, CSV, or PDF).
|
||||
"""
|
||||
if data_id not in data_store:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return {
|
||||
"data_id": data_id,
|
||||
"content": data_store[data_id],
|
||||
"status": "exported",
|
||||
}
|
||||
|
||||
# Generate Router
|
||||
@generate_router.post("/content")
|
||||
def generate_content(prompt: str):
|
||||
"""
|
||||
Generate new content (e.g., text, images, or summaries).
|
||||
"""
|
||||
# Placeholder for generation logic (e.g., LLM, AI model)
|
||||
generated = {"response": f"Generated content based on: {prompt}"}
|
||||
return {"message": "Content generated", "data": generated}
|
||||
|
||||
# Include routers in the main app
|
||||
app.include_router(import_router)
|
||||
app.include_router(analyse_router)
|
||||
app.include_router(export_router)
|
||||
app.include_router(generate_router)
|
3
backend/requirements.txt
Normal file
3
backend/requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
fastapi
|
||||
uvicorn
|
||||
pydantic
|
1
backend/run.sh
Normal file
1
backend/run.sh
Normal file
|
@ -0,0 +1 @@
|
|||
uvicorn main:app --reload --host 0.0.0.0 --port 8000
|
Loading…
Add table
Add a link
Reference in a new issue