GithubHelp home page GithubHelp logo

noes14155 / telegrambot-with-gpt Goto Github PK

View Code? Open in Web Editor NEW
79.0 4.0 30.0 558 KB

telegram bot with gpt

License: GNU General Public License v2.0

Dockerfile 0.74% Python 99.26%
chatbot chatgpt-python free-gpt python telegram aiogram-bot

telegrambot-with-gpt's Introduction

Deploy on Railway

Telegrambot-with-GPT4free

๐Ÿค– A Telegram bot powered by ChatGPT using the Aiogram API.

โ„น๏ธ Note: The Hugging Face token is only required for image captioning.

โœจ Features:

  • Supports OCR with Tesseract in addition to salesforce blip image captioning.
  • Easy to translate to your own language with multi-language support.
  • Supports voice transcription with speech_recognition
  • Image generation using Stability Diffusion and DALL-E.
  • Plugin support by n3d1117 under GNU GENERAL PUBLIC LICENSE.

Installation Steps

Linux

Download or clone this repository
Go to the directory

git clone https://github.com/noes14155/Telegrambot-with-GPT4free
cd Telegrambot-with-GPT4free

Copy example.env file to .env

cp example.env .env

Change environment variables in .env file Environment Variables

nano .env

Create virtual environment for this project/directory

python3 -m venv venv
source venv/bin/activate

Install the requirements

apt install -y flac ffmpeg tesseract-ocr

pip install -r requirements.txt

Run the bot

python main.py

Windows

  1. Download or clone this repository:
git clone https://github.com/noes14155/Telegrambot-with-GPT4free
cd Telegrambot-with-GPT4free
  1. Copy the example.env file to .env

  2. Change the environment variables in the .env file using a text editor of your choice.

  3. Create a virtual environment for this project/directory:

python -m venv venv
venv\Scripts\activate
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Install additional dependencies:
  • Install Tesseract OCR:
    • Install using single command 'choco install tesseract' or manually using the following steps.
    • Download the Windows installer from the Tesseract OCR GitHub page.
    • Run the installer and make sure to check download Additional script data option in the installation options.
    • Add the Tesseract installation directory to the system's PATH environment variable.
  • Install FFmpeg:
    • Install using single command 'choco install ffmpeg' or manually using the following steps.
    • Download the latest static build of FFmpeg for Windows from the official FFmpeg website
    • Extract the downloaded ZIP file to a location of your choice.
    • Add the FFmpeg bin directory to the system's PATH environment variable.
  1. Run the bot:
python main.py

Docker

Build (change environment variables before build)

Uncomment this section (If yu want to use gpt4free)

  g4f_server:
    container_name: g4f_server
    ports:
      - '1337:1337'
    environment:
      - PYTHONUNBUFFERED=1
    build:
      context: ./interference
      dockerfile: Dockerfile
    restart: always

Build containers

docker-compose up --build -d

Environment Variables

To run this project, you will need to create a .env file or rename the existing example.env to .env and add the following environment variables

  • BOT_TOKEN Get this by messaging @botfather Refer to ๐Ÿ“– Telegram Bot Tutorial

  • HG_TOKEN Optional(Required for image captioning). Sign up on hugging face and get the token from ๐Ÿ”— Hugging Face.

  • HG_IMG2TEXT If you want to use another model for image captioning. change it here.
    Default value HG_IMG2TEXT = 'https://api-inference.huggingface.co/models/Salesforce/blip-image-captioning-large'

  • HG_TEXT2IMAGE If you want to use another model for image generation with /img command, change it here Default value HG_TEXT2IMAGE = 'stabilityai/stable-diffusion-2-1'

  • DEFAULT_LANG Change to your language default english. If you want to translate to your own language please do so in the language_files folder make your own language.yml file and add the language to languages.yml file.

  • PLUGINS Enable or disable plugins. Default value True.

  • TTS Enable or disable TTS. Default value True.

  • BOT_OWNER_ID Add your userid from telegram. If empty DM enable or disable option will be disabled.

  • GPT_KEY To use GPT4free GPT_KEY = ''
    Key from the provider (including openai). Whichever api base you want use the key provided. Naga AI, Novo, Genius AI, Mandrill AI tested, Use correct API_base and GPT_KEY according to the provider Get this by messaging run the /key get command in th bot channel in Naga AI Discord, MandrillaiAI

  • API_BASE To use GPT4free API_BASE = 'http://localhost:1337'
    You can use any provider. I have included Naga AI api base. Use the key for the same.

  • DEFAULT_MODEL For some providers like Mandrill, which doesn't support models query, provide a default model. Used only if model query returns 404 from the provider.

  • MAX_HISTORY Number of conversation history to be sent with each request. Default value 10. Don't put more than 20.

  • ENABLED_PLUGINS List of enabled plugins. Only wolfram is disabled by default. Add Worlframalpha api key before adding wolfram to this list.

  • WOLFRAM_APP_ID Wolframalpha api key

  • DUCKDUCKGO_SAFESEARCH Valid values are 'safe', 'moderate', 'off'

  • WORLDTIME_DEFAULT_TIMEZONE Timezone should be in the format Asia/Dubai or Europe/Rome

