"""Application definition.""" from zipfile import ZipExtFile from bocadillo import App, discover_providers from . import illnesses, precautions import json from datetime import date, datetime from random import choice app = App() discover_providers("lepios_project_backend.providerconf") # Create routes here. feedback = [ "Okay what else are you experiencing? It helps when you describe it a bit clear", "Interesting, what might you be feeling?", "Oh I see, so what else are you feeling?", "Do tell if you have more symptoms", ] def sendMessage(message=None, choices=None, information=None): if message: sendingJSON = { "type": "message", "content": message, "sender": "bot", "timestamp": str(datetime.now()), } return json.dumps(sendingJSON) elif choices:
from bocadillo import App, configure, discover_providers from . import settings from .router import router discover_providers("server.providerconf") app = App() app.include_router(router) configure(app, settings)
"""Application definition.""" from bocadillo import App, discover_providers app = App() discover_providers("chatbot.providerconf") @app.websocket_route("/conversation") async def converse(ws, diego, save_client): with save_client(ws): async for message in ws: response = diego.get_response(message) await ws.send(str(response)) @app.route("/client-count") async def client_count(req, res, clients): res.json = {"count": len(clients)}
"""Application definition.""" from bocadillo import App, discover_providers, Templates, settings from tortoise import Tortoise from tortoise.query_utils import Q from .models import BookSummary from .pagination import Pagination app = App() templates = Templates(app) discover_providers("librarian.providerconf") @app.on("startup") async def init_db(): await Tortoise.init(db_url=str(settings.get("DATABASE_URL")), modules={"models": ["librarian.models"]}) await Tortoise.generate_schemas() @app.on("shutdown") async def db_cleanup(): await Tortoise.close_connections() @app.route("/") async def index(req, res): res.html = await templates.render("index.html") @app.route("/search")