soyelmismo / chatgpTG

GPT + Telegram = :D
MIT License
17 stars 4 forks source link

Unable to get it work with proxied/custom api #4

Closed AbhayGhante closed 1 year ago

AbhayGhante commented 1 year ago

Error logs:

FileNotFoundError: [Errno 2] No such file or directory: '/config/lang.yml' [nltk_data] Downloading package names to /root/nltk_data... [nltk_data] Package names is already up-to-date! Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/bot/main.py", line 1, in from bot.src.start import run_bot File "/bot/src/start.py", line 13, in from .handlers import message, voice, ocr_image, document, timeout, error File "/bot/src/handlers/message.py", line 6, in from bot.src.utils.gen_utils.phase import ChatGPT File "/bot/src/utils/gen_utils/phase.py", line 1, in from bot.src.utils import proxies File "/bot/src/utils/proxies.py", line 3, in from bot.src.utils import config, database File "/bot/src/utils/config.py", line 47, in with open(config_dir / "lang.yml", 'r') as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/config/lang.yml

soyelmismo commented 1 year ago

oof im sorry. it was a misspelling in the docker-compose file. now it should work normally

please apply these changes to your docker-compose file and try again

AbhayGhante commented 1 year ago

yet new error log

FileNotFoundError: [Errno 2] No such file or directory: '/config/props.yml' [nltk_data] Downloading package names to /root/nltk_data... [nltk_data] Package names is already up-to-date! Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/bot/main.py", line 1, in from bot.src.start import run_bot File "/bot/src/start.py", line 13, in from .handlers import message, voice, ocr_image, document, timeout, error File "/bot/src/handlers/message.py", line 6, in from bot.src.utils.gen_utils.phase import ChatGPT File "/bot/src/utils/gen_utils/phase.py", line 1, in from bot.src.utils import proxies File "/bot/src/utils/proxies.py", line 3, in from bot.src.utils import config, database File "/bot/src/utils/config.py", line 67, in with open(config_dir / "props.yml", 'r') as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/config/props.yml' [nltk_data] Downloading package names to /root/nltk_data... [nltk_data] Package names is already up-to-date! Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/bot/main.py", line 1, in from bot.src.start import run_bot File "/bot/src/start.py", line 13, in from .handlers import message, voice, ocr_image, document, timeout, error File "/bot/src/handlers/message.py", line 6, in from bot.src.utils.gen_utils.phase import ChatGPT File "/bot/src/utils/gen_utils/phase.py", line 1, in from bot.src.utils import proxies File "/bot/src/utils/proxies.py", line 3, in from bot.src.utils import config, database File "/bot/src/utils/config.py", line 67, in with open(config_dir / "props.yml", 'r') as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

soyelmismo commented 1 year ago

Make sure you have all the yml files inside the config directory, it claims props is not there, but it's already on the repo

soyelmismo commented 1 year ago

And there's no updated Dockerfile in your fork

AbhayGhante commented 1 year ago

Oh yh, I forgot to remv old docker built image, but still after everything, This error logs

File "/usr/local/lib/python3.11/dist-packages/yaml/parser.py", line 438, in parse_block_mapping_key raise ParserError("while parsing a block mapping", self.marks[-1], yaml.parser.ParserError: while parsing a block mapping in "/config/api.yml", line 6, column 3 expected , but found '' in "/config/api.yml", line 129, column 4 Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/bot/main.py", line 1, in from bot.src.start import run_bot File "/bot/src/start.py", line 13, in from .handlers import message, voice, ocr_image, document, timeout, error File "/bot/src/handlers/message.py", line 6, in from bot.src.utils.gen_utils.phase import ChatGPT File "/bot/src/utils/gen_utils/phase.py", line 1, in from bot.src.utils import proxies File "/bot/src/utils/proxies.py", line 3, in from bot.src.utils import config, database File "/bot/src/utils/config.py", line 52, in api = yaml.safe_load(f) ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/init.py", line 125, in safe_load return load(stream, SafeLoader) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/init.py", line 81, in load return loader.get_single_data() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/constructor.py", line 49, in get_single_data node = self.get_single_node() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/composer.py", line 55, in compose_document node = self.compose_node(None, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/composer.py", line 127, in compose_mapping_node while not self.check_event(MappingEndEvent): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/parser.py", line 98, in check_event self.current_event = self.state() ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/yaml/parser.py", line 438, in parse_block_mapping_key raise ParserError("while parsing a block mapping", self.marks[-1], yaml.parser.ParserError: while parsing a block mapping in "/config/api.yml", line 6, column 3 expected , but found '' in "/config/api.yml", line 129, column 4

soyelmismo commented 1 year ago

Keep the correct indentation in the yml files. Check the other API you added and count the spaces

AbhayGhante commented 1 year ago

Keep the correct indentation in the yml files. Check the other API you added and count the spaces

oh oky wait

AbhayGhante commented 1 year ago

yeah deployed it successfully. Thanks

AbhayGhante commented 1 year ago

the only issue with telegram is that, when the chatgpt gen response with tables or codes it isn't readable

soyelmismo commented 1 year ago

Yeh sorry, it's hard to make telegram interpret well the markdown code while it's editing the message in real time I think. i already tried to only markdown it when it ends the response but it still giving errors, so i disabled the markdown parsing to avoid errors...

Idk how to fix it at the moment

AbhayGhante commented 1 year ago

Yeh sorry, it's hard to make telegram interpret well the markdown code while it's editing the message in real time I think. i already tried to only markdown it when it ends the response but it still giving errors, so i disabled the markdown parsing to avoid errors...

Idk how to fix it at the moment

But you did a great job making this compatible to work with custom Api. Thank You