๐ŸŽ‰ You're all set! Enjoy using the Telegram bot with ChatGPT!

Contributors

telegrambot-with-gpt's People

Contributors

mlnekit avatar noes14155 avatar vasmarfas avatar wahitftry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

telegrambot-with-gpt's Issues

404 via dalle generation

if you use gpt4free and try to create an image via dalle you will get a 404 error which seems logical, is there a way to generate images without using the naga api and using only gpt4free?
also img generation with stable diffusion 2.1 doesn't look very good in my opinion. if interested, I changed the endpoint for gradio to "kandinsky-community/kandinsky-2-2-decoder"

A request to the Telegram API was unsuccessful

I cloned this repo.
Created venv using:

  1. python3 -m venv venv
  2. source venv/bin/activate
    Installed reqs: pip3 install -r requirements.txt
    Launched bot (in venv): python main.py

Got this error:
(venv) www-data@server-home:/media/bad-hdd-nextcloud/nextcloud-data/Programms/Telegrambot-with-GPT4free$ python main.py
/media/bad-hdd-nextcloud/nextcloud-data/Programms/Telegrambot-with-GPT4free/venv/lib/python3.10/site-packages/whisper/timing.py:58: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.
def backtrace(trace: np.ndarray):
2023-06-16 01:00:12,842 (async_telebot.py:431 MainThread) ERROR - TeleBot: "Unhandled exception (full traceback for debug level): A request to the Telegram API was unsuccessful. Error code: 409. Description: Conflict: can't use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first"

How to fix it? I need to run this project in venv because in system i got this errors:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
qqddm 0.1.1 requires httpx~=0.23.1, but you have httpx 0.24.1 which is incompatible.
python-telegram-bot 20.2 requires httpx~=0.23.3, but you have httpx 0.24.1 which is incompatible.

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
unknown package:
Expected sha256 29653ffc526b4b2485130b71f38bc43b75ad1b6898b3fe8d99ba456db9a102a3
Got bd7b1ae7297cec3ac2e9d457c962ccf0cd5112c7d6bd93344921a27fb260ccbc

Whats wrong

TTS and image is not working

TTS is not working I have tried many times but it not work and the image generation is also not working when I type "/img" it every time says "failed to generate images" can you able to solve this for me also it you have deployed the bot can you give me the link so I can test and one more thing how to make the plugins work I have make all the setting such as I have make it true and add all the plugins list but still not work.

Not available

neither Discord Server or Telegram Bot links provided work in README

base URLs failed

here is the error message
INFO:aiogram.dispatcher.dispatcher:Start polling.
Error making the request with https://gpt4.gravityengine.cc: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://gpt4.xunika.uk/')
Retrying with a different base URL.
on the bot it says
All base URLs failed to provide a response.

persona missing in db

....
File "/home/papa/Telegrambot-with-GPT4free/bot/language_manager.py", line 37, in local_messages

lang, persona = self.db_connection.get_settings(user_id)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/papa/Telegrambot-with-GPT4free/bot/database.py", line 46, in get_settings

row = self.conn.execute(query, (user_id,)).fetchone()

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sqlite3.OperationalError: no such column: persona

this is just my opinion about the error

Based on the error traceback, the issue seems to be caused by the database not having the expected 'persona' column in the settings table.

Looking at database.py, the create_tables() method defines the settings table with only 'user_id' and 'lang' columns. The 'persona' column is missing.

Later in get_settings(), the code tries to query the 'persona' column, which results in the sqlite3.OperationalError since that column does not exist.

