From 3ab416a420d770142b62ed8057089194b4d04c2b Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Wed, 11 Oct 2023 17:07:51 +0200 Subject: [PATCH] - update ai commands to 4000 chars - update chat design to follow bard --- commands/message/fun/bard.js | 4 ++-- commands/message/fun/chat.js | 34 ++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/commands/message/fun/bard.js b/commands/message/fun/bard.js index f9386fc..928c52f 100644 --- a/commands/message/fun/bard.js +++ b/commands/message/fun/bard.js @@ -32,7 +32,7 @@ module.exports = { let input = args.text; - let prompt = 'You are a friendly chat bot designed to help people.\n- You should always use gender neutral pronouns when possible.\n- Try to keep your responses under 2000 characters. This isn\'t required for more detailed answers.' + let prompt = 'You are a friendly chat bot designed to help people.\n- You should always use gender neutral pronouns when possible.\n- Try to keep your responses within 2000-4000 characters. This isn\'t required for more detailed answers.' if(args.prompt !== "") prompt = args.prompt if(context.message.messageReference) { @@ -72,7 +72,7 @@ module.exports = { if(!res.body.output) res.body.output = '[Empty Response]' - if(res.body.output.length <= 2000) description.push(res.body.output) + if(res.body.output.length <= 4000) description.push(res.body.output) else { files.push({ filename: `chat.${Date.now().toString(36)}.txt`, diff --git a/commands/message/fun/chat.js b/commands/message/fun/chat.js index b0b33ea..d4e0dc7 100644 --- a/commands/message/fun/chat.js +++ b/commands/message/fun/chat.js @@ -5,10 +5,15 @@ const { canUseLimitedTestCommands, isLimitedTestUser } = require('../../../labsc const { STATICS } = require('../../../labscore/utils/statics'); const superagent = require('superagent') -const { iconPill, smallIconPill, icon } = require('../../../labscore/utils/markdown') +const { iconPill } = require('../../../labscore/utils/markdown') const { Permissions } = require("detritus-client/lib/constants"); +const MODEL_ICONS = { + "CHATGPT": STATICS.chatgpt, + "GPT4": STATICS.openai +} + module.exports = { name: 'chat', label: 'text', @@ -46,18 +51,10 @@ module.exports = { } let model = "CHATGPT" - let modelDisplay = "" - if(args.model && isLimitedTestUser(context.user)){ - model = args.model - modelDisplay = " " + smallIconPill("robot", model) - } + if(args.model && isLimitedTestUser(context.user)) model = args.model let temperature = "0.25" - let temperatureDisplay = "" - if(args.temperature !== 0.25){ - temperature = parseFloat(args.temperature) - temperatureDisplay = " " + smallIconPill("example", temperature) - } + if(args.temperature !== 0.25) temperature = parseFloat(args.temperature) try{ @@ -77,12 +74,12 @@ module.exports = { let inputDisplay = args.text if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...' - let description = [smallIconPill("generative_ai", inputDisplay) + modelDisplay + temperatureDisplay, ''] + let description = [] let files = []; if(!res.body.output) res.body.output = '[Empty Response]' - if(res.body.output.length <= 2000) description.push(res.body.output.substr(0, 2000 - args.text.length)) + if(res.body.output.length <= 4000) description.push(res.body.output) else { files.push({ filename: `chat.${Date.now().toString(36)}.txt`, @@ -90,12 +87,17 @@ module.exports = { }) } + console.log(MODEL_ICONS[model]) + return editOrReply(context, { - embeds:[createEmbed("default", context, { + embeds:[createEmbed("defaultNoFooter", context, { + author: { + iconUrl: MODEL_ICONS[model], + name: inputDisplay + }, description: description.join('\n').substr(), footer: { - text: `This information may be inaccurate or biased • ${context.application.name}`, - iconUrl: STATICS.openai + text: `This information may be inaccurate or biased • ${context.application.name}` } })], files