mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-27 17:36:25 +02:00
use managed deepgram when signed in
This commit is contained in:
parent
604d521ac2
commit
7097cb064a
5 changed files with 59 additions and 66 deletions
|
|
@ -33,6 +33,23 @@ export async function getVoiceConfig(): Promise<VoiceConfig> {
|
|||
};
|
||||
}
|
||||
|
||||
export async function getDeepgramToken(): Promise<{ token: string } | null> {
|
||||
const signedIn = await isSignedIn();
|
||||
if (!signedIn) return null;
|
||||
|
||||
const accessToken = await getAccessToken();
|
||||
const response = await fetch(`${API_URL}/v1/voice/deepgram-token`, {
|
||||
method: 'POST',
|
||||
headers: { 'Authorization': `Bearer ${accessToken}` },
|
||||
});
|
||||
if (!response.ok) {
|
||||
console.error('[voice] Deepgram token error:', response.status);
|
||||
return null;
|
||||
}
|
||||
const data = await response.json();
|
||||
return { token: data.token };
|
||||
}
|
||||
|
||||
export async function synthesizeSpeech(text: string): Promise<{ audioBase64: string; mimeType: string }> {
|
||||
const config = await getVoiceConfig();
|
||||
const signedIn = await isSignedIn();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue