mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
feat(voice): add ChatGPT OAuth auth option
This commit is contained in:
1 parent
b210ab0fe4
commit
881e24485c
23 files changed
+918
-34
No files matched your search
@@ -15,11 +15,19 @@ export function createRealtimeBackend({
|
||||
);
|
||||
return Object.freeze({
|
||||
protocol: 'openai-realtime',
|
||||
async requestToken({ tier = DEFAULT_VOICE_TIER, signal } = {}) {
|
||||
async requestToken({
|
||||
tier = DEFAULT_VOICE_TIER,
|
||||
authMode = 'api-key',
|
||||
signal,
|
||||
} = {}) {
|
||||
signal = scoped(signal);
|
||||
signal.throwIfAborted();
|
||||
const separator = tokenEndpoint.includes('?') ? '&' : '?';
|
||||
const url = `${tokenEndpoint}${separator}tier=${encodeURIComponent(resolveVoiceModel(tier).tier)}`;
|
||||
const query = new URLSearchParams({
|
||||
tier: resolveVoiceModel(tier).tier,
|
||||
});
|
||||
if (authMode === 'oauth') query.set('auth', 'oauth');
|
||||
const url = `${tokenEndpoint}${separator}${query}`;
|
||||
const response = await tokenTransport(url, {
|
||||
signal,
|
||||
cache: 'no-store',
|
||||
|
||||
Reference in new issue
Block a user