feat: support guest session (#919)

This commit is contained in:
Jeremy 2025-04-25 23:40:15 -07:00 committed by GitHub
parent 24cb2ce19b
commit 9279135355
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 741 additions and 288 deletions

29
lib/ai/entitlements.ts Normal file
View file

@ -0,0 +1,29 @@
import type { UserType } from '@/app/(auth)/auth';
import type { ChatModel } from './models';
interface Entitlements {
maxMessagesPerDay: number;
availableChatModelIds: Array<ChatModel['id']>;
}
export const entitlementsByUserType: Record<UserType, Entitlements> = {
/*
* For users without an account
*/
guest: {
maxMessagesPerDay: 20,
availableChatModelIds: ['chat-model', 'chat-model-reasoning'],
},
/*
* For users with an account
*/
regular: {
maxMessagesPerDay: 100,
availableChatModelIds: ['chat-model', 'chat-model-reasoning'],
},
/*
* TODO: For users with an account and a paid membership
*/
};

View file

@ -1,6 +1,6 @@
export const DEFAULT_CHAT_MODEL: string = 'chat-model';
interface ChatModel {
export interface ChatModel {
id: string;
name: string;
description: string;