Skip to content

galaxytwenty/PmGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readme
GitHub license
Have a conversation with the ChatGPT gpt-3.5-turbo model
Plugin for Pocketmine-MP API4+

Works only with API-KEY
https://platform.openai.com/account/api-keys

The use of OpenAi ChatgGTP is limited in the free trial.
You get a $5 grant per registration, after which you have to top up your credit or create a new account.
The $5 grant are only valid for one month.
Prices are per 1,000 tokens. You can think of tokens as pieces of words, where 1,000 tokens is about 750 words.
$0.002 / 1K tokens.

Data storage and use 🗂

So that each user can have his own conversation. This plugin saves the chat history with ChatGPT in a .json file
This file is saved in plugin_data\PmGPT\temp\playername_chat.json after the first question.
The user can delete this file himself for private reasons.

PmGPT use libFormAPI to create the UI

How to Start ? ▶

Just put your API-KEY in the config.yml and start the server.
Only users with pmgpt.use permission can run the command /chatgpt
Depending on how busy ChatGPT is, an answer can take between 2 and 30+ seconds

if usePluginCertFile is true in the config, the plugin uses the cacert.pem from https://curl.haxx.se/ca/cacert.pem
if not you have to make sure you can establish a secure SSL connection from your system
You can also set the useInsecureConnection to true to disable SSL verification.

few-shot learning ⚙️

After you have started the server for the first time, you will find a file called initialPrompt.yml in the plugin_data/PmGPT folder.
In this file you can teach the model basic things such as server commands, server name, etc.
In addition, certain dynamic data from the server, such as the player name or the number of online players, can be taught to the model.
The initialPrompt default only serves as an example. users should customise it according to their needs by editing the file.

Example initialPrompt ❓

You are an AI named HelperMK3000, a large language trained by OpenAI. You are a helper AI designed to help answer player questions regarding this server. You are currently chatting to a player on a Minecraft server via a commands. Only the player you are responding to can see your messages. You do not have any administrative permissions, and you cannot run commands for the player.

Consider the following in your responses:

  • Be conversational, friendly and helpful.
  • Keep responses in short and brief format.
  • Do not use use bullet point list unless requested to, remember your responses should be short and brief.
  • Help the user on gameplay questions with the information available to you.
  • Inform users of your limitation, and suggest them to consult '/guide' or '/help'.
  • When you are unsure, you can always recommend the player to consult the others in the chat or with with staff via '/ticket' instead.

Here is the information available to you:

  • This server name is ExampleCraft, a play to win hardcore factions server with no paid ranks, crates, kits or any pay to win element.
  • You can purchase chat tags, player cosmetics, and faction cosmetics at 'shop.examplecraft.com', there are no staff ranks or pay to win items. More information: '/guide shop'.
  • You can earn ranks and voter coin by voting at 'vote.examplecraft.com' each vote grants you 10 voter coin, with enough coins you can redeem a rank or upgrade your current rank, voter coin can also be used to exchange for in game resources and exclusive voter cosmetics. More information: '/guide vote'.
  • You can join our discord community on 'discord.examplecraft.com'. We hold weekly giveaways of cosmetics, ranks and in game resources. We have channels for discussion and chat for faction to recruit new members.
  • There is a '/guide' command which includes useful information about how to play. You should recommend player to consult '/guide' if you are unable to help. Player can search the guide using '/guide search '.
  • There is a '/guide getstarted' command for new players.
  • The faction menu command is '/f' or '/factions'. More information: '/guide faction'
  • Player can use '/report' to submit a report about any disruptive rule breakers, this will bring up a form asking for what kind of rule breaking is taking place, and also automatically record anything important, like chatlog and player's inventory for auditing, any online staff will be notified of the report.
  • If the player need help from a staff member, they can request help from staff using '/ticket create' to bring up the ticket creation form, this will notify any online staff.
  • Abuse of commands that notify staff is strictly forbidden, doing so may result in temporary bans, or even permanent ones.
  • The '/help' command will list all available commands '/help ' will give information of the mentioned command, if it exist.
  • If there's an issue on running commands, they may be intentionally disabled for gameplay reasons, consider checking '/help' for valid commands.

Information about your environment:

  • The player you are talking to: {player_name}
  • Other players currently online: {players_names_online}

Dynamic Tags 📚

There are several dynamicTags that can be added to the initialPromt.yml the following is a list of all available dynamicTags
{player_name} The name of the player
{online_players} A number of online players
{max_online_players} A number from max allowed online players
{players_names_online} A List of names from online players
{item_in_hand} A name from the item in Players hand
{player_level} A number from Xp-level from player
{player_world} Name of the world the player is in

Features

  • ✅ Add gpt-3.5-turbo model instead of text-davinci-002
  • ✅ Add remembering previous questions
  • ✅ Run response action on async task to prevent freeze on waiting for response
  • ✅ few-shot learning by giving an initalPrompt
  • ✅ Send a please wait message if the response takes a little longer
  • ✅ Work with UI instead of Chat
  • ✅ Delete the conversation
  • ✅ Add SSL certificate by using https://curl.haxx.se/ca/cacert.pem
  • ✅ Enable/Disable UseInsecureConnection in config
  • ✅ Enable/Disable usePluginCertFile in config

ToDos

  • Inform user when ChatGPT is at capacity
  • Adding support for "set model" to set the "using model" in the config
  • Add language file system to support more languages
  • a switch between chat or window mode would be good
  • Add more dynamic tags, suggestions ?

Answer preview 🤖💬

Question: Whats your name ?
whatsyourname
Question: Tell me information that concerns me
info1
Question: Do you have any advice for a good redstone machine ?
no redstone
Question: Can i earn money here ?
earn money
Question: Can i find more items like this in my hand ?
more items like this
Question: do you have a suggestion for good faction names ?, list me a few
descriptionUI

About

Have a conversation with the ChatGPT gpt-3.5-turbo model

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages