converted models
This commit is contained in:
@@ -1,32 +1,45 @@
|
||||
from quart import g, abort, render_template, jsonify, websocket
|
||||
from http import HTTPStatus
|
||||
import httpx
|
||||
from collections import defaultdict
|
||||
from lnbits.decorators import check_user_exists, validate_uuids
|
||||
from . import copilot_ext
|
||||
|
||||
from .crud import get_copilot
|
||||
from quart import g, abort, render_template, jsonify, websocket
|
||||
|
||||
from functools import wraps
|
||||
import trio
|
||||
import shortuuid
|
||||
from . import copilot_ext
|
||||
|
||||
from lnbits.decorators import check_user_exists
|
||||
|
||||
from . import copilot_ext, copilot_renderer
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.params import Depends
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import HTMLResponse
|
||||
from lnbits.core.models import User
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
|
||||
@copilot_ext.route("/")
|
||||
@validate_uuids(["usr"], required=True)
|
||||
@check_user_exists()
|
||||
async def index():
|
||||
return await render_template("copilot/index.html", user=g.user)
|
||||
@copilot_ext.route("/", response_class=HTMLResponse)
|
||||
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||
return copilot_renderer().TemplateResponse(
|
||||
"copilot/index.html", {"request": request, "user": user.dict()}
|
||||
)
|
||||
|
||||
|
||||
@copilot_ext.route("/cp/")
|
||||
async def compose():
|
||||
return await render_template("copilot/compose.html")
|
||||
@copilot_ext.route("/cp/", response_class=HTMLResponse)
|
||||
async def compose(request: Request):
|
||||
return copilot_renderer().TemplateResponse(
|
||||
"copilot/compose.html", {"request": request}
|
||||
)
|
||||
|
||||
|
||||
@copilot_ext.route("/pn/")
|
||||
async def panel():
|
||||
return await render_template("copilot/panel.html")
|
||||
@copilot_ext.route("/pn/", response_class=HTMLResponse)
|
||||
async def panel(request: Request):
|
||||
return copilot_renderer().TemplateResponse(
|
||||
"copilot/panel.html", {"request": request}
|
||||
)
|
||||
|
||||
|
||||
##################WEBSOCKET ROUTES########################
|
||||
|
||||
Reference in New Issue
Block a user