fix: support setting visibility on initial chat creation (#975)
This commit is contained in:
parent
a3221fbcdc
commit
575c12503c
15 changed files with 158 additions and 32 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue