Spaces:
Running
Running
Merge branch 'main' into huggingface-space
Browse files- README.md +9 -1
- requirements.txt +0 -1
- server/backend.py +2 -30
README.md
CHANGED
@@ -18,7 +18,7 @@ This project features a WebUI utilizing the [G4F API](https://github.com/xtekky/
|
|
18 |
Experience the power of ChatGPT with a user-friendly interface, enhanced jailbreaks, and completely free.
|
19 |
|
20 |
## Known bugs π§
|
21 |
-
-
|
22 |
|
23 |
## News π’
|
24 |
I have created a new version of FreeGPT WebUI using the [ChimeraGPT API](https://chimeragpt.adventblocks.cc/).
|
@@ -27,6 +27,14 @@ I have created a new version of FreeGPT WebUI using the [ChimeraGPT API](https:/
|
|
27 |
This free API allows you to use various AI chat models, including <strong>GPT-4, GPT-4-32k, Claude-2, Claude-2-100k, and more.</strong> <br>
|
28 |
Check out the project here: [FreeGPT WebUI - Chimera Version](https://github.com/ramonvc/freegpt-webui/tree/chimeragpt-version).
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
## Note βΉοΈ
|
31 |
<p>
|
32 |
FreeGPT is a project that utilizes various free AI conversation API Providers. Each Provider is an API that provides responses generated by different AI models. The source code related to these services is available in <a href="https://github.com/ramonvc/freegpt-webui/tree/main/g4f">G4F folder</a>.
|
|
|
18 |
Experience the power of ChatGPT with a user-friendly interface, enhanced jailbreaks, and completely free.
|
19 |
|
20 |
## Known bugs π§
|
21 |
+
- Stream mode not working properly.
|
22 |
|
23 |
## News π’
|
24 |
I have created a new version of FreeGPT WebUI using the [ChimeraGPT API](https://chimeragpt.adventblocks.cc/).
|
|
|
27 |
This free API allows you to use various AI chat models, including <strong>GPT-4, GPT-4-32k, Claude-2, Claude-2-100k, and more.</strong> <br>
|
28 |
Check out the project here: [FreeGPT WebUI - Chimera Version](https://github.com/ramonvc/freegpt-webui/tree/chimeragpt-version).
|
29 |
|
30 |
+
## Project Hosting and Demonstration ππ
|
31 |
+
The project is hosted on multiple platforms to be tested and modified.
|
32 |
+
|Plataform|Status|Repo|Demo|
|
33 |
+
|--|--|--|--|
|
34 |
+
|[replit](https://replit.com/)|![Active](https://img.shields.io/badge/Active-brightgreen)|[FreeGPT WebUI](https://replit.com/@ramonvc/freegpt-webui)|[Chat](https://freegpt-webui.ramonvc.repl.co/chat/)
|
35 |
+
|[hugging face](https://huggingface.co)|![Active](https://img.shields.io/badge/Active-brightgreen)|[FreeGPT WebUI](https://huggingface.co/spaces/monra/freegpt-webui/tree/main)|[Chat](https://huggingface.co/spaces/monra/freegpt-webui)
|
36 |
+
|[replit](https://replit.com/)|![Active](https://img.shields.io/badge/Active-brightgreen)|[FreeGPT WebUI - Chimera Version](https://replit.com/@ramonvc/freegpt-webui-chimera)|[Chat](https://freegpt-webui-chimera.ramonvc.repl.co/chat/)
|
37 |
+
|
38 |
## Note βΉοΈ
|
39 |
<p>
|
40 |
FreeGPT is a project that utilizes various free AI conversation API Providers. Each Provider is an API that provides responses generated by different AI models. The source code related to these services is available in <a href="https://github.com/ramonvc/freegpt-webui/tree/main/g4f">G4F folder</a>.
|
requirements.txt
CHANGED
@@ -23,4 +23,3 @@ numpy>=1.22.2 # pinned to avoid a vulnerability
|
|
23 |
tornado>=6.3.2 # pinned to avoid a vulnerability
|
24 |
PyExecJS
|
25 |
browser_cookie3
|
26 |
-
googletrans==4.0.0rc1
|
|
|
23 |
tornado>=6.3.2 # pinned to avoid a vulnerability
|
24 |
PyExecJS
|
25 |
browser_cookie3
|
|
server/backend.py
CHANGED
@@ -2,9 +2,7 @@ import re
|
|
2 |
import time
|
3 |
import g4f
|
4 |
from g4f import ChatCompletion
|
5 |
-
from googletrans import Translator
|
6 |
from flask import request, Response, stream_with_context
|
7 |
-
from datetime import datetime
|
8 |
from requests import get
|
9 |
from server.config import special_instructions
|
10 |
|
@@ -23,7 +21,7 @@ class Backend_Api:
|
|
23 |
'methods': ['POST']
|
24 |
}
|
25 |
}
|
26 |
-
|
27 |
def _conversation(self):
|
28 |
"""
|
29 |
Handles the conversation route.
|
@@ -75,20 +73,8 @@ def build_messages(jailbreak):
|
|
75 |
internet_access = request.json['meta']['content']['internet_access']
|
76 |
prompt = request.json['meta']['content']['parts'][0]
|
77 |
|
78 |
-
# Generate system message
|
79 |
-
current_date = datetime.now().strftime("%Y-%m-%d")
|
80 |
-
system_message = (
|
81 |
-
f'You are ChatGPT also known as ChatGPT, a large language model trained by OpenAI. '
|
82 |
-
f'Strictly follow the users instructions. '
|
83 |
-
f'Knowledge cutoff: 2021-09-01 Current date: {current_date}. '
|
84 |
-
f'{set_response_language(prompt)}'
|
85 |
-
)
|
86 |
-
|
87 |
-
# Initialize the conversation with the system message
|
88 |
-
conversation = [{'role': 'system', 'content': system_message}]
|
89 |
-
|
90 |
# Add the existing conversation
|
91 |
-
conversation
|
92 |
|
93 |
# Add web results if enabled
|
94 |
conversation += fetch_search_results(
|
@@ -172,20 +158,6 @@ def response_jailbroken_failed(response):
|
|
172 |
return False if len(response) < 4 else not (response.startswith("GPT:") or response.startswith("ACT:"))
|
173 |
|
174 |
|
175 |
-
def set_response_language(prompt):
|
176 |
-
"""
|
177 |
-
Set the response language based on the prompt content.
|
178 |
-
|
179 |
-
:param prompt: Prompt dictionary
|
180 |
-
:return: String indicating the language to be used for the response
|
181 |
-
"""
|
182 |
-
translator = Translator()
|
183 |
-
max_chars = 256
|
184 |
-
content_sample = prompt['content'][:max_chars]
|
185 |
-
detected_language = translator.detect(content_sample).lang
|
186 |
-
return f"You will respond in the language: {detected_language}. "
|
187 |
-
|
188 |
-
|
189 |
def getJailbreak(jailbreak):
|
190 |
"""
|
191 |
Check if jailbreak instructions are provided.
|
|
|
2 |
import time
|
3 |
import g4f
|
4 |
from g4f import ChatCompletion
|
|
|
5 |
from flask import request, Response, stream_with_context
|
|
|
6 |
from requests import get
|
7 |
from server.config import special_instructions
|
8 |
|
|
|
21 |
'methods': ['POST']
|
22 |
}
|
23 |
}
|
24 |
+
|
25 |
def _conversation(self):
|
26 |
"""
|
27 |
Handles the conversation route.
|
|
|
73 |
internet_access = request.json['meta']['content']['internet_access']
|
74 |
prompt = request.json['meta']['content']['parts'][0]
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
# Add the existing conversation
|
77 |
+
conversation = _conversation
|
78 |
|
79 |
# Add web results if enabled
|
80 |
conversation += fetch_search_results(
|
|
|
158 |
return False if len(response) < 4 else not (response.startswith("GPT:") or response.startswith("ACT:"))
|
159 |
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
def getJailbreak(jailbreak):
|
162 |
"""
|
163 |
Check if jailbreak instructions are provided.
|