From e0aadaa2cf0a975d4c670ee508f3807ff4291e55 Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Sun, 23 Apr 2023 21:09:27 +0200 Subject: [PATCH] vercel wins --- commands/interaction/slash/gpt.js | 12 ----- .../interaction/subcommands/gpt/alpaca.js | 52 ------------------- .../interaction/subcommands/gpt/chatgpt.js | 51 ------------------ .../subcommands/gpt/claude-instant.js | 51 ------------------ .../interaction/subcommands/gpt/claude.js | 51 ------------------ .../interaction/subcommands/gpt/davinci3.js | 51 ------------------ .../interaction/subcommands/gpt/stablelm.js | 52 ------------------- 7 files changed, 320 deletions(-) delete mode 100644 commands/interaction/slash/gpt.js delete mode 100644 commands/interaction/subcommands/gpt/alpaca.js delete mode 100644 commands/interaction/subcommands/gpt/chatgpt.js delete mode 100644 commands/interaction/subcommands/gpt/claude-instant.js delete mode 100644 commands/interaction/subcommands/gpt/claude.js delete mode 100644 commands/interaction/subcommands/gpt/davinci3.js delete mode 100644 commands/interaction/subcommands/gpt/stablelm.js diff --git a/commands/interaction/slash/gpt.js b/commands/interaction/slash/gpt.js deleted file mode 100644 index b894d87..0000000 --- a/commands/interaction/slash/gpt.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - description: 'Generate text via Large Language Models', - name: 'gpt', - options: [ - require('../subcommands/gpt/chatgpt'), - require('../subcommands/gpt/stablelm'), - require('../subcommands/gpt/davinci3'), - //require('../subcommands/gpt/claude'), - //require('../subcommands/gpt/claude-instant'), - require('../subcommands/gpt/alpaca') - ] -}; \ No newline at end of file diff --git a/commands/interaction/subcommands/gpt/alpaca.js b/commands/interaction/subcommands/gpt/alpaca.js deleted file mode 100644 index b8a0483..0000000 --- a/commands/interaction/subcommands/gpt/alpaca.js +++ /dev/null @@ -1,52 +0,0 @@ -const { Constants } = require('detritus-client'); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; - -const { AI_GPT_MODEL_CONFIG } = require("../../../../labscore/constants"); -const superagent = require('superagent') - -const { createEmbed } = require('../../../../labscore/utils/embed'); -const { codeblock } = require('../../../../labscore/utils/markdown'); -const { format } = require('../../../../labscore/utils/ansi'); - -module.exports = { - description: 'Alpaca-7b (Replicate alpaca-7b)', - name: 'alpaca', - type: ApplicationCommandOptionTypes.SUB_COMMAND, - options: [ - { - name: 'prompt', - description: 'Prompt', - type: ApplicationCommandOptionTypes.STRING, - required: true, - maxLength: 256 - } - ], - run: async (context, args) => { - const MODEL = "replicate:replicate/alpaca-7b" - try{ - let s = Date.now() - await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE}) - - let res = await superagent.get(`${process.env.AI_SERVER}/gpt`) - .query({ - model: MODEL, - prompt: args.prompt - }) - - await context.editOrRespond({ - embeds: [createEmbed("default", context, { - footer: { - iconUrl: `https://derpystuff.gitlab.io/webstorage4/v2/assets/icons/ai/ico_ai_${AI_GPT_MODEL_CONFIG[MODEL].icon}.png`, - text: `${AI_GPT_MODEL_CONFIG[MODEL].name} • ${context.application.name}`, - }, - description: codeblock("ansi", [format(args.prompt, "cyan") + res.body.response.substr(0, 1024).replace(/\\n/g,'\n')]) - })] - }) - }catch(e){ - console.log(e) - await context.editOrRespond({ - embeds: [createEmbed("error", context, "Unable to generate response. Try again in a bit.")] - }) - } - }, -}; \ No newline at end of file diff --git a/commands/interaction/subcommands/gpt/chatgpt.js b/commands/interaction/subcommands/gpt/chatgpt.js deleted file mode 100644 index 3ee1ea2..0000000 --- a/commands/interaction/subcommands/gpt/chatgpt.js +++ /dev/null @@ -1,51 +0,0 @@ -const { Constants } = require('detritus-client'); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; - -const { AI_GPT_MODEL_CONFIG } = require("../../../../labscore/constants"); -const superagent = require('superagent') - -const { createEmbed } = require('../../../../labscore/utils/embed'); -const { codeblock } = require('../../../../labscore/utils/markdown'); - -module.exports = { - description: 'ChatGPT (OpenAI gpt-3.5-turbo)', - name: 'chatgpt', - type: ApplicationCommandOptionTypes.SUB_COMMAND, - options: [ - { - name: 'prompt', - description: 'Prompt', - type: ApplicationCommandOptionTypes.STRING, - required: true, - maxLength: 256 - } - ], - run: async (context, args) => { - const MODEL = "openai:gpt-3.5-turbo" - try{ - let s = Date.now() - await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE}) - - let res = await superagent.get(`${process.env.AI_SERVER}/gpt`) - .query({ - model: MODEL, - prompt: args.prompt - }) - - await context.editOrRespond({ - embeds: [createEmbed("default", context, { - footer: { - iconUrl: `https://derpystuff.gitlab.io/webstorage4/v2/assets/icons/ai/ico_ai_${AI_GPT_MODEL_CONFIG[MODEL].icon}.png`, - text: `${AI_GPT_MODEL_CONFIG[MODEL].name} • ${context.application.name}`, - }, - description: codeblock("ansi", [res.body.response.substr(0, 1024).replace(/\\n/g,'\n')]) - })] - }) - }catch(e){ - console.log(e) - await context.editOrRespond({ - embeds: [createEmbed("error", context, "Unable to generate response. Try again in a bit.")] - }) - } - }, -}; \ No newline at end of file diff --git a/commands/interaction/subcommands/gpt/claude-instant.js b/commands/interaction/subcommands/gpt/claude-instant.js deleted file mode 100644 index 7b6c0fc..0000000 --- a/commands/interaction/subcommands/gpt/claude-instant.js +++ /dev/null @@ -1,51 +0,0 @@ -const { Constants } = require('detritus-client'); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; - -const { AI_GPT_MODEL_CONFIG } = require("../../../../labscore/constants"); -const superagent = require('superagent') - -const { createEmbed } = require('../../../../labscore/utils/embed'); -const { codeblock } = require('../../../../labscore/utils/markdown'); - -module.exports = { - description: 'Claude Instant (Anthropic claude-instant-v1)', - name: 'claude-instant', - type: ApplicationCommandOptionTypes.SUB_COMMAND, - options: [ - { - name: 'prompt', - description: 'Prompt', - type: ApplicationCommandOptionTypes.STRING, - required: true, - maxLength: 256 - } - ], - run: async (context, args) => { - const MODEL = "anthropic:claude-instant-v1" - try{ - let s = Date.now() - await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE}) - - let res = await superagent.get(`${process.env.AI_SERVER}/gpt`) - .query({ - model: MODEL, - prompt: args.prompt - }) - - await context.editOrRespond({ - embeds: [createEmbed("default", context, { - footer: { - iconUrl: `https://derpystuff.gitlab.io/webstorage4/v2/assets/icons/ai/ico_ai_${AI_GPT_MODEL_CONFIG[MODEL].icon}.png`, - text: `${AI_GPT_MODEL_CONFIG[MODEL].name} • ${context.application.name}`, - }, - description: codeblock("ansi", [res.body.response.substr(0, 1024).replace(/\\n/g,'\n')]) - })] - }) - }catch(e){ - console.log(e) - await context.editOrRespond({ - embeds: [createEmbed("error", context, "Unable to generate response. Try again in a bit.")] - }) - } - }, -}; \ No newline at end of file diff --git a/commands/interaction/subcommands/gpt/claude.js b/commands/interaction/subcommands/gpt/claude.js deleted file mode 100644 index eea4efc..0000000 --- a/commands/interaction/subcommands/gpt/claude.js +++ /dev/null @@ -1,51 +0,0 @@ -const { Constants } = require('detritus-client'); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; - -const { AI_GPT_MODEL_CONFIG } = require("../../../../labscore/constants"); -const superagent = require('superagent') - -const { createEmbed } = require('../../../../labscore/utils/embed'); -const { codeblock } = require('../../../../labscore/utils/markdown'); - -module.exports = { - description: 'Claude (Anthropic claude-v1)', - name: 'claude', - type: ApplicationCommandOptionTypes.SUB_COMMAND, - options: [ - { - name: 'prompt', - description: 'Prompt', - type: ApplicationCommandOptionTypes.STRING, - required: true, - maxLength: 256 - } - ], - run: async (context, args) => { - const MODEL = "anthropic:claude-v1" - try{ - let s = Date.now() - await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE}) - - let res = await superagent.get(`${process.env.AI_SERVER}/gpt`) - .query({ - model: MODEL, - prompt: args.prompt - }) - - await context.editOrRespond({ - embeds: [createEmbed("default", context, { - footer: { - iconUrl: `https://derpystuff.gitlab.io/webstorage4/v2/assets/icons/ai/ico_ai_${AI_GPT_MODEL_CONFIG[MODEL].icon}.png`, - text: `${AI_GPT_MODEL_CONFIG[MODEL].name} • ${context.application.name}`, - }, - description: codeblock("ansi", [res.body.response.substr(0, 1024).replace(/\\n/g,'\n')]) - })] - }) - }catch(e){ - console.log(e) - await context.editOrRespond({ - embeds: [createEmbed("error", context, "Unable to generate response. Try again in a bit.")] - }) - } - }, -}; \ No newline at end of file diff --git a/commands/interaction/subcommands/gpt/davinci3.js b/commands/interaction/subcommands/gpt/davinci3.js deleted file mode 100644 index 203f38c..0000000 --- a/commands/interaction/subcommands/gpt/davinci3.js +++ /dev/null @@ -1,51 +0,0 @@ -const { Constants } = require('detritus-client'); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; - -const { AI_GPT_MODEL_CONFIG } = require("../../../../labscore/constants"); -const superagent = require('superagent') - -const { createEmbed } = require('../../../../labscore/utils/embed'); -const { codeblock } = require('../../../../labscore/utils/markdown'); - -module.exports = { - description: 'GPT-3 (OpenAI text-davinci-003)', - name: 'gpt3', - type: ApplicationCommandOptionTypes.SUB_COMMAND, - options: [ - { - name: 'prompt', - description: 'Prompt', - type: ApplicationCommandOptionTypes.STRING, - required: true, - maxLength: 256 - } - ], - run: async (context, args) => { - const MODEL = "openai: text-davinci-003" - try{ - let s = Date.now() - await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE}) - - let res = await superagent.get(`${process.env.AI_SERVER}/gpt`) - .query({ - model: MODEL, - prompt: args.prompt - }) - - await context.editOrRespond({ - embeds: [createEmbed("default", context, { - footer: { - iconUrl: `https://derpystuff.gitlab.io/webstorage4/v2/assets/icons/ai/ico_ai_${AI_GPT_MODEL_CONFIG[MODEL].icon}.png`, - text: `${AI_GPT_MODEL_CONFIG[MODEL].name} • ${context.application.name}`, - }, - description: codeblock("ansi", [res.body.response.substr(0, 1024).replace(/\\n/g,'\n')]) - })] - }) - }catch(e){ - console.log(e) - await context.editOrRespond({ - embeds: [createEmbed("error", context, "Unable to generate response. Try again in a bit.")] - }) - } - }, -}; \ No newline at end of file diff --git a/commands/interaction/subcommands/gpt/stablelm.js b/commands/interaction/subcommands/gpt/stablelm.js deleted file mode 100644 index 96212c1..0000000 --- a/commands/interaction/subcommands/gpt/stablelm.js +++ /dev/null @@ -1,52 +0,0 @@ -const { Constants } = require('detritus-client'); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes } = Constants; - -const { AI_GPT_MODEL_CONFIG } = require("../../../../labscore/constants"); -const superagent = require('superagent') - -const { createEmbed } = require('../../../../labscore/utils/embed'); -const { codeblock } = require('../../../../labscore/utils/markdown'); -const { format } = require('../../../../labscore/utils/ansi'); - -module.exports = { - description: 'StableLM (Stability AI stablelm-tuned-alpha-7b)', - name: 'stablelm', - type: ApplicationCommandOptionTypes.SUB_COMMAND, - options: [ - { - name: 'prompt', - description: 'Prompt', - type: ApplicationCommandOptionTypes.STRING, - required: true, - maxLength: 256 - } - ], - run: async (context, args) => { - const MODEL = "replicate:stability-ai/stablelm-tuned-alpha-7b" - try{ - let s = Date.now() - await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE}) - - let res = await superagent.get(`${process.env.AI_SERVER}/gpt`) - .query({ - model: MODEL, - prompt: args.prompt - }) - - await context.editOrRespond({ - embeds: [createEmbed("default", context, { - footer: { - iconUrl: `https://derpystuff.gitlab.io/webstorage4/v2/assets/icons/ai/ico_ai_${AI_GPT_MODEL_CONFIG[MODEL].icon}.png`, - text: `${AI_GPT_MODEL_CONFIG[MODEL].name} • ${context.application.name}`, - }, - description: codeblock("ansi", [res.body.response.substr(0, 1024).replace(/\\n/g,'\n')]) - })] - }) - }catch(e){ - console.log(e) - await context.editOrRespond({ - embeds: [createEmbed("error", context, "Unable to generate response. Try again in a bit.")] - }) - } - }, -}; \ No newline at end of file