mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
allow model changing for approved users
This commit is contained in:
parent
b56a0730f6
commit
32bf8bf119
2 changed files with 25 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
const { createEmbed } = require('../../../labscore/utils/embed')
|
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||||
const { editOrReply } = require('../../../labscore/utils/message')
|
const { editOrReply } = require('../../../labscore/utils/message')
|
||||||
|
|
||||||
const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing')
|
const { canUseLimitedTestCommands, isLimitedTestUser } = require('../../../labscore/utils/testing')
|
||||||
const { STATICS } = require('../../../labscore/utils/statics');
|
const { STATICS } = require('../../../labscore/utils/statics');
|
||||||
|
|
||||||
const superagent = require('superagent')
|
const superagent = require('superagent')
|
||||||
|
@ -21,6 +21,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
args: [
|
args: [
|
||||||
{ name: 'prompt', default: '', required: false, help: "The starting system prompt." },
|
{ name: 'prompt', default: '', required: false, help: "The starting system prompt." },
|
||||||
|
{ name: 'model', default: 'CHATGPT', required: false, help: "The model to use. (Restricted to CHATGPT)" },
|
||||||
],
|
],
|
||||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.ATTACH_FILES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.ATTACH_FILES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||||
run: async (context, args) => {
|
run: async (context, args) => {
|
||||||
|
@ -31,6 +32,9 @@ module.exports = {
|
||||||
let prompt = 'You are a friendly chat bot designed to help people. You should always use gender neutral pronouns when possible.'
|
let prompt = 'You are a friendly chat bot designed to help people. You should always use gender neutral pronouns when possible.'
|
||||||
if(args.prompt !== "") prompt = args.prompt
|
if(args.prompt !== "") prompt = args.prompt
|
||||||
|
|
||||||
|
let model = "CHATGPT"
|
||||||
|
if(args.model && isLimitedTestUser(context.user)) model = args.model
|
||||||
|
|
||||||
try{
|
try{
|
||||||
await editOrReply(context, createEmbed("ai", context, "Generating response..."))
|
await editOrReply(context, createEmbed("ai", context, "Generating response..."))
|
||||||
|
|
||||||
|
@ -42,7 +46,7 @@ module.exports = {
|
||||||
prompt: prompt,
|
prompt: prompt,
|
||||||
input: [args.text],
|
input: [args.text],
|
||||||
temperature: 0.6,
|
temperature: 0.6,
|
||||||
model: "CHATGPT"
|
model: model
|
||||||
})
|
})
|
||||||
|
|
||||||
let description = [smallIconPill("generative_ai", args.text), '']
|
let description = [smallIconPill("generative_ai", args.text), '']
|
||||||
|
|
|
@ -7,6 +7,21 @@ if(process.env.TESTING_CHANNEL_IDS) LIMITED_TEST_CHANNELS = process.env.TESTING_
|
||||||
let LIMITED_TEST_USERS;
|
let LIMITED_TEST_USERS;
|
||||||
if(process.env.TESTING_USER_IDS) LIMITED_TEST_USERS = process.env.TESTING_USER_IDS.split(';')
|
if(process.env.TESTING_USER_IDS) LIMITED_TEST_USERS = process.env.TESTING_USER_IDS.split(';')
|
||||||
|
|
||||||
|
function isLimitedTestGuild(guild){
|
||||||
|
if(LIMITED_TEST_GUILDS && LIMITED_TEST_GUILDS.includes(guild.id)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLimitedTestChannel(channel){
|
||||||
|
if(LIMITED_TEST_CHANNELS && LIMITED_TEST_CHANNELS.includes(channel.id)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLimitedTestUser(user){
|
||||||
|
if(LIMITED_TEST_USERS && LIMITED_TEST_USERS.includes(user.id)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function canUseLimitedTestCommands(context){
|
function canUseLimitedTestCommands(context){
|
||||||
if(LIMITED_TEST_GUILDS && LIMITED_TEST_GUILDS.includes(context.guild.id)) return true;
|
if(LIMITED_TEST_GUILDS && LIMITED_TEST_GUILDS.includes(context.guild.id)) return true;
|
||||||
if(LIMITED_TEST_CHANNELS && LIMITED_TEST_CHANNELS.includes(context.channel.id)) return true;
|
if(LIMITED_TEST_CHANNELS && LIMITED_TEST_CHANNELS.includes(context.channel.id)) return true;
|
||||||
|
@ -15,5 +30,8 @@ function canUseLimitedTestCommands(context){
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
canUseLimitedTestCommands
|
canUseLimitedTestCommands,
|
||||||
|
isLimitedTestGuild,
|
||||||
|
isLimitedTestChannel,
|
||||||
|
isLimitedTestUser
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue