add loading state gif to bard

This commit is contained in:
derpystuff 2023-10-11 20:59:15 +02:00
parent 29399b586e
commit 9b64f7eac9
4 changed files with 25 additions and 11 deletions

View file

@ -33,7 +33,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 within 2000-4000 characters. This isn\'t required for more in-depth and 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- When answering a question, be concise and to the point.\n- Try to stay at around 500-1000 characters for most responses, unless more text is required to properly explain something.'
if(args.prompt !== "") prompt = args.prompt
// Get content if the user replies to anything

View file

@ -3,7 +3,7 @@ const { createEmbed, formatPaginationEmbeds, page } = require("../../../labscore
const { guildFeaturesField } = require("../../../labscore/utils/fields");
const { icon, highlight, timestamp, link, iconPill, iconLinkPill } = require("../../../labscore/utils/markdown");
const { editOrReply } = require("../../../labscore/utils/message");
const { STATICS } = require("../../../labscore/utils/statics");
const { STATICS, STATIC_ASSETS } = require("../../../labscore/utils/statics");
const { paginator } = require('../../../labscore/client');
@ -33,7 +33,7 @@ module.exports = {
iconLinkPill('gitlab', OPEN_SOURCE_REPOSITORY_URL, 'Source Code'),
].join('\n'),
image: {
url: STATICS.embedSpacerInvite
url: STATIC_ASSETS.embed_invite_spacer
}
})})
try{

View file

@ -1,5 +1,5 @@
const { COLORS } = require('../constants')
const { STATIC_ICONS, STATICS } = require('./statics')
const { STATIC_ICONS, STATICS, STATIC_ASSETS } = require('./statics')
const embedTypes = Object.freeze({
"default": (context) => {
@ -92,7 +92,10 @@ const embedTypes = Object.freeze({
return {
author: {
iconUrl: STATIC_ICONS.ai_bard,
name: `Generating`
name: ``
},
image: {
url: STATIC_ASSETS.chat_loading
},
color: COLORS.embed
}
@ -105,7 +108,7 @@ module.exports.createEmbed = function(type, context, content){
if(!content) embedTypes[type](context)
let emb = embedTypes[type](context)
if(["success","warning","error","loading","ai","ai_bard"].includes(type)){
if(["success","warning","error","loading","ai"].includes(type)){
emb.author.name = content
return emb
}

View file

@ -3,6 +3,16 @@ const { Hosts } = require('../api/endpoints')
// Add static brand icons here
// Update the revision id to break discord cache
const Statics = Object.freeze({
assets: {
chat_loading: {
file: "loading/02_chat_loading.47madop37as0.gif",
revision: 0
},
embed_invite_spacer: {
file: "misc/embed-spacer-botinvite.png",
revision: 0
},
},
brands: {
applemaps: {
file: "brands/applemaps.png",
@ -161,11 +171,7 @@ module.exports.STATICS = Object.freeze({
wikihow: staticAsset(Statics.brands.wikihow),
wikipedia: staticAsset(Statics.brands.wikipedia),
wolframalpha: staticAsset(Statics.brands.wolframalpha),
youtube: staticAsset(Statics.brands.youtube),
embedSpacerInvite: staticAsset({
file: "misc/embed-spacer-botinvite.png",
revision: 0
})
youtube: staticAsset(Statics.brands.youtube)
})
module.exports.STATIC_ICONS = Object.freeze({
@ -177,3 +183,8 @@ module.exports.STATIC_ICONS = Object.freeze({
ai_bard_idle: staticAsset(Statics.icons.ai_bard_idle),
warning: staticAsset(Statics.icons.warning)
})
module.exports.STATIC_ASSETS = Object.freeze({
chat_loading: staticAsset(Statics.assets.chat_loading),
embed_invite_spacer: staticAsset(Statics.assets.embed_invite_spacer)
})