From fd92918b77e36f83a8b7a59469df35f3f23a48f1 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Tue, 26 Mar 2024 21:45:53 +0100 Subject: Fix load .har files, add hardir to docker, add docs --- g4f/Provider/needs_auth/OpenaiChat.py | 2 +- g4f/Provider/openai/har_file.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'g4f') diff --git a/g4f/Provider/needs_auth/OpenaiChat.py b/g4f/Provider/needs_auth/OpenaiChat.py index b83025e4..72f9f224 100644 --- a/g4f/Provider/needs_auth/OpenaiChat.py +++ b/g4f/Provider/needs_auth/OpenaiChat.py @@ -403,7 +403,7 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin): "conversation_id": conversation_id, "parent_message_id": parent_id, "model": model, - "history_and_training_disabled": history_disabled and not auto_continue, + "history_and_training_disabled": history_disabled and not auto_continue and not return_conversation, "websocket_request_id": websocket_request_id } if action != "continue": diff --git a/g4f/Provider/openai/har_file.py b/g4f/Provider/openai/har_file.py index 379697c2..68fe7420 100644 --- a/g4f/Provider/openai/har_file.py +++ b/g4f/Provider/openai/har_file.py @@ -41,9 +41,9 @@ def readHAR(): if not harPath: raise RuntimeError("No .har file found") for path in harPath: - with open(path, 'r') as file: + with open(path, 'rb') as file: try: - harFile = json.load(file) + harFile = json.loads(file.read()) except json.JSONDecodeError: # Error: not a HAR file! continue -- cgit v1.2.3