n3d1117 / chatgpt-telegram-bot

🤖 A Telegram bot that integrates with OpenAI's official ChatGPT APIs to provide answers, written in Python
GNU General Public License v2.0
3.07k stars 1.41k forks source link

Hello! how to reset user statistics? #461

Open matveyevichevg opened 12 months ago

matveyevichevg commented 12 months ago

I tried deleting and adding users, changing their budget, clearing json log files, but the statistics are always updated

AlexHTW commented 12 months ago

Did you restart the bot after deleting the logs?

matveyevichevg commented 12 months ago

Did you restart the bot after deleting the logs?

yes

matveyevichevg commented 12 months ago

Now I'm getting a very strange error. I already tried to clone the project from scratch, but it repeats itself `D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) 2023-11-16 12:54:40,764 - telegram.ext.Application - INFO - Application started 2023-11-16 12:54:45,983 - root - INFO - New message received from user @matveyevichevg (id: 313653958) 2023-11-16 12:54:46,501 - openai - INFO - message='OpenAI API response' path=https://api.openai.com/v1/chat/completions processing_ms=None request_id=None response_code=403 2023-11-16 12:54:46,502 - root - ERROR - ⚠️ An error has occurred. ⚠️ HTTP code 403 from API (<!DOCTYPE html>

Attention Required! | Cloudflare

Sorry, you have been blocked

You are unable to access api.openai.com

Why have I been blocked?

This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

What can I do to resolve this?

You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.

) Traceback (most recent call last): File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\openai\api_requestor.py", line 753, in _interpret_response_line data = json.loads(rbody) File "C:\Users\fme_admin\AppData\Local\Programs\Python\Python39\lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) File "C:\Users\fme_admin\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\fme_admin\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\4_Python projects\gpt_bot\gpt4turbo\bot\openai_helper.py", line 253, in __common_get_chat_response return await openai.ChatCompletion.acreate(*common_args) File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\openai\api_resources\chat_completion.py", line 45, in acreate return await super().acreate(args, **kwargs) File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\openai\api_resources\abstract\engine_apiresource.py", line 217, in acreate response, , api_key = await requestor.arequest( File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\openai\api_requestor.py", line 382, in arequest resp, got_stream = await self._interpret_async_response(result, stream) File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\openai\api_requestor.py", line 726, in _interpret_async_response self._interpret_response_line( File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\openai\api_requestor.py", line 755, in _interpret_response_line raise error.APIError( openai.error.APIError: HTTP code 403 from API (<!DOCTYPE html>

Attention Required! | Cloudflare

Sorry, you have been blocked

You are unable to access api.openai.com

Why have I been blocked?

This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

What can I do to resolve this?

You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.

)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\4_Python projects\gpt_bot\gpt4turbo\bot\telegram_bot.py", line 424, in prompt async for content, tokens in stream_response: File "D:\4_Python projects\gpt_bot\gpt4turbo\bot\openai_helper.py", line 167, in get_chat_response_stream response = await self.common_get_chat_response(chat_id, query, stream=True) File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\tenacity_asyncio.py", line 88, in async_wrapped return await fn(*args, **kwargs) File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\tenacity_asyncio.py", line 47, in call do = self.iter(retry_state=retry_state) File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\tenacity__init__.py", line 314, in iter return fut.result() File "C:\Users\fme_admin\AppData\Local\Programs\Python\Python39\lib\concurrent\futures_base.py", line 439, in result return self.get_result() File "C:\Users\fme_admin\AppData\Local\Programs\Python\Python39\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "D:\4_Python projects\gpt_bot\gpt4turbo\venv\lib\site-packages\tenacity_asyncio.py", line 50, in call__ result = await fn(*args, **kwargs) File "D:\4_Python projects\gpt_bot\gpt4turbo\bot\openai_helper.py", line 262, in __common_get_chatresponse raise Exception(f"⚠️ {localized_text('error', botlanguage)}. ⚠️\n{str(e)}") from e Exception: ⚠️ An error has occurred. ⚠️ HTTP code 403 from API (<!DOCTYPE html>

Attention Required! | Cloudflare

Sorry, you have been blocked

You are unable to access api.openai.com

Why have I been blocked?

This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

What can I do to resolve this?

You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.

) 2023-11-16 12:54:46,565 - root - ERROR - Exception while handling an update: Message is too long`

aleksandrf2020 commented 11 months ago

the same mistake - 2023-11-26 20:50:51,428 - root - ERROR - Exception while handling an update: Message is too long