Hiya!
Saw a post here about asking for a ChatGPT command and thought that was a fun and good idea!
I’ve put something quickly together, not very well tested, but aye, throw some questions at it and let me know if it breaks.
Everytime you call this api it’s considered a new conversation. You will receive a hastag and a code and the end of every message. This is a reference to your personal conversation.
Use this hashtag and code as first part of a new message to continue the conversation.
Automatic installation:
Visit xgpt.gerhard.dev/dashboard and sign in with Nightbot to install this command with just a click.
When you sign in to our dashboard you will be able to customize settings for your personal AI chatbot. Give the bot more and detailed instructions for just your stream. Provide attional information about you or your stream, so the bot can answer more specific questions. Want the bot to speak in a certain language, a certain way, include emojis, be more funny? Endless opportunities and alot of fun!
You’ll also be able to use your own OpenAI API key to avoid monthly limits, which we highly recommend!
This service is free to use, however the OpenAI API does cost money based on the amount of requests made. While it’s fun to see more people using this command, this does increase the monthly bill. If you like this command and want to support this project, consider helping with these monthly costs or buy me a beer with a one-time contribution: Sponsor @xgerhard on GitHub Sponsors · GitHub
The hashtag and numbers lets you continue the conversation with the chatgpt bot. Otherwise each time you talk to it would be a unique interaction. But if you use the hashtag amd numbers it picks up the convesation where you left off.
great custom api! I’ve integrated this into my chat as well. Is there anyway to bake in a character limit? or at least force nightbot to not send multiple long messages in the chat? Maybe over a certain length it can go to a whisper? Just a suggestion. I think it’s awesome though!
Hiya, thanks for trying it out! Replying to whisper is not an option. As explained in the first post, if you want shorter responses you can specify it in your message, for example: “explain pi in 100 characters”.
EDIT: the API has been updated, and the following message is no longer up-to-date, you don’t need to add the extra string to “fix” the command, so feel free to disregard this message, leaving it up for posterity/context.
If you want to make ChatGPT (attempt to) shorten its answers without having to write it in every time, so it doesn’t cut the message with ellipsis, you can edit the command as such:
It adds the following string to your request for every command call: “answer in 150 characters or less.”
I limited to 150 characters because I noticed that it seems to cuts the message at around 165 characters.
It works fairly well, but there are still mishaps sometimes.
I have really been hammering on this and outside of a few cannot reach external server errors it has been a blast. I am wondering if it is possible to make a call to xgpt from another script. I was hoping to have it recognize an input from the sending action…
[This Code I Have]
$(user), You drew $(eval responses=[The Fool!,The Magician!,The High Priestess!,The Empress!,The Emperor!,The Hierophant!,The Lovers!,The Chariot!,Justice!,Strength!,The Hermit!,Wheel of Fortune!,The Hanged Man!,Death!,Temperance!,The Devil!,The Tower!,The Star!,The Moon!,The Sun!,Judgement!,The World!];responses[Math.floor(Math.random()*responses.length)])
User:!tarot
Nightbot $(user) you chose ‘INSERT-CARD-NAME-HERE’
[Alias Call Here]
This is where I am confused how to pass of the results of command a to another command called from the !alias
[This is the code I am looking to Create]
Ex: !xgpt What is the meaning of INSERT-CARD-NAME-HERE in Tarot?
(Getting the input from !tarot results)
Nightbot: xgtp: INSERT-CARD-NAME-HERE in Tarot means Blah Blah Blah
What I am imagining is creating an in between command at the End of the Tarot command and then handing that off to xgtp? I am just lost at where to start.
An alias overrides the output of the first command, so what you’re trying to do is not possible.
And using an AI to pull the meaning of the cards could be a bit excessive, what makes me say that is that you already made a similar topic that has a better/simpler/easier solution in my opinion.
Thank you for this Emily! Could I adjust that 150 value to 350, or whatever my own character limit is? And I’d do what you did and dial it back just before that limit as well.
EDIT: the API has been updated, and the following message is no longer up-to-date, you don’t need to add the extra string to “fix” the command, so feel free to disregard this message, leaving it up for posterity/context.
From my experience, the output is cut short with ellipsis at 165 characters, regardless of the platform limit, I’m really not sure why.
But if you want to increase it to 350, I highlighted the number you’d need to edit:
Thanks for testing this! I now send an extra message with every request: “answer in X characters or less”.
So this extra part should not be needed anymore, but everyone can choose their own character limits ofcourse.
I put an X, since I dont have the exact number yet, I’m playing around with this number and a max_tokens value I can send to the ChatGPT API, which is their sort of way of counting words/characters. Trying to find the sweet spot between not reaching timeout limits for Nightbot, and also not sending cut off responses.
So please try it out, and let me know your findings. If responses are cut off frequently or commands are timing out I can adjust these numbers.
Hiya, saw you posted this messages a couple hours ago, I updated the api (see message above) after that which should hopefully fix most of these timeout messages.
It’s been working perfectly for a few hours. It does not show the error of “Error Connecting To Remote Server” or “ChatGPT took to long to respond. Please try again in a bit. ResidentSleeper”
Thank you!