mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 17:43:03 +03:00
322ee318be
* feat(user_management): added user management * feat(user_management): added user management * feat(user_management): removed print * feat: use tanstack query for user data fecthing * feat: add getUser to sdk * feat: improve user page ux use tanstack query * feat: fetch models from backend on brains settings page * feat: update model selection on chat page * feat: update tests --------- Co-authored-by: mamadoudicko <mamadoudicko100@gmail.com>
21 lines
535 B
TypeScript
21 lines
535 B
TypeScript
import { UserStats } from "@/lib/types/User";
|
|
import { freeModels, paidModels } from "@/lib/types/brainConfig";
|
|
|
|
type GetAccessibleModelsInput = {
|
|
openAiKey?: string | null;
|
|
userData?: UserStats;
|
|
};
|
|
export const getAccessibleModels = ({
|
|
openAiKey,
|
|
userData,
|
|
}: GetAccessibleModelsInput): string[] => {
|
|
if (userData?.models !== undefined) {
|
|
return userData.models;
|
|
}
|
|
if (openAiKey !== undefined && openAiKey !== null) {
|
|
return paidModels as unknown as string[];
|
|
}
|
|
|
|
return freeModels as unknown as string[];
|
|
};
|