feat: add booking date range filters and freeze GPT-4 version#12508
feat: add booking date range filters and freeze GPT-4 version#12508PeerRich merged 10 commits intocalcom:mainfrom
Conversation
|
@DexterStorey is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
|
This PR is being marked as stale due to inactivity. |
|
This PR is being closed due to inactivity. Please reopen if work is intended to be continued. |
|
🚀 This should fix #11957 |
alishaz-polymath
left a comment
There was a problem hiding this comment.
Temporal filters are quite handy, thank you for the PR 🙏
Left a change request which I think should improve code quality
Head branch was pushed to by a user without write access
alishaz-polymath
left a comment
There was a problem hiding this comment.
Just a NIT, although your changes should are already better, this would just be much cleaner and easier to read. 🙌
| const dateFrom = req.query.dateFrom ? new Date(req.query.dateFrom as string) : undefined; | ||
| const dateTo = req.query.dateTo ? new Date(req.query.dateTo as string) : undefined; |
There was a problem hiding this comment.
Apologies for missing this earlier, I think we need to put these in try catch and return a viable error message instead of the generic
{
"message": "An error occured while querying the database."
}
that you'd get right now if you pass invalid dateFrom and/or dateTo. Wrapping them up in a try catch, or better yet, pull out a reusable function that validates while parsing these inputs would be awesome 🙌
There was a problem hiding this comment.
Once these changes are in, it should be good to go 🙏
There was a problem hiding this comment.
Hey @DexterStorey did you manage to get a chance to have a look ^?
There was a problem hiding this comment.
Hi @alishaz-polymath. I pushed some changes! 🤝
|
This PR is being marked as stale due to inactivity. |
Freeze GPT-4-0613
| export const schemaBookingGetParams = z.object({ | ||
| dateFrom: iso8601.optional(), | ||
| dateTo: iso8601.optional(), | ||
| }); | ||
|
|
There was a problem hiding this comment.
support schema parsing for the bookings get api
| async function handler(req: NextApiRequest) { | ||
| const { userId, isAdmin, prisma } = req; | ||
|
|
||
| const { dateFrom, dateTo } = schemaBookingGetParams.parse(req.query); |
There was a problem hiding this comment.
@alishaz-polymath can you take a look at this?
| import now from "./now"; | ||
|
|
||
| const gptModel = "gpt-4"; | ||
| const gptModel = "gpt-4-0613"; |
There was a problem hiding this comment.
Is there any specific reason why we picked this Model exaclty? Additional context would be really helpful
There was a problem hiding this comment.
It's the latest stable version released on June 13 AKA 0613 (:
https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo
alishaz-polymath
left a comment
There was a problem hiding this comment.
Looks good, thank you @DexterStorey 🚀




What does this PR do?
This PR adds optional filtering by date to the Cal.com consumer API, and integration with cal.ai.
It fixes a problem where many accounts can't access the getBookings route since they have historical buggy data - and the consumer API previously fetched all booking ever, leading to errors.
We now add the option to fetch booking within a range.
Partially Fixes #11957 (issue)
Additionally, this pr freezes the GPT-4 model (gpt-4-0613) version in an attempt to prevent model degradation.
Requirement/Documentation
Type of change
How should this be tested?
Mandatory Tasks
Checklist
I haven't read the contributing guideMy code doesn't follow the style guidelines of this project