mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-10 07:03:08 -04:00
update transcription to use obelisk service
This commit is contained in:
parent
8f2727456b
commit
0cac2568d8
4 changed files with 11 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
const { Constants } = require('detritus-client');
|
||||
const { InteractionCallbackTypes, ApplicationCommandTypes, MessageFlags } = Constants;
|
||||
|
||||
const { googleSpeechRecognitionWithLabels } = require('../../../labscore/api');
|
||||
const { transcribeWithSpeakerLabelsObelisk } = require('../../../labscore/api/obelisk');
|
||||
|
||||
const { createEmbed } = require('../../../labscore/utils/embed');
|
||||
const { codeblock } = require('../../../labscore/utils/markdown');
|
||||
|
@ -34,7 +34,7 @@ module.exports = {
|
|||
flags: MessageFlags.EPHEMERAL
|
||||
})
|
||||
|
||||
const recog = await googleSpeechRecognitionWithLabels(context, message.attachments.first().url)
|
||||
const recog = await transcribeWithSpeakerLabelsObelisk(context, message.attachments.first().url)
|
||||
|
||||
return editOrReply(context, {
|
||||
embeds: [createEmbed("default", context, {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
const { googleSpeechRecognitionWithLabels } = require('../../../labscore/api');
|
||||
const { transcribeWithSpeakerLabelsObelisk } = require('../../../labscore/api/obelisk');
|
||||
|
||||
const { STATICS } = require('../../../labscore/utils/statics');
|
||||
const { codeblock, icon } = require('../../../labscore/utils/markdown');
|
||||
|
@ -32,7 +32,7 @@ module.exports = {
|
|||
if(!msg.attachments.first()) return editOrReply(context, createEmbed("warning", context, "No voice message found."))
|
||||
if(!msg.attachments.first().url.split('?')[0].endsWith('voice-message.ogg')) return editOrReply(context, createEmbed("warning", context, "No voice message found."))
|
||||
|
||||
const recog = await googleSpeechRecognitionWithLabels(context, msg.attachments.first().url)
|
||||
const recog = await transcribeWithSpeakerLabelsObelisk(context, msg.attachments.first().url)
|
||||
|
||||
return editOrReply(context, createEmbed("default", context, {
|
||||
description: codeblock("md", [ recog.response.body.transcription_with_speakers ]),
|
||||
|
|
|
@ -20,6 +20,7 @@ const ObeliskApi = Object.freeze({
|
|||
AI_WALLPAPER: "/robin/v1/wallpaper:generate",
|
||||
|
||||
WEBSHOT: "/peacock/v1/screenshot",
|
||||
TRANSCRIBE: "/peacock/v1/transcribe",
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -109,4 +109,10 @@ module.exports.webshot = async function(context, url, allowAdultContent = false)
|
|||
url,
|
||||
allow_adult: allowAdultContent
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.transcribeWithSpeakerLabelsObelisk = async function(context, url){
|
||||
return await request(ObeliskApi.TRANSCRIBE, "POST", {}, {
|
||||
url
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue