current time tool

This commit is contained in:
2026-03-31 14:23:04 +02:00
parent e481fa66cd
commit e25fc39bac

View File

@@ -1,7 +1,7 @@
import { auth } from '@clerk/nextjs/server'
import { createOpenAI } from '@ai-sdk/openai'
import { streamText, tool, convertToModelMessages, stepCountIs, type UIMessage } from 'ai'
import { z } from 'zod'
import { success, z } from 'zod'
import { eq, and } from 'drizzle-orm'
import { env } from '~/env'
import { db } from '~/server/db'
@@ -74,6 +74,11 @@ export async function POST(req: Request) {
}),
execute: async (input) => scheduleMeeting({ ...input, userId }),
}),
getCurrentUnixTime: tool({
description: 'Get the current unix time to reference for meeting dates',
inputSchema: z.undefined(),
execute: async () => { return {success: true, currentTime: Date.now()} }
})
},
stopWhen: stepCountIs(5),
onFinish: async ({ text, finishReason }) => {