mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 14:43:05 -04:00
- update ai commands to 4000 chars
- update chat design to follow bard
This commit is contained in:
parent
8fd752b9b0
commit
3ab416a420
2 changed files with 20 additions and 18 deletions
|
@ -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`,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue