mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 22:23:03 -04:00
fix palm
This commit is contained in:
parent
5c5aba0c48
commit
cd5e9ceb4a
6 changed files with 10 additions and 28 deletions
|
@ -28,9 +28,6 @@ module.exports = {
|
||||||
if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (text).`))
|
if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (text).`))
|
||||||
|
|
||||||
let input = args.text;
|
let input = args.text;
|
||||||
|
|
||||||
let inputDisplay = args.text.replace(/\n/g, ' ')
|
|
||||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
await editOrReply(context, createEmbed("ai_custom", context, STATIC_ICONS.ai_bard))
|
await editOrReply(context, createEmbed("ai_custom", context, STATIC_ICONS.ai_bard))
|
||||||
|
@ -59,7 +56,7 @@ module.exports = {
|
||||||
return editOrReply(context, {
|
return editOrReply(context, {
|
||||||
embeds:[createEmbed("defaultNoFooter", context, {
|
embeds:[createEmbed("defaultNoFooter", context, {
|
||||||
author: {
|
author: {
|
||||||
name: inputDisplay,
|
name: stringwrap(args.text, 50),
|
||||||
iconUrl: STATIC_ICONS.ai_bard_idle
|
iconUrl: STATIC_ICONS.ai_bard_idle
|
||||||
},
|
},
|
||||||
description: description.join('\n'),
|
description: description.join('\n'),
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { canUseLimitedTestCommands, isLimitedTestUser } = require('../../../labsc
|
||||||
const { STATICS } = require('../../../labscore/utils/statics');
|
const { STATICS } = require('../../../labscore/utils/statics');
|
||||||
|
|
||||||
const superagent = require('superagent')
|
const superagent = require('superagent')
|
||||||
const { iconPill } = require('../../../labscore/utils/markdown')
|
const { iconPill, stringwrap } = require('../../../labscore/utils/markdown')
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
|
||||||
|
@ -89,9 +89,6 @@ module.exports = {
|
||||||
model: MODELS[model.toLowerCase()].id
|
model: MODELS[model.toLowerCase()].id
|
||||||
})
|
})
|
||||||
|
|
||||||
let inputDisplay = args.text.replace(/\n/g, ' ')
|
|
||||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
|
||||||
|
|
||||||
let description = []
|
let description = []
|
||||||
let files = [];
|
let files = [];
|
||||||
|
|
||||||
|
@ -109,7 +106,7 @@ module.exports = {
|
||||||
embeds:[createEmbed("defaultNoFooter", context, {
|
embeds:[createEmbed("defaultNoFooter", context, {
|
||||||
author: {
|
author: {
|
||||||
iconUrl: MODELS[model.toLowerCase()].icon,
|
iconUrl: MODELS[model.toLowerCase()].icon,
|
||||||
name: inputDisplay
|
name: stringwrap(args.text, 50)
|
||||||
},
|
},
|
||||||
description: description.join('\n'),
|
description: description.join('\n'),
|
||||||
footer: {
|
footer: {
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing')
|
||||||
const { STATIC_ICONS } = require('../../../labscore/utils/statics');
|
const { STATIC_ICONS } = require('../../../labscore/utils/statics');
|
||||||
|
|
||||||
const superagent = require('superagent')
|
const superagent = require('superagent')
|
||||||
const { iconPill } = require('../../../labscore/utils/markdown')
|
const { iconPill, stringwrap } = require('../../../labscore/utils/markdown')
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
const { getUser } = require('../../../labscore/utils/users');
|
const { getUser } = require('../../../labscore/utils/users');
|
||||||
|
@ -87,9 +87,6 @@ Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"n
|
||||||
model: "CHATGPT"
|
model: "CHATGPT"
|
||||||
})
|
})
|
||||||
|
|
||||||
let inputDisplay = args.text.replace(/\n/g, ' ')
|
|
||||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
|
||||||
|
|
||||||
let description = []
|
let description = []
|
||||||
let files = [];
|
let files = [];
|
||||||
|
|
||||||
|
@ -107,7 +104,7 @@ Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"n
|
||||||
embeds:[createEmbed("defaultNoFooter", context, {
|
embeds:[createEmbed("defaultNoFooter", context, {
|
||||||
author: {
|
author: {
|
||||||
iconUrl: STATIC_ICONS.ai_clyde_idle,
|
iconUrl: STATIC_ICONS.ai_clyde_idle,
|
||||||
name: inputDisplay
|
name: stringwrap(args.text, 50)
|
||||||
},
|
},
|
||||||
description: description.join('\n')
|
description: description.join('\n')
|
||||||
})],
|
})],
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing')
|
||||||
const { STATICS } = require('../../../labscore/utils/statics');
|
const { STATICS } = require('../../../labscore/utils/statics');
|
||||||
|
|
||||||
const superagent = require('superagent')
|
const superagent = require('superagent')
|
||||||
const { iconPill, smallIconPill } = require('../../../labscore/utils/markdown')
|
const { iconPill, smallIconPill, stringwrap } = require('../../../labscore/utils/markdown')
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
|
||||||
|
@ -41,10 +41,7 @@ module.exports = {
|
||||||
// Fetch the image
|
// Fetch the image
|
||||||
let img = await superagent.get(res.body.output)
|
let img = await superagent.get(res.body.output)
|
||||||
|
|
||||||
let inputDisplay = args.text
|
let description = [smallIconPill("generative_ai", stringwrap(args.text, 50)), '']
|
||||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
|
||||||
|
|
||||||
let description = [smallIconPill("generative_ai", inputDisplay), '']
|
|
||||||
let files = [];
|
let files = [];
|
||||||
|
|
||||||
if(!res.body.output) res.body.output = '[Empty Response]'
|
if(!res.body.output) res.body.output = '[Empty Response]'
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { canUseLimitedTestCommands, isLimitedTestUser } = require('../../../labsc
|
||||||
const { STATIC_ICONS } = require('../../../labscore/utils/statics');
|
const { STATIC_ICONS } = require('../../../labscore/utils/statics');
|
||||||
|
|
||||||
const superagent = require('superagent')
|
const superagent = require('superagent')
|
||||||
const { iconPill } = require('../../../labscore/utils/markdown')
|
const { iconPill, stringwrap } = require('../../../labscore/utils/markdown')
|
||||||
|
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
|
||||||
|
@ -53,13 +53,10 @@ module.exports = {
|
||||||
let temperature = "0.25"
|
let temperature = "0.25"
|
||||||
if(args.temperature !== 0.25) temperature = parseFloat(args.temperature)
|
if(args.temperature !== 0.25) temperature = parseFloat(args.temperature)
|
||||||
|
|
||||||
let inputDisplay = args.text.replace(/\n/g, ' ')
|
|
||||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
await editOrReply(context, createEmbed("ai_custom", context, STATIC_ICONS.ai_palm_idle))
|
await editOrReply(context, createEmbed("ai_custom", context, STATIC_ICONS.ai_palm_idle))
|
||||||
|
|
||||||
let res = await superagent.post(`${process.env.AI_SERVER}/google/palm2`)
|
let res = await superagent.post(`${process.env.AI_SERVER}/google/palm2/chat`)
|
||||||
.set({
|
.set({
|
||||||
Authorization: process.env.AI_SERVER_KEY
|
Authorization: process.env.AI_SERVER_KEY
|
||||||
})
|
})
|
||||||
|
@ -86,7 +83,7 @@ module.exports = {
|
||||||
return editOrReply(context, {
|
return editOrReply(context, {
|
||||||
embeds:[createEmbed("defaultNoFooter", context, {
|
embeds:[createEmbed("defaultNoFooter", context, {
|
||||||
author: {
|
author: {
|
||||||
name: inputDisplay,
|
name: stringwrap(prompt, 50),
|
||||||
iconUrl: STATIC_ICONS.ai_palm_idle
|
iconUrl: STATIC_ICONS.ai_palm_idle
|
||||||
},
|
},
|
||||||
description: description.join('\n'),
|
description: description.join('\n'),
|
||||||
|
@ -98,7 +95,6 @@ module.exports = {
|
||||||
})
|
})
|
||||||
}catch(e){
|
}catch(e){
|
||||||
if(e.response.body?.message) return editOrReply(context, createEmbed("warning", context, e.response.body.message))
|
if(e.response.body?.message) return editOrReply(context, createEmbed("warning", context, e.response.body.message))
|
||||||
console.log(e)
|
|
||||||
return editOrReply(context, createEmbed("error", context, `Unable to generate text.`))
|
return editOrReply(context, createEmbed("error", context, `Unable to generate text.`))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@ module.exports.timestamp = function(time, flag = "t"){
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.stringwrap = function(content = "", length){
|
module.exports.stringwrap = function(content = "", length){
|
||||||
console.log(content)
|
|
||||||
console.log(length)
|
|
||||||
if(content.length > length) return content.substr(0, length) + '...';
|
if(content.length > length) return content.substr(0, length) + '...';
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue