Giter VIP home page Giter VIP logo

Comments (16)

dtimekeeper avatar dtimekeeper commented on August 23, 2024 1

Boom, that was it and it’s up and running like a charm. Thank you, sir.

Really also appreciate that your code has the routine to clear the conversation after x seconds so I can always start fresh instead of manually clearing it.

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024 1

@dtimekeeper Thanks for your suggestions.

Would you mind copy and paste these suggestions to a new issue that I can easily work with? I will have a conversation with you there. Thanks.

from chatgpt-telegram-bot.

peteisacat avatar peteisacat commented on August 23, 2024 1

@peteisacat Consider follow the instructions above. This may help you solve the problem.

@flynnoct Thank you very much. I have successfully run it according to the method you described above. Thank you for your hard work.😄❤️

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024

Can you get a reply message when you send "/start" command to your bot?

from chatgpt-telegram-bot.

dtimekeeper avatar dtimekeeper commented on August 23, 2024

Hmm, same issue here, sending /start shows 2 tick marks in Telegram for read but no reply, and the bot shows as started without any errors. Is there a debug log maybe?

from chatgpt-telegram-bot.

peteisacat avatar peteisacat commented on August 23, 2024

Can you get a reply message when you send "/start" command to your bot?

No matter what message I send, my robot won't respond with any content。

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024

Hmm, same issue here, sending /start shows 2 tick marks in Telegram for read but no reply, and the bot shows as started without any errors. Is there a debug log maybe?

Sorry, we didn't have a good logging for now :(, I promise we will do this in a few days.
Would you mind following these introductions:

  1. cd to the work directory, it's <somewhere>/chatgpt-telegram-bot
  2. execute python3 telegram_message_parser.py
  3. try to send a message to your bot and check if there is any traceback prompt in your terminal.

Apologize for not having good outputs and loggings again.
@dtimekeeper @peteisacat

from chatgpt-telegram-bot.

dtimekeeper avatar dtimekeeper commented on August 23, 2024

No worries - thank you for your response. I’ve ran the telegram_message_parser.py with the output below:

aaron@artemis:~/chatgpt-dalle-telegram$ python3 telegram_message_parser.py
Traceback (most recent call last):
  File "/home/aaron/chatgpt-dalle-telegram/telegram_message_parser.py", line 21, in <module>
    config_dict = json.load(f)
  File "/home/aaron/anaconda3/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/home/aaron/anaconda3/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/home/aaron/anaconda3/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/aaron/anaconda3/lib/python3.9/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 4 column 29 (char 184)
(base) aaron@artemis:~/chatgpt-dalle-telegram$

Please let me know if there’s anything else I can provide.

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024

@dtimekeeper Looks like a config file error. Would you mind paste your config.json contents below?

DO Make sure to hide both of your openai_api_key and telegram_bot_token, just replace them with placeholders.

from chatgpt-telegram-bot.

dtimekeeper avatar dtimekeeper commented on August 23, 2024

Sure thing:

{ 
����"openai_api_key": "xxx",
����"telegram_bot_token": "xxx",
����"enable_voice": true,   // When enabled, Bot will accept audio messages with Whisper and reply.
����"allowed_users": [ 
��������"xxx",
����], 
����"wait_time": 600,   // The time limit in seconds that the Bot will clear the conversation context.
����"enable_dalle": true,   // When enabled, Bot will involve DALL·E to handle requests for painting.
����"super_users": [ 
��������"xxx",    // Super users are granted unlimited usage on DALL·E per day.
����], 
����"image_generation_limit_per_day": 5     // The upper limit that a normal user is allowed to invoke DALL·E per day.
}

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024

I think the problem could come from invalid comments in the JSON file.

Try removing all comments in your config.json file which means removing all // some comments and start again. I think it should work.

We actually should comment the keys in a better way. We will fix that in next version. Thanks.

from chatgpt-telegram-bot.

dtimekeeper avatar dtimekeeper commented on August 23, 2024

I believe I’ve cleaned out the comments but still get the error - at least it’s a different line now? :):

(base) aaron@artemis:~/chatgpt-dalle-telegram$ python3 telegram_message_parser.py
Traceback (most recent call last):
  File "/home/aaron/chatgpt-dalle-telegram/telegram_message_parser.py", line 21, in <module>
    config_dict = json.load(f)
  File "/home/aaron/anaconda3/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/home/aaron/anaconda3/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/home/aaron/anaconda3/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/aaron/anaconda3/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 7 column 5 (char 228)
(base) aaron@artemis:~/chatgpt-dalle-telegram$ 
{
����"openai_api_key": "xxx",
����"telegram_bot_token": "xxx",
����"enable_voice": true,
����"allowed_users": [
��������"xxx",
����],
����"wait_time": 600,
����"enable_dalle": true,
����"super_users": [
��������"xxx",
����], 
����"image_generation_limit_per_day": 5
}

The Telegram bot key has some funky letters like ___ and : so maybe it might be that?

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024

@dtimekeeper Both allowed_users and super_users are JSON lists. Elements inside should be split with commas(,), however, no comma needed after last element.

So try removing commas in line 6 and line 11.

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024

@dtimekeeper A robust program should work in this way. Glad you like it.

If there's more advices or suggestions please let me know.

from chatgpt-telegram-bot.

flynnoct avatar flynnoct commented on August 23, 2024

@peteisacat Consider follow the instructions above. This may help you solve the problem.

from chatgpt-telegram-bot.

dtimekeeper avatar dtimekeeper commented on August 23, 2024

@dtimekeeper A robust program should work in this way. Glad you like it.

If there's more advices or suggestions please let me know.

It really should, but neither of the 3-4 other python options I tried had that.

Suggestions wise, one of use cases is basically running another instance for my friends to use as a telegram bot. It would be helpful to have a way to ‘whitelist’ all telegram IDs so as long as they know the link to message it, they can talk to the bot.

Related to this too, but not sure how feasible it is, would be separate conversational context for each person that messages the bot, but I’m also not sure if this is even possible with the API.

Thanks again.

from chatgpt-telegram-bot.

Related Issues (20)

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.