fix: chat query (#1170)

Co-authored-by: josh <josh@afterima.ge>
This commit is contained in:
Nicklas Scharpff 2025-09-09 00:29:04 +02:00 committed by GitHub
parent d3b3449eb8
commit f2320bf321
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 879 additions and 145 deletions

View file

@ -4,12 +4,14 @@ import {
varchar,
timestamp,
json,
jsonb,
uuid,
text,
primaryKey,
foreignKey,
boolean,
} from 'drizzle-orm/pg-core';
import type { LanguageModelV2Usage } from '@ai-sdk/provider';
export const user = pgTable('User', {
id: uuid('id').primaryKey().notNull().defaultRandom(),
@ -29,6 +31,7 @@ export const chat = pgTable('Chat', {
visibility: varchar('visibility', { enum: ['public', 'private'] })
.notNull()
.default('private'),
lastContext: jsonb('lastContext').$type<LanguageModelV2Usage | null>(),
});
export type Chat = InferSelectModel<typeof chat>;