Giter VIP home page Giter VIP logo

vixshan / mimo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from firtoz/gpt-shell

1.0 0.0 0.0 58.48 MB

mimo is a discord chatbot utilising GPT-Shell's source code. MochiGPT is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT. Also allows creating Dalle2 images.

Home Page: https://erin.ac?ref=github

License: MIT License

TypeScript 99.64% Procfile 0.01% Shell 0.21% Nix 0.14%

mimo's Introduction

Mimo

โ— This is a work in progress โ—

Mimo is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT.

It allows users to converse with a virtual companion. It uses nodejs and typescript. to create a seamless conversation experience.

It can also generate images based on your conversation!

4_5888485297657745744.1.online-video-cutter.com.mp4

Try it out

You can try Mimo on the official Discord server:

Usage

To interact with Mimo, users can:

  • Use the /mimo command to start a conversation with Mimo
  • Ping Mimo in a channel she's in
  • DM Mimo

The /mimo command will start a new conversation thread, and whenever the user types something, Mimo will respond.

Mimo is able to handle multiple conversations at once, so you can start as many conversations as you like.

Bot Setup

Set up a discord bot here and add it to your server.

Scopes:

  • bot
  • application.commands

Bot Permissions:

  • read messages/view channels
  • send messages
  • create public threads
  • create private threads
  • send messages in threads
  • embed links
  • attach files
  • use slash commands

You also need to enable the Message Content Intent:

Expand to see image

image

Setup

Prerequisites:

  • Nodejs: (18 or above)

  • pm2: To keep your bot alive even after killing your terminal.

To use Mimo, you will need to:

  • Clone the project:
git clone https://github.com/vixshan/mimo.git
  • Open the terminal in the project's folder:
cd mimo

(in windows, right click somewhere in the folder and select "Open In Terminal") if you see something about powershell, type cmd and hit enter, to go to the simpler command line terminal.

  • Install dependancies:
npm install
yarn install
  • Set up environment variables

Setting up Environment Variables

The following environment variables are required for Mimo to work properly.

You can set the environment variables in any way you like, or place an .env.local file at the root of your project (rename example.env.local to .env.local), Ensure that your .env.local looks like this:

[EXPAND] Click to see `.env.local`
# MongoDB:
MONGODB_URI=
DB_NAME=mimo

# Bot Token from Discord:

BOT_TOKEN=

# Commands:

COMMAND_NAME=mimo PRIVATE_COMMAND_NAME=private CONFIG_COMMAND_NAME=config
CUSTOM_PROMPT_COMMAND_NAME=prompt DRAW_COMMAND_NAME=draw

# Discord Server Details:

MAIN_SERVER_ID= LOG_CHANNEL_ID= MAIN_SERVER_INVITE= ADMIN_PING_ID=
USE_SAME_API_KEY_FOR_ALL=false IGNORE_INIT=false

MongoDB:

  • MONGODB_URI: The MongoDB connection string.
    • Should look something like this: mongodb+srv://:..mongodb.net/?retryWrites=true&w=majority
  • DB_NAME: The name of the collection in MongoDB. You can use CHAT_DB or anything you like.

Bot Token:

  • BOT_TOKEN: The Discord bot token
    • You can get it from your Discord Dev Portal by selecting your app and then selecting "Bot".

Commands:

  • COMMAND_NAME: The main command for chat initialisation.
  • PRIVATE_COMMAND_NAME: Command to create private threads.
  • CONFIG_COMMAND_NAME: The name of the config command
  • CUSTOM_PROMPT_COMMAND_NAME: (Optional) The name of the command for custom prompts
  • DRAW_COMMAND_NAME: (Optional) The name of the draw command.

Discord Server Details:

  • MAIN_SERVER_ID: The Discord server where the bot lives

  • LOG_CHANNEL_ID: (Optional) The channel for log messages

  • MAIN_SERVER_INVITE: (Optional) The ideally non-expiring server invite link (if you want users to add the bot to their server)

  • USE_SAME_API_KEY_FOR_ALL: (Optional) When set to 'true', it will allow any server or user to use the bot without needing to provide their own API keys.

  • ADMIN_PING_ID: Bot owner's Discord id (that's you!)

    Used to let you send some special commands and configure the bot.

  • IGNORE_INIT: (Optional) When set to 'true', when it starts, will not check active threads for new messages since the bot was last online. If you're in many servers, there may be many active threads, so that would hit a rate limit. In that case, it's better to handle messages as they come, instead of checking many threads at once.

