diff --git a/api/files.py b/api/files.py index 8fcafbf..2ec0b2c 100644 --- a/api/files.py +++ b/api/files.py @@ -1,6 +1,6 @@ -import base64 import io +import pybase64 from PIL import Image from utils.Client import Client @@ -9,7 +9,7 @@ from utils.Client import Client async def get_file_content(url): if url.startswith("data:"): mime_type, base64_data = url.split(';')[0].split(':')[1], url.split(',')[1] - file_content = base64.b64decode(base64_data) + file_content = pybase64.b64decode(base64_data) return file_content, mime_type else: client = Client() diff --git a/chatgpt/chatFormat.py b/chatgpt/chatFormat.py index e677e9c..2436bf8 100644 --- a/chatgpt/chatFormat.py +++ b/chatgpt/chatFormat.py @@ -1,11 +1,11 @@ import asyncio -import base64 import json import random import string import time import uuid +import pybase64 import websockets from api.files import get_file_content @@ -76,7 +76,7 @@ async def wss_stream_response(websocket, conversation_id): data = resultObj.get("data", {}) if conversation_id != data.get("conversation_id", ""): continue - decoded_bytes = base64.b64decode(data.get("body", None)) + decoded_bytes = pybase64.b64decode(data.get("body", None)) yield decoded_bytes else: print("No message received within the specified time.") diff --git a/chatgpt/proofofWork.py b/chatgpt/proofofWork.py index 99258ea..422fe4b 100644 --- a/chatgpt/proofofWork.py +++ b/chatgpt/proofofWork.py @@ -1,4 +1,3 @@ -import base64 import hashlib import json import random @@ -362,7 +361,7 @@ def generate_answer(seed, diff, config): if hash_value[:diff_len] <= target_diff: return base_encode.decode() - return "wQ8Lk5FbGpA2NcR9dShT6gYjU7VxZ4D" + base64.b64encode(f'"{seed}"'.encode()).decode() + return "wQ8Lk5FbGpA2NcR9dShT6gYjU7VxZ4D" + pybase64.b64encode(f'"{seed}"'.encode()).decode() def get_requirements_token(config):