adding Docker Scripts and some fixes from fork: https://git.ssh.surf/MrTuxedo/rai-serge-discord-bot

This commit is contained in:
Raven Scott 2023-04-08 02:43:12 +02:00
parent e3c5341561
commit cfa2230986
5 changed files with 50 additions and 1 deletions

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM node:slim
WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev
COPY . .
CMD node rai.js

View File

@ -53,6 +53,9 @@ module.exports = {
console.log(`Prompt: ${prompt.replace("+", " ")}\nResponse: ${response.data.answer}`); console.log(`Prompt: ${prompt.replace("+", " ")}\nResponse: ${response.data.answer}`);
if (!response.data.answer) throw new Error("Did not receive a reply. API error?")
interaction.editReply(response.data.answer); interaction.editReply(response.data.answer);
} catch (err) { } catch (err) {
console.error(err); console.error(err);

View File

@ -25,7 +25,7 @@ module.exports = {
private: true, private: true,
options: [{ options: [{
"name": "model", "name": "model",
"description": `The model you want to run, choose from the following: ${modelList.join(", ")} | Char case matters`, "description": `Choose from the following models: ${modelList.join(", ")} | Char case matters`,
"required": false, "required": false,
"type": 3 "type": 3
}, },

32
docker.compose.yml Normal file
View File

@ -0,0 +1,32 @@
version: '3'
services:
serge-discord-bot:
container_name: serge-discord-bot
build:
context: .
environment:
- NODE_ENV=production
## Env Vars for rAi chatbot
- TOKEN # Pass the value from .env
- PUBLIC_URL
- INTERNAL_IP=serge
- SERGE_PORT=8008
## Default chat settings overrides
- MODEL="gpt4all"
- TEMPERATURE=0.1
- TOPK=50
- TOPP=0.95
- MAXLENGTH=256
- CONTEXTWINDOW=512
- REPEATLASTN=64
- REPEATPENALTY=1.3
- NTHREADS=8
# - INITPROMPT="some custom prompt"
networks:
- serge_default
networks:
serge_default:
external: true

View File

@ -30,6 +30,10 @@ module.exports = async (client) => {
// // Register for a single guild // // Register for a single guild
// await client.guilds.cache.get("GUIDIDHERE").commands.set(arrayOfSlashCommands); // await client.guilds.cache.get("GUIDIDHERE").commands.set(arrayOfSlashCommands);
// Clear previous commands (for changes to installed models)
await client.application.commands.set([]);
// Register for all the guilds the bot is in // Register for all the guilds the bot is in
await client.application.commands.set(arrayOfSlashCommands); await client.application.commands.set(arrayOfSlashCommands);
}); });