Transcription of voice messages does not work

C:\Users\andre\AppData\Local\Programs\Python\Python311\Lib\site-packages\whisper\transcribe.py:114: UserWarning: FP16 is not supported on CPU; using FP32 instead warnings.warn("FP16 is not supported on CPU; using FP32 instead") 2023-06-19 18:04:53,222 (async_telebot.py:542 MainThread) ERROR - TeleBot: "[WinError 2] The system cannot find the file specified"

Captcha

i get this error
File "/home/papa/Telegrambot-with-GPT4free/bot/bing_wrapper.py", line 286, in stream_generate
raise Exception(
Exception: CaptchaChallenge: User needs to solve CAPTCHA to continue.

i cannot see any instructions in README

Commands /changeprovider or /changebot doesn't working

In fact, everything is said in the name of the issue. When sending these commands, the bot perceives them as plain text and sends them to the services for processing it and generating a response. Judging by the code, there are no command data handlers here, have they been removed or is this a bug?

error while running Bot

Traceback (most recent call last):
telegrambot_gpt4free | File "/usr/local/lib/python3.10/urllib/request.py", line 1348, in do_open
telegrambot_gpt4free | h.request(req.get_method(), req.selector, req.data, headers,
telegrambot_gpt4free | File "/usr/local/lib/python3.10/http/client.py", line 1283, in request
telegrambot_gpt4free | self._send_request(method, url, body, headers, encode_chunked)
telegrambot_gpt4free | File "/usr/local/lib/python3.10/http/client.py", line 1329, in _send_request
telegrambot_gpt4free | self.endheaders(body, encode_chunked=encode_chunked)
telegrambot_gpt4free | File "/usr/local/lib/python3.10/http/client.py", line 1278, in endheaders
telegrambot_gpt4free | self._send_output(message_body, encode_chunked=encode_chunked)
telegrambot_gpt4free | File "/usr/local/lib/python3.10/http/client.py", line 1038, in _send_output
telegrambot_gpt4free | self.send(msg)
telegrambot_gpt4free | File "/usr/local/lib/python3.10/http/client.py", line 976, in send
telegrambot_gpt4free | self.connect()
telegrambot_gpt4free | File "/usr/local/lib/python3.10/http/client.py", line 1448, in connect
telegrambot_gpt4free | super().connect()
telegrambot_gpt4free | File "/usr/local/lib/python3.10/http/client.py", line 942, in connect
telegrambot_gpt4free | self.sock = self._create_connection(
telegrambot_gpt4free | File "/usr/local/lib/python3.10/socket.py", line 845, in create_connection
telegrambot_gpt4free | raise err
telegrambot_gpt4free | File "/usr/local/lib/python3.10/socket.py", line 833, in create_connection
telegrambot_gpt4free | sock.connect(sa)
telegrambot_gpt4free | OSError: [Errno 99] Cannot assign requested address

I tried asking Google, Bard, Chatgpt no luck, maybe you know?

how to get key

how i can get the key gpt4free as I try to join the channel but nothing happens and the telegram link is also not working

IndexError: list index out of range

When I asked the bot the following question, he reported an error:

Use java to generate a hello world code

โณ Hang on a sec...

The following is the log printed by docker:

ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-95' coro=<Dispatcher._process_polling_updates() done, defined at /usr/local/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py:407> exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 415, in _process_polling_updates
    for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 235, in process_updates
    return await asyncio.gather(*tasks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 256, in process_update
    return await self.message_handlers.notify(update.message)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
    response = await handler_obj.handler(*args, **partial_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/./main.py", line 155, in chat_handler
    response = await service.chat(call=call)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bot_service.py", line 220, in chat
    result, plugin_name = await self.ws.generate_query(text, self.plugins_dict)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/bot/web_search.py", line 85, in generate_query
    plugin_name = plugin_parts[0]
                  ~~~~~~~~~~~~^^^
IndexError: list index out of range

Hi

lm not a developer not even i did not know how to code please tell me how to deply this on cloud for free

Error when running the bot

I installed all the tokens, but for some reason when it starts it swears at some username

PS D:\Data\Downloads\Telegrambot-with-GPT4free-master> python main.py C:\Users\andre\AppData\Local\Programs\Python\Python311\Lib\site-packages\whisper\timing.py:57: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details. @numba.jit 2023-06-19 16:02:11,264 (asyncio_helper.py:103 MainThread) ERROR - TeleBot: "Unknown error: AttributeError" Traceback (most recent call last): File "D:\Data\Downloads\Telegrambot-with-GPT4free-master\main.py", line 220, in <module> asyncio.run(bot.polling()) File "C:\Users\andre\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\andre\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\andre\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\andre\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\async_telebot.py", line 306, in polling await self._process_polling(non_stop, interval, timeout, request_timeout, allowed_updates) File "C:\Users\andre\AppData\Local\Programs\Python\Python311\Lib\site-packages\telebot\async_telebot.py", line 399, in _process_polling logger.info('Starting your bot with username: [@%s]', self.user.username) ^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'username' Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x00000237B4111B90> Unclosed connector connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x00000237B3FE2E40>, 390.218)]'] connector: <aiohttp.connector.TCPConnector object at 0x00000237B395E310>

bot token error

Hello, I have changed the env example to .env and encountered this problem when running through docker docker-compose up --build -d-
image
image
image

Select from the models or providers

i tried changing the model and ever since thank i keep getting
Select from the models or providers

i have tried restarting bot, delete the DB, it just keeps recurring.

i also regenerated the key and here is the usage from chimeraGPT bot
Screenshot_2023-08-13_10-32-36

Image processing does't working

I started the bot.
Sent the random picture from my gallery
Got this error in terminal:
Error processing file https://api.telegram.org/file/(MY BOT TOKEN)/photos/file_5.jpg: (1, 'Error opening data file /usr/share/tesseract-ocr/4.00/tessdata/script/Devanagari.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'script/Devanagari' Tesseract couldn't load any languages! Could not initialize tesseract.')
2023-06-20 17:20:24,208 (async_telebot.py:542 MainThread) ERROR - TeleBot: "Constructor parameter should be str"

I downloaded Devanagari.traineddata, put into /usr/share/tesseract-ocr/4.00/tessdata/
Changed main.py:31 to -> ocr = botocr.OCR(config=" --psm 3 --oem 3 -l Devanagari")
Got this error in terminal:
2023-06-20 17:47:14,734 (async_telebot.py:542 MainThread) ERROR - TeleBot: "Constructor parameter should be str"

How to fix it?

Stuck on language

Hi, i get the following error on selecting language:
patcher/dispatcher.py:407> exception=TypeError('string indices must be integers')>
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 415, in _process_polling_updates
for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)):
File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 235, in process_updates
return await asyncio.gather(*tasks)
File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
response = await handler_obj.handler(*args, **partial_data)
File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py", line 256, in process_update
return await self.message_handlers.notify(update.message)
File "/usr/local/lib/python3.10/site-packages/aiogram/dispatcher/handler.py", line 117, in notify
response = await handler_obj.handler(*args, **partial_data)
File "/app/./main.py", line 204, in chat
language = available_lang['languages'].get(db.get_settings(call.from_user.id), available_lang['languages']['en'])
TypeError: string indices must be integers

use an ENV variable

just a suggestion, why not use a ENV variable to input the model of interest, this way we don't have to modify the source code.

Image generation don't work

I started the bot.
Sent the /img command
Sent the prompt (cat)
Chose style (Imagine V3)
Selected ratio (1x1)

And nothing happened in tg-bot. But in the terminal i see this:
2023-06-20 17:16:29,810 (async_telebot.py:566 MainThread) INFO - TeleBot: "Received 1 new updates"
An error occurred while making the request: 400, message='Bad Request', url=URL('https://inferenceengine.vyro.ai/sdprem')
An error occurred while writing the image to file: a bytes-like object is required, not 'NoneType'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0xffff606b6140>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0xffff606d4be0>, 458942.560470698)]']
connector: <aiohttp.connector.TCPConnector object at 0xffff606b61d0>
2023-06-20 17:16:30,162 (async_telebot.py:542 MainThread) ERROR - TeleBot: "expected str, bytes or os.PathLike object, not NoneType"

