Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error :( #422

Open
Yudin-num2 opened this issue Jan 21, 2024 · 0 comments
Open

Error :( #422

Yudin-num2 opened this issue Jan 21, 2024 · 0 comments

Comments

@Yudin-num2
Copy link

Yudin-num2 commented Jan 21, 2024

I'm write sudo docker compose --env-file config.env up --build
Telegram Bot send this:
An exception was raised while handling an update

update = {
  "update_id": 358973558,
  "message": {
    "chat": {
      "id": 1567823651,
      "type": "private",
      "first_name": "SECRET",
      "username": "SECRET"
    },
    "text": "Hi!",
    "group_chat_created": false,
    "message_id": 49,
    "delete_chat_photo": false,
    "date": 1705868600,
    "supergroup_chat_created": false,
    "channel_chat_created": false,
    "from": {
      "is_bot": false,
      "username": SECRET,
      "first_name": SECRET,
      "id": SECRET,
      "language_code": "ru",
      "is_premium": true
    }
  }
}
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line
    data = json.loads(rbody)
  File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/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 "bot/bot.py", line 252, in message_handle_fn
    async for gen_item in gen:
  File "/code/bot/openai_utils.py", line 78, in send_message_stream
    r_gen = await openai.ChatCompletion.acreate(
  File "/usr/local/lib/python3.8/site-packages/openai/api_resources/chat_completion.py", line 45, in acreate
    return await super().acreate(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 219, in acreate
    response, _, api_key = await requestor.arequest(
  File "/usr/local/lib/python3.8/site-packages/openai/api_requestor.py", line 384, in arequest
    resp, got_stream = await self._interpret_async_response(result, stream)
  File "/usr/local/lib/python3.8/site-packages/openai/api_requestor.py", line 738, in _interpret_async_response
    self._interpret_response_line(
  File "/usr/local/lib/python3.8/site-packages/openai/api_requestor.py", line 767, in _interpret_response_line
    raise error.APIError(
openai.error.APIError: HTTP code 403 from API (<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Attention Required! | Cloudflare</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" /><![endif]-->
<style>body{margin:0;padding:0}</style>


<!--[if gt
e IE 10]>
<script>
  if (!navigator.cookieEnabled) {
    window.addEventListener('DOMContentLoaded', function () {
      var cookieEl = document.getElementById('cookie-alert');
      cookieEl.style.display = 'block';
    })
  }
</script>



  

Sorry, you have been blocked

You are unable to access api.openai.com

  <div class="cf-section cf-highlight">
    <div class="cf-wrapper">
      <div class="cf-screenshot-container cf-screenshot-full">
        
          <span class="cf-no-screenshot error"></span>
        
      </div>
    </div>
  </div><!-- /.captcha-container -->

  <div class="cf-section cf-wrapper">
    <div class="cf-columns two">
      <div class="cf-column">
        <h2 data-translate="blocked_why_headline">Why have I been blocked?</h2>

        <p data-translate="blocked_why_detail">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.</p>
      </div>

      <div class="cf-column">
        <h2 data-translate="blocked_resolve_headline">What can I do to resolve this?</h2>

        <p data-translate="blocked_resolve_detail">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.</p>
      </div>
    </div>
  </div><!-- /.section -->

  <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">

Cloudflare Ray ID: 849246471ee17b67 Your IP: Click to reveal 46.39.51.77 Performance & security by Cloudflare

<script>(function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&& amp;(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();</script> </div><!-- /.error-footer -->
&lt;/div&gt;&lt;!-- /#cf-error-details --&gt;

</div><!-- /#cf-wrapper -->

<script>
window._cf_translation = {};

</script>

</body>
</html>
)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 1104, in process_update
await coroutine
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 141, in handle_update
return await self.callback(update, context)
File "bot/bot.py", line 307, in message_handle
await task
File "bot/bot.py", line 291, in message_handle_fn
await update.message.reply_text(error_text)
File "/usr/local/lib/python3.8/site-packages/telegram/_message.py", line 1041, in reply_text
return await self.get_bot().send_message(
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_extbot.py", line 2598, in send_message
return await super().send_message(
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 331, in decorator
result = await func(*args, **kwargs) # skipcq: PYL-E1102
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 760, in send_message
return await self._send_message(
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_extbot.py", line 488, in _send_message
result = await super()._send_message(
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 512, in _send_message
result = await self._post(
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 419, in _post
return await self._do_post(
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_extbot.py", line 326, in _do_post
return await self.rate_limiter.process_request(
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_aioratelimiter.py", line 247, in process_request
return await self._run_request(
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_aioratelimiter.py", line 203, in _run_request
return await callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 450, in _do_post
return await request.post(
File "/usr/local/lib/python3.8/site-packages/telegram/request/_baserequest.py", line 165, in post
result = await self._request_wrapper(
File "/usr/local/lib/python3.8/site-packages/telegram/request/_baserequest.py", line 328, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Message is too long

I'm write him message "Hi!". Why is he doing this to me? What did I do wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant