From 3eba963d030d98826e782ff9876d111c095d5bf8 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sun, 16 Jun 2024 12:38:20 -0300 Subject: [PATCH 1/2] Remove redundant logging --- backend/apps/openai/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/backend/apps/openai/main.py b/backend/apps/openai/main.py index 93f913dea..6acb08237 100644 --- a/backend/apps/openai/main.py +++ b/backend/apps/openai/main.py @@ -435,8 +435,6 @@ async def generate_chat_completion( url = app.state.config.OPENAI_API_BASE_URLS[idx] key = app.state.config.OPENAI_API_KEYS[idx] - print(payload) - headers = {} headers["Authorization"] = f"Bearer {key}" headers["Content-Type"] = "application/json" From c0c875eae28642441c9e7eed177a88b5c9973fb3 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sun, 16 Jun 2024 12:40:16 -0300 Subject: [PATCH 2/2] Use log.debug() for logging request bodies for the backend API --- backend/apps/ollama/main.py | 3 +-- backend/apps/openai/main.py | 2 +- backend/main.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/apps/ollama/main.py b/backend/apps/ollama/main.py index 144755418..c8ea6fd37 100644 --- a/backend/apps/ollama/main.py +++ b/backend/apps/ollama/main.py @@ -839,8 +839,7 @@ async def generate_chat_completion( url = app.state.config.OLLAMA_BASE_URLS[url_idx] log.info(f"url: {url}") - - print(payload) + log.debug(payload) return await post_streaming_url(f"{url}/api/chat", json.dumps(payload)) diff --git a/backend/apps/openai/main.py b/backend/apps/openai/main.py index 6acb08237..c09c030d2 100644 --- a/backend/apps/openai/main.py +++ b/backend/apps/openai/main.py @@ -430,7 +430,7 @@ async def generate_chat_completion( # Convert the modified body back to JSON payload = json.dumps(payload) - print(payload) + log.debug(payload) url = app.state.config.OPENAI_API_BASE_URLS[idx] key = app.state.config.OPENAI_API_KEYS[idx] diff --git a/backend/main.py b/backend/main.py index de8827d12..6a589528e 100644 --- a/backend/main.py +++ b/backend/main.py @@ -773,7 +773,7 @@ async def generate_title(form_data: dict, user=Depends(get_verified_user)): "title": True, } - print(payload) + log.debug(payload) try: payload = filter_pipeline(payload, user) @@ -837,7 +837,7 @@ async def generate_search_query(form_data: dict, user=Depends(get_verified_user) "max_tokens": 30, } - print(payload) + log.debug(payload) try: payload = filter_pipeline(payload, user)