From cadc507fad2fee59b23d1d8e73c472c077f468fc Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sat, 18 Nov 2023 04:38:31 +0100 Subject: Add AiChatOnline, ChatgptDemoAi, ChatgptNext Providers Add OnlineGpt and TalkAi Provider Add get_random_string and get_random_hex helper Remove funcaptcha package --- g4f/Provider/NoowAi.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'g4f/Provider/NoowAi.py') diff --git a/g4f/Provider/NoowAi.py b/g4f/Provider/NoowAi.py index c337514a..dba87273 100644 --- a/g4f/Provider/NoowAi.py +++ b/g4f/Provider/NoowAi.py @@ -1,17 +1,17 @@ from __future__ import annotations -import random, string, json +import json from aiohttp import ClientSession from ..typing import AsyncResult, Messages from .base_provider import AsyncGeneratorProvider - +from .helper import get_random_string class NoowAi(AsyncGeneratorProvider): url = "https://noowai.com" supports_message_history = True supports_gpt_35_turbo = True - working = True + working = False @classmethod async def create_async_generator( @@ -43,7 +43,7 @@ class NoowAi(AsyncGeneratorProvider): "botId": "default", "customId": "d49bc3670c3d858458576d75c8ea0f5d", "session": "N/A", - "chatId": random_string(), + "chatId": get_random_string(), "contextId": 25, "messages": messages, "newMessage": messages[-1]["content"], @@ -63,7 +63,4 @@ class NoowAi(AsyncGeneratorProvider): elif line["type"] == "end": break elif line["type"] == "error": - raise RuntimeError(line["data"]) - -def random_string(length: int = 10): - return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(length)) \ No newline at end of file + raise RuntimeError(line["data"]) \ No newline at end of file -- cgit v1.2.3