From 64765476282096493e1f7b72a0f763fc1c3d9d5e Mon Sep 17 00:00:00 2001 From: sagadav Date: Mon, 1 May 2023 14:49:18 +0500 Subject: 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 35ba9897..887097ec 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 -- cgit v1.2.3 From b78c6d51afd83b6f79d5b1d122c595aa3c7800fc Mon Sep 17 00:00:00 2001 From: CCXXXI Date: Mon, 1 May 2023 18:59:13 +0800 Subject: 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 9fd505f2..b2aeedfc 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 -- cgit v1.2.3 From fb054408bf2b15b22c524d9c9556ef0af7ac8ed9 Mon Sep 17 00:00:00 2001 From: sagadav Date: Mon, 1 May 2023 17:53:32 +0500 Subject: 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 a4abdf62..a7af9dd8 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 75a15068..741de34d 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 -- cgit v1.2.3 From 55f2a3365141055db3a1b529d4c8c3b365f4eb2e Mon Sep 17 00:00:00 2001 From: xiangsx <1984871009@qq.com> Date: Mon, 1 May 2023 22:47:25 +0800 Subject: 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 9fd505f2..75b62a8c 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 3afd6cdf..c9cc7d8f 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 e8e7119b..00000000 --- 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 -- cgit v1.2.3 From 6604b3a0453b2fceb64cfbbf2a8f130f77a20b61 Mon Sep 17 00:00:00 2001 From: xiangsx <1984871009@qq.com> Date: Mon, 1 May 2023 22:49:34 +0800 Subject: =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BB=A3=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 c9cc7d8f..09bf4605 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 -- cgit v1.2.3 From 7d72cf6a15f748cb7fefacad86078bd8f8ae6ba3 Mon Sep 17 00:00:00 2001 From: xiangsx <1984871009@qq.com> Date: Mon, 1 May 2023 22:50:17 +0800 Subject: 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 09bf4605..8098f359 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 -- cgit v1.2.3 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: Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9fd505f2..88733c23 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 -- cgit v1.2.3 From 2ceffaca52a4699a083d0101a1a95c2af3fc0716 Mon Sep 17 00:00:00 2001 From: Marijn Koesen Date: Mon, 1 May 2023 18:09:21 +0200 Subject: 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 9fd505f2..dc11765b 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 -- cgit v1.2.3