Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DB_USER=
DB_PASSWORD=
DB_NAME=
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# --- Environment and Secrets ---
.env
.env.local
.env.*.local
venv/
env/
ENV/

# --- Python (Backend) ---
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
.python-version
backend/__pycache__/

# --- Node.js (Frontend) ---
node_modules/
build/
dist/
.next/
.npm
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# --- Docker ---
.docker-postgres/
postgres_data/
qdrant_storage/

# --- System and IDE ---
.vscode/
!.vscode/extensions.json
.idea/
.DS_Store
Thumbs.db
*.swp
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# --- Logs ---
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
**Telemach** to zaawansowany system wspomagania podróży, który łączy funkcje klasycznego planera turystycznego z dynamicznym systemem zarządzania kryzysowego. Podczas gdy inne aplikacje pokazują, gdzie zjeść obiad, Telemach dba o to, abyś miał jak wrócić do domu, gdy sytuacja na świecie ulegnie zmianie.

## Zespół:
- Jakub Dobrzański - Kierownik zespołu, Machine learning, Devops (272558@student.pwr.edu.pl)
- Bartłomiej Kuk - Frontend
- Jakub Dobrzański - Kierownik zespołu, Machine learning (272558@student.pwr.edu.pl)
- Bartłomiej Kuk - Devops, Full-stack (272497@student.pwr.edu.pl)
- Mateusz Andrzejewski - Backend

## 1. Opis działania i schemat logiczny
Expand Down
6 changes: 6 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
66 changes: 66 additions & 0 deletions backend/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
from fastapi import FastAPI, Depends
from fastapi.middleware.cors import CORSMiddleware
from sqlalchemy import create_engine, Column, Integer, String, Text, text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, Session
import os

DB_URL = os.getenv("DATABASE_URL", "postgresql://user:password@postgres:5432/tellmach")

engine = create_engine(
DB_URL,
pool_pre_ping=True,
connect_args={"connect_timeout": 10}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
app = FastAPI(title="teLLMach API")

allowed_origins = [
origin.strip()
for origin in os.getenv("CORS_ORIGINS", "http://localhost:5173,http://127.0.0.1:5173").split(",")
if origin.strip()
]

app.add_middleware(
CORSMiddleware,
allow_origins=allowed_origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True, nullable=False)
hashed_password = Column(Text, nullable=False)

Base.metadata.create_all(bind=engine)

def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()

@app.get("/")
def read_root():
return {"message": "Welcome to teLLMach API", "status": "connected"}

@app.get("/health-check")
def health_check(db: Session = Depends(get_db)):
try:
db.execute(text("SELECT 1"))
return {"database": "online", "qdrant": "check http://tellmach_vector:6333/dashboard"}
except Exception as e:
return {"database": "offline", "error": str(e)}

@app.get("/api/test-connection")
async def test_connection():
return {
"status": "success",
"message": "Connection to teLLMach API successful",
"version": "1.0.0"
}
7 changes: 7 additions & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fastapi==0.109.0
uvicorn[standard]==0.27.0
sqlalchemy==2.0.25
psycopg2-binary==2.9.9
qdrant-client==1.7.3
python-multipart==0.0.6
pydantic-settings==2.1.0
56 changes: 56 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
services:
postgres:
image: postgres:15-alpine
container_name: tellmach_db
restart: always
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- tellmach_network
qdrant:
image: qdrant/qdrant:latest
container_name: tellmach_vector
restart: always
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_storage:/qdrant/storage
networks:
- tellmach_network
backend:
build: ./backend
container_name: tellmach_app_backend
ports:
- "8000:8000"
volumes:
- ./backend:/app
environment:
- DATABASE_URL=postgresql://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}
depends_on:
- postgres
networks:
- tellmach_network
frontend:
build: ./frontend
container_name: tellmach_ui
ports:
- "5173:5173"
volumes:
- ./frontend:/app
- /app/node_modules # To chroni biblioteki wewnątrz kontenera
networks:
- tellmach_network
networks:
tellmach_network:
driver: bridge

volumes:
postgres_data:
qdrant_storage:
7 changes: 7 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npm", "run", "dev", "--", "--host"]
23 changes: 23 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])
13 changes: 13 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>frontend</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading