Skip to content

Commit 5caab6f

Browse files
committed
v1.6.2
1 parent 82e71e3 commit 5caab6f

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

modules/models/models.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,14 @@ def _make_request(self, headers, payload, stream):
190190
else:
191191
timeout = TIMEOUT_ALL
192192

193-
max_retry_attempts = 10 # Общее количество попыток
193+
max_retry_attempts = 5 # Общее количество попыток
194194
for attempt in range(max_retry_attempts):
195195
try:
196196
response = requests.post(
197197
shared.state.completion_url,
198198
headers=headers,
199199
json=payload,
200-
stream=stream,
200+
stream=False,
201201
timeout=timeout,
202202
)
203203

@@ -206,8 +206,9 @@ def _make_request(self, headers, payload, stream):
206206
#print(response.text)
207207
#print(response_json)
208208

209-
if response and response.status_code == 200 and not response_json['choices'][0]['message']['content']:
210-
print(f'Попытка {attempt + 1} из {max_retry_attempts} получила пустой ответ, повтор...')
209+
# Декодирование ответа и проверка на пустоту или отсутствие 'choices'
210+
if response and response.status_code == 200 and ('choices' not in response_json or not response_json['choices']):
211+
print(f'Попытка {attempt + 1} из {max_retry_attempts} получила неверный ответ, повтор...')
211212
else:
212213
return response
213214

@@ -228,17 +229,7 @@ def _refresh_header(self):
228229
}
229230

230231
def _get_billing_data(self, billing_url):
231-
with retrieve_proxy():
232-
response = requests.get(
233-
billing_url,
234-
headers=self.headers,
235-
timeout=TIMEOUT_ALL,
236-
)
237-
if response.status_code == 200:
238-
data = response.json()
239-
return data
240-
else:
241-
raise Exception(f"API request failed with status code {response.status_code}: {response.text}")
232+
return None
242233

243234
def _decode_chat_response(self, response):
244235
error_msg = ""

modules/presets.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import requests
55
import json
66

7-
VERSION = "v 1.6.1"
7+
VERSION = "v 1.6.2"
88

99
CHATGLM_MODEL = None
1010
CHATGLM_TOKENIZER = None
@@ -48,7 +48,6 @@
4848
CHUANHU_DESCRIPTION = "[ℹ️ Телеграм канал автора](https://t.me/neurogen_news) <br /> [💰 Поддержать автора](https://boosty.to/neurogen) </br>"
4949

5050
ONLINE_MODELS = [
51-
'gpt-3.5-turbo',
5251
'gpt-3.5-turbo',
5352
'gpt-3.5-turbo-1106',
5453
'gpt-3.5-turbo-0613',
@@ -57,6 +56,7 @@
5756
'gpt-4',
5857
'gpt-4-0613',
5958
'gpt-4-1106-preview',
59+
'gpt-4-32k',
6060
'chat-agent-beta',
6161
]
6262

@@ -120,22 +120,8 @@
120120
'claude-2': 100000,
121121
"claude-instant-100k": 100000,
122122
"claude-2-100k": 100000,
123-
'naga-gpt-3.5-turbo-16k': 16384,
124-
'naga-gpt-4': 8192,
125-
'naga-llama-2-70b-chat': 4096,
126-
'chatty-gpt-3.5-turbo-16k': 16384,
127-
'chatty-gpt-4': 8192,
128-
'purgpt-gpt-3.5-turbo-16k': 16384,
129-
'purgpt-gpt-3.5-turbo': 4096,
130-
'purgpt-text-davinci-003': 4096,
131123
'naga-text-davinci-003': 4096,
132124
'text-davinci-003': 4096,
133-
'daku-gpt-4': 8192,
134-
'daku-gpt-4-32k': 32768,
135-
'daku-claude-2': 100000,
136-
'daku-claude-2-100k': 100000,
137-
'daku-codellama-34b': 4096,
138-
'daku-llama-2-70b': 4096,
139125
}
140126

141127
TOKEN_OFFSET = 1000

0 commit comments

Comments
 (0)