F33RNI / GPT-Telegramus

πŸ’œ The best free Telegram bot for ChatGPT, Microsoft Copilot (aka Bing AI / Sidney / EdgeGPT), Microsoft Copilot Designer (aka BingImageCreator), Gemini and Groq with stream writing, requests with images, multiple languages, admin control, data logging and more!
GNU Affero General Public License v3.0
320 stars 101 forks source link

ARM64 not support google-chrome-stable #147

Closed chelaxian closed 4 months ago

chelaxian commented 4 months ago

ARM64 not support google-chrome-stable

can you please add support of chromium-browser ?

chromium-browser is already the newest version (1:107.0.5304.62-0ubuntu1~ppa1~22.04.1).

chromium-browser --version
Chromium 107.0.5304.62 Ubuntu 22.04
chelaxian commented 4 months ago

i created symbolic link ln -s /usr/bin/chromium-browser /usr/bin/google-chrome

and it seems to start browser as i see in service status that /usr/lib/chromium-browser/chromium-browser is running

root@tg-gpt-bot:~# systemctl status gpt-telegramus
● gpt-telegramus.service - GPT-Telegramus service
     Loaded: loaded (/etc/systemd/system/gpt-telegramus.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-03-10 20:36:25 MSK; 5min ago
   Main PID: 714063 (run.sh)
      Tasks: 56 (limit: 28684)
     Memory: 232.7M
        CPU: 22.959s
     CGroup: /system.slice/gpt-telegramus.service
             β”œβ”€714063 /bin/bash /root/github/GPT/GPT-Telegramus/run.sh
             β”œβ”€714146 venv/bin/python main.py
             β”œβ”€714148 venv/bin/python main.py
             β”œβ”€714150 venv/bin/python main.py
             β”œβ”€714156 venv/bin/python main.py
             β”œβ”€714164 venv/bin/python main.py
             β”œβ”€714168 /usr/lib/chromium-browser/chromium-browser --enable-pinch --disable-infobars >
             β”œβ”€714178 "/usr/lib/chromium-browser/chromium-browser --type=zygote --no-zygote-sandbox>
             β”œβ”€714179 "/usr/lib/chromium-browser/chromium-browser --type=zygote --no-sandbox --head>
             β”œβ”€714195 "/usr/lib/chromium-browser/chromium-browser --type=gpu-process --no-sandbox ->
             β”œβ”€714201 "/usr/lib/chromium-browser/chromium-browser --type=utility --utility-sub-type>
             └─714202 "/usr/lib/chromium-browser/chromium-browser --type=renderer --headless --user>

Mar 10 20:38:36 tg-gpt-bot bash[714148]: [2024-03-10 20:38:36] [714146 ] [INFO   ] Saving users dat>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Reading users da>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Reading users da>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Saving users dat>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Reading users da>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Saving users dat>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Reading users da>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Saving users dat>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] /users command f>
Mar 10 20:38:38 tg-gpt-bot bash[714148]: [2024-03-10 20:38:38] [714146 ] [INFO   ] Reading users da>
lines 1-31/31 (END)

but anyway get same error - ❌ Ошибка: lmao_chatgpt status is not idle btw - no errors about version of chrome in logs

F33RNI commented 4 months ago

https://github.com/F33RNI/LlM-Api-Open/commit/71a04f84a07653844e8060a600ccc4cd63935085

F33RNI commented 4 months ago

https://github.com/F33RNI/GPT-Telegramus/pull/148

F33RNI commented 4 months ago

Please check config in new release

chelaxian commented 4 months ago

tg-bot not responding for chatgpt modules prompts

F33RNI commented 4 months ago

Please provide logs

chelaxian commented 4 months ago

./run.sh

