From 64765476282096493e1f7b72a0f763fc1c3d9d5e Mon Sep 17 00:00:00 2001 From: sagadav Date: Mon, 1 May 2023 14:49:18 +0500 Subject: [PATCH 1/8] Typo correction in forefront README --- gpt4free/forefront/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gpt4free/forefront/README.md b/gpt4free/forefront/README.md index 35ba989..887097e 100644 --- a/gpt4free/forefront/README.md +++ b/gpt4free/forefront/README.md @@ -6,8 +6,11 @@ from gpt4free import forefront token = forefront.Account.create(logging=False) print(token) # get a response -for response in forefront.StreamingCompletion.create(token=token, - prompt='hello world', model='gpt-4'): - print(response.completion.choices[0].text, end='') +for response in forefront.StreamingCompletion.create( + token=token, + prompt='hello world', + model='gpt-4' +): + print(response.choices[0].text, end='') print("") ``` \ No newline at end of file From b78c6d51afd83b6f79d5b1d122c595aa3c7800fc Mon Sep 17 00:00:00 2001 From: CCXXXI Date: Mon, 1 May 2023 18:59:13 +0800 Subject: [PATCH 2/8] docs(readme): remove duplicate website https://chat.forefront.ai is mentioned twice. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 9fd505f..b2aeedf 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,6 @@ Just API's from some language model sites. | [sqlchat.ai](https://sqlchat.ai) | GPT-3.5 | | [bard.google.com](https://bard.google.com) | custom / search | | [bing.com/chat](https://bing.com/chat) | GPT-4/3.5 | -| [chat.forefront.ai/](https://chat.forefront.ai/) | GPT-4/3.5 | ## Best sites From fb054408bf2b15b22c524d9c9556ef0af7ac8ed9 Mon Sep 17 00:00:00 2001 From: sagadav Date: Mon, 1 May 2023 17:53:32 +0500 Subject: [PATCH 3/8] theb: multiple messages --- gpt4free/theb/README.md | 9 ++++++--- gpt4free/theb/__init__.py | 14 +++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/gpt4free/theb/README.md b/gpt4free/theb/README.md index a4abdf6..a7af9dd 100644 --- a/gpt4free/theb/README.md +++ b/gpt4free/theb/README.md @@ -5,7 +5,10 @@ from gpt4free import theb # simple streaming completion -for token in theb.Completion.create('hello world'): - print(token, end='', flush=True) -print("") + +while True: + x = input() + for token in theb.Completion.create(x): + print(token, end='', flush=True) + print("") ``` diff --git a/gpt4free/theb/__init__.py b/gpt4free/theb/__init__.py index 75a1506..741de34 100644 --- a/gpt4free/theb/__init__.py +++ b/gpt4free/theb/__init__.py @@ -17,6 +17,7 @@ class Completion: timer = None message_queue = Queue() stream_completed = False + last_msg_id = None @staticmethod def request(prompt: str, proxy: Optional[str]=None): @@ -28,26 +29,33 @@ class Completion: } proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else None - + + options = {} + if Completion.last_msg_id: + options['parentMessageId'] = Completion.last_msg_id + requests.post( 'https://chatbot.theb.ai/api/chat-process', headers=headers, proxies=proxies, content_callback=Completion.handle_stream_response, - json={'prompt': prompt, 'options': {}}, + json={'prompt': prompt, 'options': options}, ) Completion.stream_completed = True @staticmethod def create(prompt: str, proxy: Optional[str]=None) -> Generator[str, None, None]: + Completion.stream_completed = False Thread(target=Completion.request, args=[prompt, proxy]).start() while not Completion.stream_completed or not Completion.message_queue.empty(): try: message = Completion.message_queue.get(timeout=0.01) for message in findall(Completion.regex, message): - yield loads(Completion.part1 + message + Completion.part2)['delta'] + message_json = loads(Completion.part1 + message + Completion.part2) + Completion.last_msg_id = message_json['id'] + yield message_json['delta'] except Empty: pass From 55f2a3365141055db3a1b529d4c8c3b365f4eb2e Mon Sep 17 00:00:00 2001 From: xiangsx <1984871009@qq.com> Date: Mon, 1 May 2023 22:47:25 +0800 Subject: [PATCH 4/8] Remove duplicate docker-compose.yml --- README.md | 6 +----- docker-compose.yaml | 12 +++++++++--- docker-compose.yml | 12 ------------ 3 files changed, 10 insertions(+), 20 deletions(-) delete mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 9fd505f..75b62a8 100644 --- a/README.md +++ b/README.md @@ -127,17 +127,13 @@ Run ``` docker run -p 8501:8501 gpt4free:latest ``` -Another way - docker-compose (no docker build/run needed) -``` -docker-compose up -d -``` ## Deploy using docker-compose Run the following: ``` -docker-compose up -d +docker-compose up --build -d ``` ## ChatGPT clone diff --git a/docker-compose.yaml b/docker-compose.yaml index 3afd6cd..c9cc7d8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,8 +2,14 @@ version: "3.9" services: gpt4free: - build: - context: . + build: + context: ./ dockerfile: Dockerfile + container_name: dc_gpt4free + environment: + # - http_proxy=http://127.0.0.1:1080 + # - https_proxy=http://127.0.0.1:1080 + image: img_gpt4free ports: - - "8501:8501" + - 8501:8501 + restart: always \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index e8e7119..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,12 +0,0 @@ -version: '3.8' - -services: - gpt4: - build: - context: . - dockerfile: Dockerfile - image: gpt4free:latest - container_name: gpt4 - ports: - - 8501:8501 - restart: unless-stopped From 6604b3a0453b2fceb64cfbbf2a8f130f77a20b61 Mon Sep 17 00:00:00 2001 From: xiangsx <1984871009@qq.com> Date: Mon, 1 May 2023 22:49:34 +0800 Subject: [PATCH 5/8] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BB=A3?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index c9cc7d8..09bf460 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,8 +7,8 @@ services: dockerfile: Dockerfile container_name: dc_gpt4free environment: - # - http_proxy=http://127.0.0.1:1080 - # - https_proxy=http://127.0.0.1:1080 + - http_proxy=http://127.0.0.1:1080 + - https_proxy=http://127.0.0.1:1080 image: img_gpt4free ports: - 8501:8501 From 7d72cf6a15f748cb7fefacad86078bd8f8ae6ba3 Mon Sep 17 00:00:00 2001 From: xiangsx <1984871009@qq.com> Date: Mon, 1 May 2023 22:50:17 +0800 Subject: [PATCH 6/8] Add proxy config --- docker-compose.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 09bf460..8098f35 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -6,9 +6,9 @@ services: context: ./ dockerfile: Dockerfile container_name: dc_gpt4free - environment: - - http_proxy=http://127.0.0.1:1080 - - https_proxy=http://127.0.0.1:1080 + # environment: + # - http_proxy=http://127.0.0.1:1080 # modify this for your proxy + # - https_proxy=http://127.0.0.1:1080 # modify this for your proxy image: img_gpt4free ports: - 8501:8501 From c079dfef8a8a787a316d88c2549d4b6499a570dc Mon Sep 17 00:00:00 2001 From: Mishal <91066601+mishalhossin@users.noreply.github.com> Date: Mon, 1 May 2023 21:27:57 +0600 Subject: [PATCH 7/8] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9fd505f..88733c2 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ Just API's from some language model sites. Pull Requests - ChatGpt Discord Bot - Stars - Forks - Issues - Pull Requests + ChatGpt Discord Bot + Stars + Forks + Issues + Pull Requests From 2ceffaca52a4699a083d0101a1a95c2af3fc0716 Mon Sep 17 00:00:00 2001 From: Marijn Koesen Date: Mon, 1 May 2023 18:09:21 +0200 Subject: [PATCH 8/8] Fix docker build instructions As the Dockerfile was moved we need to update the path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fd505f..dc11765 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ then run: Build ``` -docker build -t gpt4free:latest -f Docker/Dockerfile . +docker build -t gpt4free:latest . ``` Run