import uvicorn from fastapi import FastAPI, Form from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from app.services.llm_service import ask_llm app = FastAPI() # Mount the static directory to serve local image assets securely app.mount("/static", StaticFiles(directory="app/static"), name="static") CHAT_HTML = """ Virtual Agent
Z Virtual Agent Logo

Virtual Agent

Intelligent automation and knowledge retrieval framework for Z Logistics operations. Ask questions regarding company SOPs, driver policies, onboarding protocols, and compliance directives.

""" @app.get("/", response_class=HTMLResponse) def home(): return CHAT_HTML @app.get("/chat", response_class=HTMLResponse) def chat_page(): return CHAT_HTML @app.post("/api/chat") def api_chat(message: str = Form(...)): bot_response = ask_llm(message) return { "response": bot_response } if __name__ == "__main__": uvicorn.run("app.main:app", host="0.0.0.0", port=7860, reload=False)