Update app.py
Browse files
app.py
CHANGED
@@ -30,14 +30,14 @@ def generate(forr, ver=13, doptb=""):
|
|
30 |
|
31 |
if 'choices' in data and len(data['choices']) > 0:
|
32 |
congratulation = data['choices'][0]['message']['content'].strip()
|
33 |
-
print("Генерация
|
34 |
return congratulation
|
35 |
elif 'error' in data:
|
36 |
error_message = data['error']['message']
|
37 |
print(f'Ошибка: {error_message}')
|
38 |
return f"Ошибка сервера!"
|
39 |
else:
|
40 |
-
print(f'Не удалось написать
|
41 |
return "Неизвестная ошибка!"
|
42 |
except requests.exceptions.RequestException as e:
|
43 |
print(f"Ошибка запроса: {e}")
|
|
|
30 |
|
31 |
if 'choices' in data and len(data['choices']) > 0:
|
32 |
congratulation = data['choices'][0]['message']['content'].strip()
|
33 |
+
print(f"Генерация успешна: '{forr}'")
|
34 |
return congratulation
|
35 |
elif 'error' in data:
|
36 |
error_message = data['error']['message']
|
37 |
print(f'Ошибка: {error_message}')
|
38 |
return f"Ошибка сервера!"
|
39 |
else:
|
40 |
+
print(f'Не удалось написать текст: "{forr}". Ответ сервера: {data}') # Выводим ответ сервера для отладки
|
41 |
return "Неизвестная ошибка!"
|
42 |
except requests.exceptions.RequestException as e:
|
43 |
print(f"Ошибка запроса: {e}")
|