[2024-03-12 12:45:46] [829072 ] [INFO   ] Trying to load and initialize lmao_chatgpt module
[2024-03-12 12:45:46] [829072 ] [INFO   ] Starting _lmao_process_loop as process
[2024-03-12 12:45:46] [829072 ] [INFO   ] Waiting for lmao_chatgpt initialization to finish
[2024-03-12 12:45:46] [829090 ] [INFO   ] Logging setup is complete for process with PID: 829090
[2024-03-12 12:45:46] [829090 ] [INFO   ] _lmao_process_loop started
[2024-03-12 12:45:46] [829090 ] [INFO   ] Initializing lmao_chatgpt
[2024-03-12 12:45:46] [829090 ] [INFO   ] Initializing chatgpt class object
[2024-03-12 12:45:46] [829090 ] [INFO   ] Loading /root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/assistantGetLastMessage.js
[2024-03-12 12:45:46] [829090 ] [INFO   ] Loading /root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/conversationSearch.js
[2024-03-12 12:45:46] [829090 ] [ERROR  ] chatgpt initialization error
Traceback (most recent call last):
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/module_wrapper.py", line 84, in _initialization_thread
    self._module_class.session_start(**kwargs)
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 358, in session_start
    raise e
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 236, in session_start
    cookies_file = self.config.get("cookies_file")
AttributeError: 'list' object has no attribute 'get'
[2024-03-12 12:45:46] [829090 ] [INFO   ] lmao_chatgpt initialization finished
[2024-03-12 12:45:46] [829090 ] [INFO   ] _lmao_stop_stream_loop started
[2024-03-12 12:45:46] [829072 ] [INFO   ] lmao_chatgpt initialization finished

send messege to tg-bot

[2024-03-12 12:47:35] [829072 ] [INFO   ] Starting request_processor for lmao_chatgpt
[2024-03-12 12:47:35] [829072 ] [ERROR  ] Error processing queue
Traceback (most recent call last):
  File "/root/github/GPT/GPT-Telegramus/queue_handler.py", line 210, in _queue_processing_loop
    timeout = self.config.get(request_.module_name).get("timeout_seconds", _TIMEOUT_DEFAULT)
AttributeError: 'list' object has no attribute 'get'
[2024-03-12 12:47:35] [829207 ] [INFO   ] Logging setup is complete for process with PID: 829207
[2024-03-12 12:47:35] [829207 ] [INFO   ] request_processor started
chelaxian commented 4 months ago

AttributeError: 'list' object has no attribute 'get'

F33RNI commented 4 months ago

Check your config file

F33RNI commented 4 months ago

[2024-03-12 12:45:46] [829090 ] [ERROR ] chatgpt initialization error Traceback (most recent call last): File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/module_wrapper.py", line 84, in _initialization_thread self._module_class.session_start(**kwargs) File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 358, in session_start raise e File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 236, in session_start cookies_file = self.config.get("cookies_file") AttributeError: 'list' object has no attribute 'get

Your config.json file is not valid. It must be dictionary not list

chelaxian commented 4 months ago

i redownloaded config.json in root filder of project and filled again with BotFather token and my Telegram ID. same error in log:

[2024-03-12 20:58:15] [852663 ] [INFO   ] Trying to load and initialize lmao_chatgpt module
[2024-03-12 20:58:15] [852663 ] [INFO   ] Starting _lmao_process_loop as process
[2024-03-12 20:58:15] [852663 ] [INFO   ] Waiting for lmao_chatgpt initialization to finish
[2024-03-12 20:58:15] [852681 ] [INFO   ] Logging setup is complete for process with PID: 852681
[2024-03-12 20:58:15] [852681 ] [INFO   ] _lmao_process_loop started
[2024-03-12 20:58:15] [852681 ] [INFO   ] Initializing lmao_chatgpt
[2024-03-12 20:58:15] [852681 ] [INFO   ] Initializing chatgpt class object
[2024-03-12 20:58:15] [852681 ] [INFO   ] Loading /root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/assistantGetLastMessage.js
[2024-03-12 20:58:15] [852681 ] [INFO   ] Loading /root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/conversationSearch.js
[2024-03-12 20:58:15] [852681 ] [ERROR  ] chatgpt initialization error
Traceback (most recent call last):
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/module_wrapper.py", line 84, in _initialization_thread
    self._module_class.session_start(**kwargs)
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 358, in session_start
    raise e
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 236, in session_start
    cookies_file = self.config.get("cookies_file")
AttributeError: 'list' object has no attribute 'get'
[2024-03-12 20:58:15] [852681 ] [INFO   ] lmao_chatgpt initialization finished
[2024-03-12 20:58:15] [852681 ] [INFO   ] _lmao_stop_stream_loop started
[2024-03-12 20:58:15] [852663 ] [INFO   ] lmao_chatgpt initialization finished
chelaxian commented 4 months ago

