allow services for anonymous users & gpt4 fix
This commit is contained in:
@@ -24,6 +24,7 @@ export interface User {
|
||||
|
||||
export class Backend extends EventEmitter {
|
||||
public user: User | null = null;
|
||||
public services: string[] = [];
|
||||
private checkedSession = false;
|
||||
|
||||
private sessionInterval = new AsyncLoop(() => this.getSession(), 1000 * 30);
|
||||
@@ -70,8 +71,10 @@ export class Backend extends EventEmitter {
|
||||
avatar: session.picture,
|
||||
services: session.services,
|
||||
};
|
||||
this.services = session.services || [];
|
||||
} else {
|
||||
this.user = null;
|
||||
this.services = session?.services || [];
|
||||
}
|
||||
|
||||
this.checkedSession = true;
|
||||
|
@@ -7,7 +7,7 @@ import { backend } from "../backend";
|
||||
export const defaultModel = 'gpt-3.5-turbo';
|
||||
|
||||
export function isProxySupported() {
|
||||
return !!backend.current?.user?.services?.includes('openai');
|
||||
return !!backend.current?.services?.includes('openai');
|
||||
}
|
||||
|
||||
function shouldUseProxy(apiKey: string | undefined | null) {
|
||||
@@ -141,5 +141,5 @@ export async function createStreamingChatCompletion(messages: OpenAIMessage[], p
|
||||
|
||||
export const maxTokensByModel = {
|
||||
"chatgpt-3.5-turbo": 2048,
|
||||
"gpt-4": 8096,
|
||||
"gpt-4": 8192,
|
||||
}
|
@@ -6,7 +6,7 @@ import { defaultElevenLabsVoiceID, defaultVoiceList } from "./elevenlabs-default
|
||||
import { backend } from "../core/backend";
|
||||
|
||||
function isProxySupported() {
|
||||
return !!backend.current?.user?.services?.includes('elevenlabs');
|
||||
return !!backend.current?.services?.includes('elevenlabs');
|
||||
}
|
||||
|
||||
function shouldUseProxy(apiKey: string | undefined | null) {
|
||||
|
Reference in New Issue
Block a user