How to fix this?

Many connect errors

All thel list of connection errors:

Bing: ClientConnectorCertificateError: Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]

GeekGpt: HTTPError: 524 Server Error: for url: https://ai.fakeopen.com/v1/chat/completions

Bing: ClientConnectorCertificateError: Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]

Phind: RuntimeError: HTTP Error 403:
GeekGpt: HTTPError: 524 Server Error: for url: https://ai.fakeopen.com/v1/chat/completions

Traceback (most recent call last):
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 308, in _process_update
response = await self.feed_update(bot, update, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 157, in feed_update
response = await self.update.wrap_outer_middleware(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in call
return await handler(event, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/middlewares/user_context.py", line 27, in call
return await handler(event, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 222, in aexit
await self.gen.athrow(typ, value, traceback)
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/fsm/storage/memory.py", line 56, in lock
yield
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/fsm/middleware.py", line 41, in call
return await handler(event, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/telegram.py", line 120, in trigger
return await wrapped_inner(event, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/handler.py", line 42, in call
return await wrapped()
^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 275, in _listen_update
return await self.propagate_event(update_type=update_type, event=event, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 116, in propagate_event
return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 111, in _wrapped
return await self._propagate_event(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 136, in _propagate_event
response = await observer.trigger(event, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/telegram.py", line 120, in trigger
return await wrapped_inner(event, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/handler.py", line 42, in call
return await wrapped()
^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/main.py", line 43, in message_handler
await message.answer(aks_gpt(message.text))
^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/main.py", line 20, in aks_gpt
response = g4f.ChatCompletion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/g4f/init.py", line 75, in create
return result if stream else ''.join(result)
^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/g4f/Provider/retry_provider.py", line 59, in create_completion
self.raise_exceptions()
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/g4f/Provider/retry_provider.py", line 87, in raise_exceptions
raise RuntimeError("\n".join(["RetryProvider failed:"] + [

Bing: ClientConnectorCertificateError: Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]
Phind: RuntimeError: HTTP Error 403:
GeekGpt: HTTPError: 524 Server Error: for url: https://ai.fakeopen.com/v1/chat/completions
ERROR:aiogram.dispatcher:Failed to fetch updates - TelegramNetworkError: HTTP Client says - Request timeout error

Bing: ClientConnectorCertificateError: Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]
GeekGpt: HTTPError: 524 Server Error: for url: https://ai.fakeopen.com/v1/chat/completions
Phind: RuntimeError: HTTP Error 403:
Traceback (most recent call last):
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 308, in _process_update
response = await self.feed_update(bot, update, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 157, in feed_update
response = await self.update.wrap_outer_middleware(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/middlewares/error.py", line 25, in call
return await handler(event, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/middlewares/user_context.py", line 27, in call
return await handler(event, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 222, in aexit
await self.gen.athrow(typ, value, traceback)
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/fsm/storage/memory.py", line 56, in lock
yield
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/fsm/middleware.py", line 41, in call
return await handler(event, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/telegram.py", line 120, in trigger
return await wrapped_inner(event, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/handler.py", line 42, in call
return await wrapped()
^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/dispatcher.py", line 275, in _listen_update
return await self.propagate_event(update_type=update_type, event=event, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 116, in propagate_event
return await observer.wrap_outer_middleware(_wrapped, event=event, data=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 111, in _wrapped
return await self._propagate_event(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/router.py", line 136, in _propagate_event
response = await observer.trigger(event, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/telegram.py", line 120, in trigger
return await wrapped_inner(event, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/aiogram/dispatcher/event/handler.py", line 42, in call
return await wrapped()
^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/main.py", line 43, in message_handler
await message.answer(aks_gpt(message.text))
^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/main.py", line 20, in aks_gpt
response = g4f.ChatCompletion.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/g4f/init.py", line 75, in create
return result if stream else ''.join(result)
^^^^^^^^^^^^^^^
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/g4f/Provider/retry_provider.py", line 59, in create_completion
self.raise_exceptions()
File "/Users/des/PycharmProjects/yummy_gpt_bot/venv/lib/python3.11/site-packages/g4f/Provider/retry_provider.py", line 87, in raise_exceptions
raise RuntimeError("\n".join(["RetryProvider failed:"] + [
RuntimeError: RetryProvider failed:
Bing: ClientConnectorCertificateError: Cannot connect to host www.bing.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')]
GeekGpt: HTTPError: 524 Server Error: for url: https://ai.fakeopen.com/v1/chat/completions
Phind: RuntimeError: HTTP Error 403:

Tts not working

Error screenshot :
Screenshot_20240212_212653_Chrome
It's is possible to add the tts in the response it should add a button of tts in it in every response like cancel and regenerate it also has a tts button when pressed it will send the voice file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.