also recreated cookies - same error

Mar 12 21:05:24 tg-gpt-bot bash[853036]: [2024-03-12 21:05:24] [853034 ] [INFO   ] Starting request_processor for lmao_chatgpt
Mar 12 21:05:24 tg-gpt-bot bash[853036]: [2024-03-12 21:05:24] [853034 ] [ERROR  ] Error processing queue
Mar 12 21:05:24 tg-gpt-bot bash[853036]: Traceback (most recent call last):
Mar 12 21:05:24 tg-gpt-bot bash[853036]:   File "/root/github/GPT/GPT-Telegramus/queue_handler.py", line 210, in _queue_processing_loop
Mar 12 21:05:24 tg-gpt-bot bash[853036]:     timeout = self.config.get(request_.module_name).get("timeout_seconds", _TIMEOUT_DEFAULT)
Mar 12 21:05:24 tg-gpt-bot bash[853036]: AttributeError: 'list' object has no attribute 'get'
chelaxian commented 4 months ago

nevermind, recreate all project from zero and get new cookies.

now error in chrome-driver version

[2024-03-12 21:27:41] [855299 ] [INFO   ] Initializing lmao_chatgpt
[2024-03-12 21:27:41] [855299 ] [INFO   ] Initializing chatgpt class object
[2024-03-12 21:27:41] [855299 ] [INFO   ] Loading /root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/assistantGetLastMessage.js
[2024-03-12 21:27:41] [855299 ] [INFO   ] Loading /root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/conversationSearch.js
[2024-03-12 21:27:41] [855299 ] [INFO   ] Loading cookies from ChatGPT_cookies.json
[2024-03-12 21:27:41] [855299 ] [INFO   ] Loaded 19 cookies
[2024-03-12 21:27:41] [855299 ] [INFO   ] Adding chrome options
[2024-03-12 21:27:41] [855299 ] [INFO   ] Using user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
[2024-03-12 21:27:41] [855299 ] [INFO   ] Initializing driver in headless mode
[2024-03-12 21:27:41] [855299 ] [INFO   ] Browser executable path: /usr/bin/chromium-browser
[2024-03-12 21:27:41] [855299 ] [INFO   ] Running /usr/bin/chromium-browser --version
[2024-03-12 21:27:41] [855299 ] [INFO   ] Detected major version: 107
[2024-03-12 21:27:41] [855299 ] [INFO   ] patching driver executable /root/.local/share/undetected_chromedriver/undetected_chromedriver
[2024-03-12 21:27:41] [855299 ] [ERROR  ] chatgpt initialization error
Traceback (most recent call last):
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/module_wrapper.py", line 84, in _initialization_thread
    self._module_class.session_start(**kwargs)
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 358, in session_start
    raise e
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 299, in session_start
    self.driver = undetected_chromedriver.Chrome(
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 50, in __init__
    self.service.start()
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self._start_process(self._path)
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 208, in _start_process
    self.process = subprocess.Popen(
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/root/.local/share/undetected_chromedriver/undetected_chromedriver'
[2024-03-12 21:27:41] [855299 ] [INFO   ] lmao_chatgpt initialization finished
[2024-03-12 21:27:41] [855299 ] [INFO   ] _lmao_stop_stream_loop started
[2024-03-12 21:27:41] [855281 ] [INFO   ] lmao_chatgpt initialization finished 
[2024-03-12 21:29:30] [855675 ] [ERROR  ] Error processing request
Traceback (most recent call last):
  File "/root/github/GPT/GPT-Telegramus/request_processor.py", line 104, in request_processor
    module.process_request(request_)
  File "/root/github/GPT/GPT-Telegramus/module_wrapper_global.py", line 227, in process_request
    raise Exception(f"{self.name} status is not idle")
Exception: lmao_chatgpt status is not idle
[2024-03-12 21:29:30] [855281 ] [INFO   ] Setting prevent_shutdown_flag
[2024-03-12 21:29:30] [855281 ] [INFO   ] Trying to kill lmao_chatgpt process with PID 855675
[2024-03-12 21:29:31] [855281 ] [INFO   ] Killed? True
[2024-03-12 21:29:31] [855281 ] [INFO   ] Container with ID 695689250 (PID 855675) was removed from the queue
[2024-03-12 21:29:35] [855281 ] [INFO   ] Clearing prevent_shutdown_flag
chelaxian commented 4 months ago

OSError: [Errno 8] Exec format error: '/root/.local/share/undetected_chromedriver/undetected_chromedriver'

Exception: lmao_chatgpt status is not idle

F33RNI commented 4 months ago

Make sure you have read, write and execute permissions on your browser's executable

F33RNI commented 4 months ago

You can try

sudo chmod 777 /root/.local/share/undetected_chromedriver/undetected_chromedriver
F33RNI commented 4 months ago

Please try to install any other chromium-based browser and check if it works properly before using lmao api

chelaxian commented 4 months ago

rising permision not helped - same error

[2024-03-13 19:57:00] [923823 ] [INFO   ] Initializing driver in headless mode
[2024-03-13 19:57:00] [923823 ] [INFO   ] Browser executable path: /usr/bin/chromium-browser
[2024-03-13 19:57:00] [923823 ] [INFO   ] Running /usr/bin/chromium-browser --version
[2024-03-13 19:57:00] [923823 ] [INFO   ] Detected major version: 107
[2024-03-13 19:57:00] [923823 ] [INFO   ] patching driver executable /root/.local/share/undetected_chromedriver/undetected_chromedriver
[2024-03-13 19:57:00] [923823 ] [ERROR  ] chatgpt initialization error
OSError: [Errno 8] Exec format error: '/root/.local/share/undetected_chromedriver/undetected_chromedriver'
chelaxian commented 4 months ago

tried Brave Browser - same error

[2024-03-13 21:07:26] [4649   ] [INFO   ] Adding chrome options
[2024-03-13 21:07:26] [4649   ] [INFO   ] Using user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
[2024-03-13 21:07:26] [4649   ] [INFO   ] Initializing driver in headless mode
[2024-03-13 21:07:26] [4649   ] [INFO   ] Browser executable path: /usr/bin/brave-browser
[2024-03-13 21:07:26] [4649   ] [INFO   ] Running /usr/bin/brave-browser --version
[2024-03-13 21:07:26] [4649   ] [INFO   ] Detected major version: 122
[2024-03-13 21:07:26] [4649   ] [INFO   ] patching driver executable /root/.local/share/undetected_chromedriver/undetected_chromedriver
[2024-03-13 21:07:26] [4649   ] [ERROR  ] chatgpt initialization error
Traceback (most recent call last):
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/module_wrapper.py", line 84, in _initialization_thread
    self._module_class.session_start(**kwargs)
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 358, in session_start
    raise e
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/lmao/chatgpt/chatgpt_api.py", line 299, in session_start
    self.driver = undetected_chromedriver.Chrome(
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 466, in __init__
    super(Chrome, self).__init__(
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 50, in __init__
    self.service.start()
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self._start_process(self._path)
  File "/root/github/GPT/GPT-Telegramus/venv/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 208, in _start_process
    self.process = subprocess.Popen(
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/root/.local/share/undetected_chromedriver/undetected_chromedriver'
F33RNI commented 4 months ago

Did you tried this? https://stackoverflow.com/a/53952226

chelaxian commented 4 months ago

finaly i fixed it.

steps to fix:

  1. remove/purge all browsers and install chromium
  2. install chromium driver
  3. explicitly set browser and driver executable path in lmao config
  4. run
sudo apt install chromium-browser
sudo apt install chromium-chromedriver
nano module_configs/lmao_chatgpt.json
    "__comment08__": "Path to browser executable or empty to auto-detect (ex. /usr/bin/google-chrome-stable)",
    "browser_executable_path": "/usr/bin/chromium-browser",

    "__comment09__": "Major version of browser to pass as version_main argument or null to auto-detect (ex. 122)",
    "version_main_manual": 107,

    "__comment10__": "Path to driver executable to pass as driver_executable_path argument or empty for auto",
    "__comment11__": "It's recommended ot leave this empty",
    "driver_executable_path": "/usr/lib/chromium-browser/chromedriver",

now ChatGPT lmao-module works on Ubuntu22.04 arm64 (no GUI).