mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-23 09:10:13 +03:00
~ | g4f v-0.1.5.8
This commit is contained in:
parent
b8aad21ee7
commit
8964d15dc3
@ -2,7 +2,7 @@
|
||||
|
||||
By using this repository or any code related to it, you agree to the [legal notice](./LEGAL_NOTICE.md). The author is not responsible for any copies, forks, reuploads made by other users, or anything else related to gpt4free. This is the author's only account and repository. To prevent impersonation or irresponsible actions, please comply with the GNU GPL license this Repository uses.
|
||||
|
||||
- latest pypi version: [`0.1.5.7`](https://pypi.org/project/g4f/0.1.5.7):
|
||||
- latest pypi version: [`0.1.5.8`](https://pypi.org/project/g4f/0.1.5.8):
|
||||
```sh
|
||||
pip install -U g4f
|
||||
```
|
||||
|
@ -65,7 +65,7 @@ class Aivvm(BaseProvider):
|
||||
response = requests.post("https://chat.aivvm.com/api/chat", headers=headers, data=data, stream=True)
|
||||
response.raise_for_status()
|
||||
|
||||
for chunk in response.iter_content():
|
||||
for chunk in response.iter_content(chunk_size=4096):
|
||||
try:
|
||||
yield chunk.decode("utf-8")
|
||||
except UnicodeDecodeError:
|
||||
|
@ -5,7 +5,7 @@ from .Provider import BaseProvider
|
||||
from .typing import Messages, CreateResult, Union
|
||||
from .debug import logging
|
||||
|
||||
version = '0.1.5.7'
|
||||
version = '0.1.5.8'
|
||||
version_check = True
|
||||
|
||||
def check_pypi_version() -> None:
|
||||
|
@ -144,10 +144,6 @@ const ask_gpt = async (message) => {
|
||||
|
||||
chunk = new TextDecoder().decode(value);
|
||||
|
||||
if (chunk.includes('<form id="challenge-form" action="/backend-api/v2/conversation?"')) {
|
||||
chunk = `cloudflare token expired, please refresh the page.`;
|
||||
}
|
||||
|
||||
text += chunk;
|
||||
|
||||
document.getElementById(`gpt_${window.token}`).innerHTML =
|
||||
@ -160,12 +156,7 @@ const ask_gpt = async (message) => {
|
||||
message_box.scrollTo({ top: message_box.scrollHeight, behavior: "auto" });
|
||||
}
|
||||
|
||||
// if text contains :
|
||||
if (text.includes("instead. Maintaining this website and API costs a lot of money")) {
|
||||
document.getElementById(`gpt_${window.token}`).innerHTML = "An error occured, please reload / refresh cache and try again or use a differnet browser";
|
||||
}
|
||||
|
||||
if (text.includes(`anerroroccuredmf`)) {
|
||||
if (text.includes(`G4F_ERROR`)) {
|
||||
document.getElementById(`gpt_${window.token}`).innerHTML = "An error occured, please try again, if the problem persists, please reload / refresh cache or use a differnet browser";
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class Backend_Api:
|
||||
conversation = request.json['meta']['content']['conversation']
|
||||
prompt = request.json['meta']['content']['parts'][0]
|
||||
model = request.json['model']
|
||||
provider = request.json.get('provider').split("g4f.Provider.")[1]
|
||||
provider = request.json.get('provider').split('g4f.Provider.')[1]
|
||||
|
||||
messages = special_instructions[jailbreak] + conversation + search(internet_access, prompt) + [prompt]
|
||||
|
||||
@ -52,6 +52,7 @@ class Backend_Api:
|
||||
|
||||
except Exception as e:
|
||||
return {
|
||||
'code' : 'G4F_ERROR',
|
||||
'_action': '_ask',
|
||||
'success': False,
|
||||
"error": f"an error occured {str(e)}"}, 400
|
||||
'error' : f'an error occured {str(e)}'}, 400
|
2
setup.py
2
setup.py
@ -14,7 +14,7 @@ with open("requirements.txt") as f:
|
||||
with open("etc/interference/requirements.txt") as f:
|
||||
api_required = f.read().splitlines()
|
||||
|
||||
VERSION = '0.1.5.7'
|
||||
VERSION = '0.1.5.8'
|
||||
DESCRIPTION = (
|
||||
"The official gpt4free repository | various collection of powerful language models"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user