chore: 🚨 lint and format

This commit is contained in:
ThatOneCalculator 2024-01-03 14:33:57 -08:00
parent 037793161e
commit 07cc7f15d5
No known key found for this signature in database
GPG key ID: 8703CACD01000000
25 changed files with 190 additions and 180 deletions

View file

@ -1,11 +1,9 @@
from flask import Flask, request, Response, jsonify
from flask_cors import CORS
import requests
import json
from apps.web.models.users import Users
from constants import ERROR_MESSAGES
from utils.utils import decode_token
@ -20,7 +18,9 @@ CORS(
TARGET_SERVER_URL = OLLAMA_API_BASE_URL
@app.route("/", defaults={"path": ""}, methods=["GET", "POST", "PUT", "DELETE"])
@app.route("/",
defaults={"path": ""},
methods=["GET", "POST", "PUT", "DELETE"])
@app.route("/<path:path>", methods=["GET", "POST", "PUT", "DELETE"])
def proxy(path):
# Combine the base URL of the target server with the requested path
@ -49,13 +49,17 @@ def proxy(path):
pass
else:
return (
jsonify({"detail": ERROR_MESSAGES.ACCESS_PROHIBITED}),
jsonify({
"detail":
ERROR_MESSAGES.ACCESS_PROHIBITED
}),
401,
)
else:
pass
else:
return jsonify({"detail": ERROR_MESSAGES.ACCESS_PROHIBITED}), 401
return jsonify(
{"detail": ERROR_MESSAGES.ACCESS_PROHIBITED}), 401
else:
return jsonify({"detail": ERROR_MESSAGES.UNAUTHORIZED}), 401
else:
@ -105,12 +109,10 @@ def proxy(path):
print(res)
return (
jsonify(
{
"detail": error_detail,
"message": str(e),
}
),
jsonify({
"detail": error_detail,
"message": str(e),
}),
400,
)