mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
refac
This commit is contained in:
@@ -221,10 +221,11 @@ async def generate_function_chat_completion(
|
|||||||
|
|
||||||
oauth_token = None
|
oauth_token = None
|
||||||
try:
|
try:
|
||||||
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
if request.cookies.get("oauth_session_id", None):
|
||||||
user.id,
|
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
||||||
request.cookies.get("oauth_session_id", None),
|
user.id,
|
||||||
)
|
request.cookies.get("oauth_session_id", None),
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"Error getting OAuth token: {e}")
|
log.error(f"Error getting OAuth token: {e}")
|
||||||
|
|
||||||
|
|||||||
@@ -1418,14 +1418,6 @@ async def chat_completion(
|
|||||||
model_item = form_data.pop("model_item", {})
|
model_item = form_data.pop("model_item", {})
|
||||||
tasks = form_data.pop("background_tasks", None)
|
tasks = form_data.pop("background_tasks", None)
|
||||||
|
|
||||||
oauth_token = None
|
|
||||||
try:
|
|
||||||
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
|
||||||
user.id, request.cookies.get("oauth_session_id", None)
|
|
||||||
)
|
|
||||||
except Exception as e:
|
|
||||||
log.error(f"Error getting OAuth token: {e}")
|
|
||||||
|
|
||||||
metadata = {}
|
metadata = {}
|
||||||
try:
|
try:
|
||||||
if not model_item.get("direct", False):
|
if not model_item.get("direct", False):
|
||||||
|
|||||||
@@ -171,10 +171,11 @@ def get_headers_and_cookies(
|
|||||||
|
|
||||||
oauth_token = None
|
oauth_token = None
|
||||||
try:
|
try:
|
||||||
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
if request.cookies.get("oauth_session_id", None):
|
||||||
user.id,
|
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
||||||
request.cookies.get("oauth_session_id", None),
|
user.id,
|
||||||
)
|
request.cookies.get("oauth_session_id", None),
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"Error getting OAuth token: {e}")
|
log.error(f"Error getting OAuth token: {e}")
|
||||||
|
|
||||||
|
|||||||
@@ -817,10 +817,11 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
|
|
||||||
oauth_token = None
|
oauth_token = None
|
||||||
try:
|
try:
|
||||||
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
if request.cookies.get("oauth_session_id", None):
|
||||||
user.id,
|
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
||||||
request.cookies.get("oauth_session_id", None),
|
user.id,
|
||||||
)
|
request.cookies.get("oauth_session_id", None),
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"Error getting OAuth token: {e}")
|
log.error(f"Error getting OAuth token: {e}")
|
||||||
|
|
||||||
@@ -1496,10 +1497,11 @@ async def process_chat_response(
|
|||||||
|
|
||||||
oauth_token = None
|
oauth_token = None
|
||||||
try:
|
try:
|
||||||
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
if request.cookies.get("oauth_session_id", None):
|
||||||
user.id,
|
oauth_token = request.app.state.oauth_manager.get_oauth_token(
|
||||||
request.cookies.get("oauth_session_id", None),
|
user.id,
|
||||||
)
|
request.cookies.get("oauth_session_id", None),
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"Error getting OAuth token: {e}")
|
log.error(f"Error getting OAuth token: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user