XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

~ | g4f `v-0.1.5.8`

8964d15d
abc <98614666+xtekky@users.noreply.github.com>
提交于

代码差异

6 个文件 +8 -16
Modified README.md +1 -1
@@ -2,7 +2,7 @@
2 2
3 3 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.
4 4
5 - latest pypi version: [`0.1.5.7`](https://pypi.org/project/g4f/0.1.5.7):
5 - latest pypi version: [`0.1.5.8`](https://pypi.org/project/g4f/0.1.5.8):
6 6 ```sh
7 7 pip install -U g4f
8 8 ```
Modified g4f/Provider/Aivvm.py +1 -1
@@ -65,7 +65,7 @@ class Aivvm(BaseProvider):
65 65 response = requests.post("https://chat.aivvm.com/api/chat", headers=headers, data=data, stream=True)
66 66 response.raise_for_status()
67 67
68 for chunk in response.iter_content():
68 for chunk in response.iter_content(chunk_size=4096):
69 69 try:
70 70 yield chunk.decode("utf-8")
71 71 except UnicodeDecodeError:
Modified g4f/__init__.py +1 -1
@@ -5,7 +5,7 @@ from .Provider import BaseProvider
5 5 from .typing import Messages, CreateResult, Union
6 6 from .debug import logging
7 7
8 version = '0.1.5.7'
8 version = '0.1.5.8'
9 9 version_check = True
10 10
11 11 def check_pypi_version() -> None:
Modified g4f/gui/client/js/chat.v2.js +1 -10
@@ -144,10 +144,6 @@ const ask_gpt = async (message) => {
144 144
145 145 chunk = new TextDecoder().decode(value);
146 146
147 if (chunk.includes('<form id="challenge-form" action="/backend-api/v2/conversation?"')) {
148 chunk = `cloudflare token expired, please refresh the page.`;
149 }
150
151 147 text += chunk;
152 148
153 149 document.getElementById(`gpt_${window.token}`).innerHTML =
@@ -160,12 +156,7 @@ const ask_gpt = async (message) => {
160 156 message_box.scrollTo({ top: message_box.scrollHeight, behavior: "auto" });
161 157 }
162 158
163 // if text contains :
164 if (text.includes("instead. Maintaining this website and API costs a lot of money")) {
165 document.getElementById(`gpt_${window.token}`).innerHTML = "An error occured, please reload / refresh cache and try again or use a differnet browser";
166 }
167
168 if (text.includes(`anerroroccuredmf`)) {
159 if (text.includes(`G4F_ERROR`)) {
169 160 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";
170 161 }
171 162
Modified g4f/gui/server/backend.py +3 -2
@@ -33,7 +33,7 @@ class Backend_Api:
33 33 conversation = request.json['meta']['content']['conversation']
34 34 prompt = request.json['meta']['content']['parts'][0]
35 35 model = request.json['model']
36 provider = request.json.get('provider').split("g4f.Provider.")[1]
36 provider = request.json.get('provider').split('g4f.Provider.')[1]
37 37
38 38 messages = special_instructions[jailbreak] + conversation + search(internet_access, prompt) + [prompt]
39 39
@@ -52,6 +52,7 @@ class Backend_Api:
52 52
53 53 except Exception as e:
54 54 return {
55 'code' : 'G4F_ERROR',
55 56 '_action': '_ask',
56 57 'success': False,
57 "error": f"an error occured {str(e)}"}, 400
58 'error' : f'an error occured {str(e)}'}, 400
Modified setup.py +1 -1
@@ -14,7 +14,7 @@ with open("requirements.txt") as f:
14 14 with open("etc/interference/requirements.txt") as f:
15 15 api_required = f.read().splitlines()
16 16
17 VERSION = '0.1.5.7'
17 VERSION = '0.1.5.8'
18 18 DESCRIPTION = (
19 19 "The official gpt4free repository | various collection of powerful language models"
20 20 )