server auth stuff, prooompt engineering

This commit is contained in:
2026-03-31 15:29:47 +02:00
parent c5b3ee3875
commit ead9548744
6 changed files with 29 additions and 28 deletions

View File

@@ -8,6 +8,7 @@ import { db } from '~/server/db'
import { chatSession, chatMessage } from '~/server/dbschema/schema'
import { servTrpc } from '~/app/_trpc/ServerClient'
import { scheduleMeeting } from '~/app/actions/scheduleMeeting'
import currentTime from '~/app/actions/currentTime';
const openai = createOpenAI({ apiKey: env.OPENAI_API_KEY })
@@ -45,7 +46,7 @@ export async function POST(req: Request) {
}
const result = streamText({
model: openai('gpt-4o'),
model: openai('gpt-5-mini'),
system: systemPrompt,
messages: await convertToModelMessages(messages),
tools: {
@@ -64,22 +65,22 @@ export async function POST(req: Request) {
.int()
.min(15)
.max(120)
.describe('Duration of the meeting in minutes'),
.describe('Duration of the meeting in minutes, if none provided ask if 20 minutes is ok'),
attendeeEmail: z
.string()
.email()
.optional()
.describe('Email of the visitor to invite (if provided)'),
.describe('Optional Email of the visitor to invite (if provided)'),
attendeeName: z.string().optional().describe('Name of the visitor'),
}),
execute: async (input) => scheduleMeeting({ ...input, userId }),
execute: async (input) => scheduleMeeting({ ...input }),
}),
getCurrentUnixTime: tool({
description: 'Get the current unix time to reference for meeting dates',
inputSchema: z.object({
none: z.string().optional().describe("no inputs are needed")
}),
execute: async () => { return {success: true, currentTime: Date.now()} }
execute: async () => currentTime()
})
},
stopWhen: stepCountIs(5),