mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-25 08:04:19 +03:00
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[];
|
||
|
};
|