Skip to content

Commit

Permalink
fix voice
Browse files Browse the repository at this point in the history
  • Loading branch information
katsuhira02 committed Jul 11, 2024
1 parent 12d3bac commit 4361f17
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions supabase/functions/_shared/supabase/ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,13 @@ export async function createVoiceSyncLabs(
}
}

export async function isVoiceId(voiceId: string) {
export async function isVoiceId(telegram_id: string) {
const { data, error } = await supabase
.from("users")
.select("*")
.eq("voice_id_synclabs", voiceId)
.eq("telegram_id", telegram_id)
.single();

if (error || !data) return false;
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion supabase/functions/ai-koshey/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,9 @@ botAiKoshey.command("text_to_speech", async (ctx) => {
const lang = await isRu(ctx)
if (!ctx.from?.id) throw new Error("No user id");
const isHaveVoiceId = await isVoiceId(ctx.from?.id.toString())
console.log(isHaveVoiceId, "isHaveVoiceId")
if (!isHaveVoiceId) {
await ctx.reply(lang ? "🔮 Пожалуйста, перед использованием /text_to_speech используйте /voice." : "🔮 Please use /voice before using /text_to_speech.")
await ctx.reply(lang ? "🔮 Пожалуйста, для использованием /text_to_speech, введите /voice." : "🔮 Please enter /voice to use /text_to_speech.")
return
}
const text = lang
Expand Down
6 changes: 3 additions & 3 deletions supabase/functions/synclabs-audio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Deno.serve(async (req) => {
console.log(voice_id, "voice_id");
const user = await getUserByVoiceId(voice_id);
console.log(user, "user");
//const chat_id = user?.chat_id;
const chat_id = "1006101665"
const chat_id = user?.chat_id;
// const chat_id = "1006101665"
console.log(chat_id, "chat_id");
try {
await botAiKoshey.api.sendVoice(chat_id, audioUrl);
Expand Down Expand Up @@ -65,4 +65,4 @@ Deno.serve(async (req) => {
*/

// supabase functions deploy heygen-video --no-verify-jwt
// supabase functions deploy synclabs-audio --no-verify-jwt

0 comments on commit 4361f17

Please sign in to comment.