Backend: receipt upload -> LLM vision extraction (OpenAI-compatible, provider-agnostic), item review/edit, per-group splitting against Cospend projects/members, highlight+upload via WebDAV, public share link, bill creation via Cospend's OCS API (verified against real source, not just doc summaries). Frontend: capture -> review -> group -> summary flow as an installable PWA. install.sh / run.sh (venv + npm, tmux session) instead of Docker, per the ~/Projects/gain pattern.
28 lines
683 B
Python
28 lines
683 B
Python
import os
|
|
|
|
from flask import Flask
|
|
from flask_cors import CORS
|
|
|
|
from .config import Config
|
|
from .db import init_db
|
|
|
|
|
|
def create_app() -> Flask:
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
app.config.from_object(Config)
|
|
|
|
os.makedirs(app.instance_path, exist_ok=True)
|
|
os.makedirs(Config.UPLOAD_DIR, exist_ok=True)
|
|
|
|
# Frontend runs on a different origin (vite dev server) during
|
|
# development; lock this down to that origin in production.
|
|
CORS(app, resources={r"/api/*": {"origins": Config.CORS_ORIGIN}})
|
|
|
|
init_db(Config.DATABASE_PATH)
|
|
|
|
from .routes import bp as api_bp
|
|
|
|
app.register_blueprint(api_bp, url_prefix="/api")
|
|
|
|
return app
|