Skip to content

Commit ec35226

Browse files
committed
Добавлен GPT-4
1 parent 6a85ae4 commit ec35226

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

g4f/Provider/Providers/AItianhu.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ def _create_completion(model: str, messages: list, stream: bool, **kwargs):
2727
}
2828
response = requests.post(url, headers=headers, json=data, verify=False)
2929

30-
for line in response.iter_lines():
31-
if b'content' in line:
32-
line_json = json.loads(line.decode('utf-8').split('data: ')[1])
33-
yield (line_json['choices'][0]['delta']['content'])
30+
yield response.text
3431

3532
params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
3633
'(%s)' % ', '.join([f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])

g4f/Provider/Providers/Acytoo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import json
44

55
url = "https://chat.acytoo.com/api/completions"
6-
model = ['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-0613', 'gpt-4-32k']
7-
supports_stream = False
6+
model = ['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-4-0613', 'gpt-4-32k', 'gpt-4']
7+
supports_stream = True
88
needs_auth = False
99
working = True
1010

@@ -31,7 +31,7 @@ def _create_completion(model: str, messages: list, stream: bool, **kwargs):
3131
"password": ""
3232
}
3333

34-
response = requests.post(url, headers=headers, data=json.dumps(data))
34+
response = requests.post(url, headers=headers, data=json.dumps(data), stream=True)
3535
if response.status_code == 200:
3636
yield response.text
3737
else:

test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
proxy = FreeProxy(country_id=['FL'], timeout=0.5, rand=True).get()
88
stream = False
99
#print(proxy)
10-
response = g4f.ChatCompletion.create(model='gpt-3.5-turbo-16k', provider=g4f.Provider.AItianhu, messages=[
10+
response = g4f.ChatCompletion.create(model='gpt-3.5-turbo-16k', provider=g4f.Provider.Acytoo, messages=[
1111
{"role": "user", "content": "hello"}], stream=False)
1212

1313

0 commit comments

Comments
 (0)