snapshot: production hotfixes on beast before v3 migration
This commit is contained in:
parent
82accabc73
commit
3f5b84998d
3 changed files with 37 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Dict, Any, Optional
|
from typing import List, Dict, Any, Optional
|
||||||
|
|
@ -9,7 +10,8 @@ from contextlib import asynccontextmanager
|
||||||
|
|
||||||
from fastapi import FastAPI, HTTPException, BackgroundTasks, Depends, Security, Request
|
from fastapi import FastAPI, HTTPException, BackgroundTasks, Depends, Security, Request
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.responses import JSONResponse, StreamingResponse
|
from fastapi.responses import JSONResponse, StreamingResponse, FileResponse
|
||||||
|
from fastapi.staticfiles import StaticFiles
|
||||||
import structlog
|
import structlog
|
||||||
import asyncio
|
import asyncio
|
||||||
from slowapi import Limiter, _rate_limit_exceeded_handler
|
from slowapi import Limiter, _rate_limit_exceeded_handler
|
||||||
|
|
@ -916,6 +918,29 @@ except Exception as e:
|
||||||
logger.error(f"Failed to mount MCP server: {e}")
|
logger.error(f"Failed to mount MCP server: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
# Serve frontend static files
|
||||||
|
# This must be AFTER all API routes to avoid catching API requests
|
||||||
|
FRONTEND_DIR = "/app/frontend"
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
async def serve_frontend_root():
|
||||||
|
"""Serve the frontend application."""
|
||||||
|
index_path = os.path.join(FRONTEND_DIR, "index.html")
|
||||||
|
if os.path.exists(index_path):
|
||||||
|
return FileResponse(index_path)
|
||||||
|
return JSONResponse(
|
||||||
|
status_code=404,
|
||||||
|
content={"error": "Frontend not found", "path": index_path}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Mount static files for any assets in the frontend directory (CSS, JS, images, etc.)
|
||||||
|
if os.path.exists(FRONTEND_DIR):
|
||||||
|
app.mount("/static", StaticFiles(directory=FRONTEND_DIR), name="static")
|
||||||
|
logger.info(f"Frontend static files mounted from {FRONTEND_DIR}")
|
||||||
|
else:
|
||||||
|
logger.warning(f"Frontend directory not found at {FRONTEND_DIR}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,11 @@ class Mem0Manager:
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"embedder": {
|
"embedder": {
|
||||||
"provider": "ollama",
|
"provider": "openai",
|
||||||
"config": {
|
"config": {
|
||||||
"model": settings.embedding_model,
|
"model": settings.embedding_model,
|
||||||
"ollama_base_url": settings.ollama_base_url,
|
"api_key": settings.openai_api_key,
|
||||||
|
"openai_base_url": settings.openai_base_url,
|
||||||
"embedding_dims": settings.embedding_dims,
|
"embedding_dims": settings.embedding_dims,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ services:
|
||||||
|
|
||||||
# Neo4j with APOC for graph relationships
|
# Neo4j with APOC for graph relationships
|
||||||
neo4j:
|
neo4j:
|
||||||
image: neo4j:5.26.4
|
image: neo4j:latest
|
||||||
container_name: mem0-neo4j
|
container_name: mem0-neo4j
|
||||||
environment:
|
environment:
|
||||||
NEO4J_AUTH: ${NEO4J_AUTH:-neo4j/mem0_neo4j_password}
|
NEO4J_AUTH: ${NEO4J_AUTH:-neo4j/mem0_neo4j_password}
|
||||||
|
|
@ -82,6 +82,12 @@ services:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
neo4j:
|
neo4j:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||||
|
interval: 30m
|
||||||
|
timeout: 30s
|
||||||
|
retries: 3
|
||||||
|
start_period: 10s
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend:/app
|
- ./backend:/app
|
||||||
|
|
@ -96,6 +102,6 @@ volumes:
|
||||||
neo4j_plugins:
|
neo4j_plugins:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
mem0_network:
|
|
||||||
npm_network:
|
npm_network:
|
||||||
external: true
|
external: true
|
||||||
|
mem0_network:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue