Browse Source

Merge pull request #3217 from theasp/better-body-logging

chore: Log API request bodies at debug level
Timothy Jaeryang Baek 10 months ago
parent
commit
c8418da8c1
3 changed files with 4 additions and 7 deletions
  1. 1 2
      backend/apps/ollama/main.py
  2. 1 3
      backend/apps/openai/main.py
  3. 2 2
      backend/main.py

+ 1 - 2
backend/apps/ollama/main.py

@@ -850,8 +850,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))
 

+ 1 - 3
backend/apps/openai/main.py

@@ -430,13 +430,11 @@ 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]
 
-    print(payload)
-
     headers = {}
     headers["Authorization"] = f"Bearer {key}"
     headers["Content-Type"] = "application/json"

+ 2 - 2
backend/main.py

@@ -776,7 +776,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)
@@ -905,7 +905,7 @@ Message: """{{prompt}}"""
         "task": True,
     }
 
-    print(payload)
+    log.debug(payload)
 
     try:
         payload = filter_pipeline(payload, user)