mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 21:29:13 +00:00
Add additional log lines
This commit is contained in:
@@ -1217,9 +1217,22 @@ def scheduled_chat(
|
|||||||
token = token[0].token
|
token = token[0].token
|
||||||
headers["Authorization"] = f"Bearer {token}"
|
headers["Authorization"] = f"Bearer {token}"
|
||||||
|
|
||||||
|
# Log request details
|
||||||
|
logger.info(f"POST URL: {url}")
|
||||||
|
logger.info(f"Headers: {headers}")
|
||||||
|
logger.info(f"Payload: {json_payload}")
|
||||||
|
|
||||||
# Call the chat API endpoint with authenticated user token and query
|
# Call the chat API endpoint with authenticated user token and query
|
||||||
raw_response = requests.post(url, headers=headers, json=json_payload)
|
raw_response = requests.post(url, headers=headers, json=json_payload)
|
||||||
|
|
||||||
|
# Log response details
|
||||||
|
logger.info(f"Response status code: {raw_response.status_code}")
|
||||||
|
logger.info(f"Response headers: {raw_response.headers}")
|
||||||
|
logger.info(f"Response text: {raw_response.text}")
|
||||||
|
if raw_response.history:
|
||||||
|
for resp in raw_response.history:
|
||||||
|
logger.info(f"Redirected from {resp.url} with status code {resp.status_code}")
|
||||||
|
|
||||||
# Stop if the chat API call was not successful
|
# Stop if the chat API call was not successful
|
||||||
if raw_response.status_code != 200:
|
if raw_response.status_code != 200:
|
||||||
logger.error(f"Failed to run schedule chat: {raw_response.text}, user: {user}, query: {query_to_run}")
|
logger.error(f"Failed to run schedule chat: {raw_response.text}, user: {user}, query: {query_to_run}")
|
||||||
|
|||||||
Reference in New Issue
Block a user