Extras:

Start your bot

Set up the environment variables as described above.

  • Install pm2:

With npm:


npm install pm2 -g

With yarn:


yarn global add pm2

With debian, use the install script:


apt update && apt install sudo curl && curl -sL
https://raw.githubusercontent.com/Unitech/pm2/master/packager/setup.deb.sh |
sudo -E bash -

  • Then to start a development environment, run

npm run dev

This way, whenever you change the code, it will restart the bot to update.

  • To build and start the bot, run

npm run build

and then


npm start

You can also run npm run start to start the bot.

  • NOTE: running npm start or npm run start will start the bot with PM2 and give it the name "mimo". You can replace "mimo" with a name of your choice in package.json. It will also show logs for the PM2 running processes and save them.

NOTE: If you get the error:

[PM2][ERROR] Script already launched, add -f option to force re-execution

It means that mimo is already running. You can delete her by running the following command followed by the command to start mimo, i.e. npm run start:

pm2 delete mimo
npm run start

Or simply restart it by running:

pm2 restart mimo
  • If you are in dev environment, use node . or npm run dev to test your code:
node .

Once you are satisfied with the changes run:

pm2 restart mimo && pm2 logs

You can also restart it from the pm2.io dashboard as shown bellow:

Expand to see image

image

Configuration

Go to your server, and type the config command, and set the API key for your server.

/config
Expand to see config image

config-api-key.png

Long-Term Memory

Starting from 2.0.0, Mimo has the capacity to have a long-term memory.

Expand to see how to configure long term memory.

This functionality is experimental, but internal testing shows that it works quite well for typical conversation.

Does not work so well if the conversation has long pieces of code, because of token limitations.

How it works:

  • Mimo creates embeddings for every message in the conversation
  • if the conversation is short, all the conversation history is included in the prompt
  • if the conversation is long enough, when a new message is sent, that message's embedding is compared to the conversation history, and only the most relevant messages will be included in the prompt.

To set this up, use the config command on the main server:

/config

config.png

Then enter the pinecone configuration details.

You can create an account at https://app.pinecone.io/.

If you did it correctly, you should see something like this:

config-set.png

Custom Prompts

By default, Mimo behaves like a helpful software engineer.

If you want Mimo to behave differently, you can use a custom prompt.

This can be done in a new channel dedicated to Mimo, or a new conversation thread, or in DMs.

You can use the /prompt command, if you have the permissions, and you can set the custom prompt for Mimo by filling the form.

This command can be used in:

  • channels (if you are a server admin)
  • threads (if you are the one who created the thread)
  • DMs

The temperature is the same as OpenAI's temperature parameter. 0 means it becoems repetitive, 1 means it becomes a bit chaotic. Default is 0.8 for Mimo.

custom-prompt.png

Contributions

We welcome contributions to Mimo. If you have an idea for a new feature or have found a bug, please open an issue on GitHub. We would also appreciate any sponsorships or donations.

You can sponsor us through our GitHub sponsor page here.

License

Mimo is released under the MIT License.

mimo's People

Contributors

firtoz avatar vixshan avatar dependabot[bot] avatar techcoderx avatar renovate[bot] avatar snyk-bot avatar

Stargazers

 avatar

mimo's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/node.js.yml
  • actions/checkout v4
  • actions/setup-node v3
npm
.yarn/sdks/typescript/package.json
package.json
  • @firtoz/openai-wrappers ^3.0.3
  • axios 1.3.5
  • canvas ^2.11.2
  • discord-interactions ^3.3.0
  • discord.js ^14.9.0
  • dotenv ^16.0.3
  • gpt3-tokenizer ^1.1.5
  • lodash ^4.17.21
  • mongodb ^4.12.1
  • openai ^3.3.0
  • pinecone-client ^1.1.0
  • pm2 ^5.3.0
  • pnpapi ^0.0.0
  • ts-toolbelt ^9.6.0
  • tsc ^2.0.4
  • uuid ^9.0.0
  • @types/lodash ^4.14.194
  • @types/pnpapi ^0.0.3
  • @types/rimraf ^4.0.5
  • @types/uuid ^9.0.1
  • cross-env ^7.0.3
  • nodemon ^3.0.1
  • rimraf ^5.0.5
  • ts-node ^10.9.1
  • ts-node-dev ^2.0.0
  • typescript 5.2.2
  • vite ^4.2.2
  • vitest ^0.34.6
  • yarn 3.6.4

  • Check this box to trigger a request for Renovate to run again on this repository

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.