Spaces:
Sleeping
Sleeping
JerameeUC
16th Commit added the ability to Auto-document, and a file that explains how to run it named AutoDoc_README.md
d53c2a8 Download anon_bot/app.py from ucGroupProj/Agentic-Chat-bot: direct link, hf CLI and curl.
- Browser
- Download file 821 Bytes
-
https://huggingface.co/spaces/ucGroupProj/Agentic-Chat-bot/resolve/main/anon_bot/app.py
- Command line
-
hf download hf://spaces/ucGroupProj/Agentic-Chat-bot/anon_bot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ucGroupProj/Agentic-Chat-bot/resolve/main/anon_bot/app.py
821 Bytes
| from fastapi import FastAPI | |
| from fastapi.responses import JSONResponse | |
| from .schemas import MessageIn, MessageOut | |
| from .guardrails import enforce_guardrails | |
| from .rules import route | |
| app = FastAPI(title='Anonymous Rule-Based Bot', version='1.0') | |
| # No sessions, cookies, or user IDs — truly anonymous and stateless. | |
| # No logging of raw user input here (keeps it anonymous and reduces risk). | |
| def message(inbound: MessageIn): | |
| ok, cleaned_or_reason = enforce_guardrails(inbound.message) | |
| if not ok: | |
| return JSONResponse(status_code=200, | |
| content={'reply': cleaned_or_reason, 'blocked': True}) | |
| # Rule-based reply (deterministic: no persistence) | |
| reply = route(cleaned_or_reason) | |
| return {'reply': reply, 'blocked': False} |