x-api-key fix
This commit is contained in:
parent
859458efdf
commit
8f9afa0950
2 changed files with 9 additions and 1 deletions
|
|
@ -57,9 +57,14 @@ async def async_response_stream(client, prompt: str, model: str, extra_headers:
|
|||
}
|
||||
if previous_response_id is not None:
|
||||
request_params["previous_response_id"] = previous_response_id
|
||||
|
||||
if "x-api-key" not in client.default_headers:
|
||||
if hasattr(client, 'api_key') and extra_headers is not None:
|
||||
extra_headers["x-api-key"] = client.api_key
|
||||
|
||||
if extra_headers:
|
||||
request_params["extra_headers"] = extra_headers
|
||||
|
||||
|
||||
response = await client.responses.create(**request_params)
|
||||
|
||||
full_response = ""
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ async def langflow_endpoint(request: Request, chat_service, session_manager):
|
|||
return JSONResponse(result)
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
print(f"[ERROR] Langflow request failed: {str(e)}")
|
||||
return JSONResponse({"error": f"Langflow request failed: {str(e)}"}, status_code=500)
|
||||
|
||||
async def chat_history_endpoint(request: Request, chat_service, session_manager):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue