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).`))
|
||||
|
||||
let input = args.text;
|
||||
|
||||
let inputDisplay = args.text.replace(/\n/g, ' ')
|
||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
||||
|
||||
try{
|
||||
await editOrReply(context, createEmbed("ai_custom", context, STATIC_ICONS.ai_bard))
|
||||
|
@ -59,7 +56,7 @@ module.exports = {
|
|||
return editOrReply(context, {
|
||||
embeds:[createEmbed("defaultNoFooter", context, {
|
||||
author: {
|
||||
name: inputDisplay,
|
||||
name: stringwrap(args.text, 50),
|
||||
iconUrl: STATIC_ICONS.ai_bard_idle
|
||||
},
|
||||
description: description.join('\n'),
|
||||
|
|
|
@ -5,7 +5,7 @@ const { canUseLimitedTestCommands, isLimitedTestUser } = require('../../../labsc
|
|||
const { STATICS } = require('../../../labscore/utils/statics');
|
||||
|
||||
const superagent = require('superagent')
|
||||
const { iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { iconPill, stringwrap } = require('../../../labscore/utils/markdown')
|
||||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
|
@ -89,9 +89,6 @@ module.exports = {
|
|||
model: MODELS[model.toLowerCase()].id
|
||||
})
|
||||
|
||||
let inputDisplay = args.text.replace(/\n/g, ' ')
|
||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
||||
|
||||
let description = []
|
||||
let files = [];
|
||||
|
||||
|
@ -109,7 +106,7 @@ module.exports = {
|
|||
embeds:[createEmbed("defaultNoFooter", context, {
|
||||
author: {
|
||||
iconUrl: MODELS[model.toLowerCase()].icon,
|
||||
name: inputDisplay
|
||||
name: stringwrap(args.text, 50)
|
||||
},
|
||||
description: description.join('\n'),
|
||||
footer: {
|
||||
|
|
|
@ -5,7 +5,7 @@ const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing')
|
|||
const { STATIC_ICONS } = require('../../../labscore/utils/statics');
|
||||
|
||||
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 { getUser } = require('../../../labscore/utils/users');
|
||||
|
@ -87,9 +87,6 @@ Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"n
|
|||
model: "CHATGPT"
|
||||
})
|
||||
|
||||
let inputDisplay = args.text.replace(/\n/g, ' ')
|
||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
||||
|
||||
let description = []
|
||||
let files = [];
|
||||
|
||||
|
@ -107,7 +104,7 @@ Current time: ${new Date().toLocaleDateString('en-us', { weekday:"long", year:"n
|
|||
embeds:[createEmbed("defaultNoFooter", context, {
|
||||
author: {
|
||||
iconUrl: STATIC_ICONS.ai_clyde_idle,
|
||||
name: inputDisplay
|
||||
name: stringwrap(args.text, 50)
|
||||
},
|
||||
description: description.join('\n')
|
||||
})],
|
||||
|
|
|
@ -5,7 +5,7 @@ const { canUseLimitedTestCommands } = require('../../../labscore/utils/testing')
|
|||
const { STATICS } = require('../../../labscore/utils/statics');
|
||||
|
||||
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");
|
||||
|
||||
|
@ -41,10 +41,7 @@ module.exports = {
|
|||
// Fetch the image
|
||||
let img = await superagent.get(res.body.output)
|
||||
|
||||
let inputDisplay = args.text
|
||||
if(inputDisplay.length >= 50) inputDisplay = inputDisplay.substr(0,50) + '...'
|
||||
|
||||
let description = [smallIconPill("generative_ai", inputDisplay), '']
|
||||
let description = [smallIconPill("generative_ai", stringwrap(args.text, 50)), '']
|
||||
let files = [];
|
||||
|
||||
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 superagent = require('superagent')
|
||||
const { iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { iconPill, stringwrap } = require('../../../labscore/utils/markdown')
|
||||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
|
@ -53,13 +53,10 @@ module.exports = {
|
|||
let temperature = "0.25"
|
||||
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{
|
||||
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({
|
||||
Authorization: process.env.AI_SERVER_KEY
|
||||
})
|
||||
|
@ -86,7 +83,7 @@ module.exports = {
|
|||
return editOrReply(context, {
|
||||
embeds:[createEmbed("defaultNoFooter", context, {
|
||||
author: {
|
||||
name: inputDisplay,
|
||||
name: stringwrap(prompt, 50),
|
||||
iconUrl: STATIC_ICONS.ai_palm_idle
|
||||
},
|
||||
description: description.join('\n'),
|
||||
|
@ -98,7 +95,6 @@ module.exports = {
|
|||
})
|
||||
}catch(e){
|
||||
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.`))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ module.exports.timestamp = function(time, flag = "t"){
|
|||
}
|
||||
|
||||
module.exports.stringwrap = function(content = "", length){
|
||||
console.log(content)
|
||||
console.log(length)
|
||||
if(content.length > length) return content.substr(0, length) + '...';
|
||||
return content;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue