CoolFace
Apppublic

Nephalem/llama-cpp-telegram_bot

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
main.py34 linesDownload Raw Back to app
1from fastapi import FastAPI2from dotenv import load_dotenv3import os4 5from .llamabot import telegram_ui6 7load_dotenv()8 9app = FastAPI(title="Telegram Bot LLM")10 11 12@app.on_event("startup")13async def startup() -> None:14    token = os.getenv("TELEGRAM_TOKEN")15    if not token:16        raise RuntimeError("TELEGRAM_TOKEN is required")17    await telegram_ui.run(token)18 19 20@app.on_event("shutdown")21async def shutdown() -> None:22    await telegram_ui.stop()23 24 25@app.get("/")26async def root() -> dict:27    return {"status": "running"}28 29 30if __name__ == "__main__":31    import uvicorn32 33    uvicorn.run(app, host="0.0.0.0", port=7860)34