fix: support setting visibility on initial chat creation (#975)

This commit is contained in:
Jeremy 2025-05-01 17:47:48 -07:00 committed by GitHub
parent a3221fbcdc
commit 575c12503c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 158 additions and 32 deletions

View file

@ -31,6 +31,7 @@ import {
import type { ArtifactKind } from '@/components/artifact';
import { generateUUID } from '../utils';
import { generateHashedPassword } from './utils';
import type { VisibilityType } from '@/components/visibility-selector';
// Optionally, if not using email/pass login, you can
// use the Drizzle adapter for Auth.js / NextAuth
@ -79,10 +80,12 @@ export async function saveChat({
id,
userId,
title,
visibility,
}: {
id: string;
userId: string;
title: string;
visibility: VisibilityType;
}) {
try {
return await db.insert(chat).values({
@ -90,6 +93,7 @@ export async function saveChat({
createdAt: new Date(),
userId,
title,
visibility,
});
} catch (error) {
console.error('Failed to save chat in database');