mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 14:43:05 -04:00
typing indicator
This commit is contained in:
parent
9716fb1f6e
commit
dca55fd80c
4 changed files with 19 additions and 1 deletions
|
@ -34,6 +34,8 @@ module.exports = {
|
||||||
if(args.prompt !== "") prompt = args.prompt
|
if(args.prompt !== "") prompt = args.prompt
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
await editOrReply(context, createEmbed("typing", context, "Generating response..."))
|
||||||
|
|
||||||
let res = await superagent.post(`${process.env.AI_SERVER}/openai`)
|
let res = await superagent.post(`${process.env.AI_SERVER}/openai`)
|
||||||
.set({
|
.set({
|
||||||
Authorization: process.env.AI_SERVER_KEY
|
Authorization: process.env.AI_SERVER_KEY
|
||||||
|
|
|
@ -24,6 +24,8 @@ module.exports = {
|
||||||
context.triggerTyping();
|
context.triggerTyping();
|
||||||
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
|
if(!args.text) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (text).`)]})
|
||||||
try{
|
try{
|
||||||
|
await editOrReply(context, createEmbed("typing", context, "Generating response..."))
|
||||||
|
|
||||||
let res = await superagent.post(`${process.env.AI_SERVER}/openai`)
|
let res = await superagent.post(`${process.env.AI_SERVER}/openai`)
|
||||||
.set({
|
.set({
|
||||||
Authorization: process.env.AI_SERVER_KEY
|
Authorization: process.env.AI_SERVER_KEY
|
||||||
|
|
|
@ -78,6 +78,15 @@ const embedTypes = Object.freeze({
|
||||||
},
|
},
|
||||||
color: COLORS.embed
|
color: COLORS.embed
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"typing": (context) => {
|
||||||
|
return {
|
||||||
|
author: {
|
||||||
|
iconUrl: STATIC_ICONS.typing,
|
||||||
|
name: `Loading`
|
||||||
|
},
|
||||||
|
color: COLORS.embed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -87,7 +96,7 @@ module.exports.createEmbed = function(type, context, content){
|
||||||
if(!content) embedTypes[type](context)
|
if(!content) embedTypes[type](context)
|
||||||
let emb = embedTypes[type](context)
|
let emb = embedTypes[type](context)
|
||||||
|
|
||||||
if(["success","warning","error","loading"].includes(type)){
|
if(["success","warning","error","loading","typing"].includes(type)){
|
||||||
emb.author.name = content
|
emb.author.name = content
|
||||||
return emb
|
return emb
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,10 @@ const Statics = Object.freeze({
|
||||||
file: "icons/core/ico_notice_loading.gif",
|
file: "icons/core/ico_notice_loading.gif",
|
||||||
revision: 0
|
revision: 0
|
||||||
},
|
},
|
||||||
|
typing: {
|
||||||
|
file: "icons/core/ico_notice_typing.gif",
|
||||||
|
revision: 0
|
||||||
|
},
|
||||||
warning: {
|
warning: {
|
||||||
file: "icons/core/ico_notice_warning.png",
|
file: "icons/core/ico_notice_warning.png",
|
||||||
revision: 0
|
revision: 0
|
||||||
|
@ -145,5 +149,6 @@ module.exports.STATIC_ICONS = Object.freeze({
|
||||||
adult: staticAsset(Statics.icons.adult),
|
adult: staticAsset(Statics.icons.adult),
|
||||||
error: staticAsset(Statics.icons.error),
|
error: staticAsset(Statics.icons.error),
|
||||||
loading: staticAsset(Statics.icons.loading),
|
loading: staticAsset(Statics.icons.loading),
|
||||||
|
typing: staticAsset(Statics.icons.typing),
|
||||||
warning: staticAsset(Statics.icons.warning)
|
warning: staticAsset(Statics.icons.warning)
|
||||||
})
|
})
|
Loading…
Add table
Add a link
Reference in a new issue