current time tool
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { auth } from '@clerk/nextjs/server'
|
import { auth } from '@clerk/nextjs/server'
|
||||||
import { createOpenAI } from '@ai-sdk/openai'
|
import { createOpenAI } from '@ai-sdk/openai'
|
||||||
import { streamText, tool, convertToModelMessages, stepCountIs, type UIMessage } from 'ai'
|
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 { eq, and } from 'drizzle-orm'
|
||||||
import { env } from '~/env'
|
import { env } from '~/env'
|
||||||
import { db } from '~/server/db'
|
import { db } from '~/server/db'
|
||||||
@@ -74,6 +74,11 @@ export async function POST(req: Request) {
|
|||||||
}),
|
}),
|
||||||
execute: async (input) => scheduleMeeting({ ...input, userId }),
|
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),
|
stopWhen: stepCountIs(5),
|
||||||
onFinish: async ({ text, finishReason }) => {
|
onFinish: async ({ text, finishReason }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user