Skip to content

Commit

Permalink
Store user agent in conversation (#940)
Browse files Browse the repository at this point in the history
* Store user agent on conversation creation

* casing header
  • Loading branch information
nsarrazin committed Mar 18, 2024
1 parent 1d6151d commit d196c64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/types/Conversation.ts
Expand Up @@ -23,4 +23,6 @@ export interface Conversation extends Timestamps {

preprompt?: string;
assistantId?: Assistant["_id"];

userAgent?: string;
}
1 change: 1 addition & 0 deletions src/routes/conversation/+server.ts
Expand Up @@ -105,6 +105,7 @@ export const POST: RequestHandler = async ({ locals, request }) => {
assistantId: values.assistantId ? new ObjectId(values.assistantId) : undefined,
createdAt: new Date(),
updatedAt: new Date(),
userAgent: request.headers.get("User-Agent") ?? undefined,
embeddingModel,
...(locals.user ? { userId: locals.user._id } : { sessionId: locals.sessionId }),
...(values.fromShare ? { meta: { fromShareId: values.fromShare } } : {}),
Expand Down

0 comments on commit d196c64

Please sign in to comment.