Spaces:
Sleeping

MEH / main.py
SHIVANSHD
Final Deployment: Personal Social Memory Agent
112d4bf
Raw History Blame Contribute Delete
840 Bytes
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from typing import Dict, Any
import json, uuid, random, os
app = FastAPI(title="Personal Social Memory Agent", version="1.0.0")
DATA_PATH = os.path.join(os.path.dirname(__file__), "data", "sample_data.json")
if not os.path.exists(DATA_PATH):
os.makedirs(os.path.dirname(DATA_PATH), exist_ok=True)
with open(DATA_PATH, 'w') as df:
json.dump({"posts": [], "threads": [], "chats": []}, df)
with open(DATA_PATH) as f:
DATA = json.load(f)
@app.get("/")
def root(): return {"Status": "Active"}
@app.post("/reset")
async def reset():
return {"episode_id": str(uuid.uuid4()), "observation": "Data loaded.", "done": False}
@app.post("/step")
async def step(data: dict):
return {"reward": 1.0, "done": True, "observation": "Task complete."}