Spaces:
Sleeping
Sleeping
Download adsp/fe/chat_frontend.py from thanhnv2323/humanize-text-python: direct link, hf CLI and curl.
- Browser
- Download file 600 Bytes
-
https://huggingface.co/spaces/thanhnv2323/humanize-text-python/resolve/main/adsp/fe/chat_frontend.py
- Command line
-
hf download hf://spaces/thanhnv2323/humanize-text-python/adsp/fe/chat_frontend.py
-
curl -L -o chat_frontend.py https://huggingface.co/spaces/thanhnv2323/humanize-text-python/resolve/main/adsp/fe/chat_frontend.py
600 Bytes
| """Stub FE layer representing the user-facing chat application.""" | |
| from __future__ import annotations | |
| from dataclasses import dataclass | |
| from adsp.app import QAService, AuthService | |
| class ChatFrontend: | |
| """Very small abstraction that wires auth and the QA service.""" | |
| qa_service: QAService | |
| auth_service: AuthService | |
| def send_message(self, user: str, token: str, persona_id: str, message: str) -> str: | |
| if not self.auth_service.is_authorized(user, token): | |
| return "Unauthorized" | |
| return self.qa_service.ask(persona_id=persona_id, query=message) | |