-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipipi #3087
Pipipi #3087
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added new PI (Platform Integration) feature with QR code-based authentication and cost/request visualization pages, along with supporting backend infrastructure.
- Added
/bifrost/app/pi/total-cost/page.tsx
and/bifrost/app/pi/total-requests/page.tsx
for visualizing costs and requests with custom number formatting and bar charts - Modified
getJawnClient
in/bifrost/lib/clients/jawn.ts
to use API key authentication instead of JWT-based org auth - Added new PI endpoints in
piController.ts
for session management, org data, and metrics with Supabase/Clickhouse integration - Added staleTime: 0 to useHeliconeLogin hook to ensure fresh API key validation every 10 seconds
- Implemented QR code-based login flow with countdown timer and cookie persistence in
/bifrost/app/pi/useHeliconeLogin.ts
15 file(s) reviewed, 18 comment(s)
Edit PR Review Bot Settings | Greptile
bifrost/app/pi/setup/page.tsx
Outdated
if (apiKey.data && data && !isLoading && !apiKey.isLoading) { | ||
router.push("/pi/first_page"); | ||
return <div>Loading...</div>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: this loading state is confusing - showing a loading message after already initiating navigation could cause a flash of content. Consider returning null or using a more descriptive loading state
<div | ||
className={`w-full flex flex-col justify-center items-center h-[100vh] ${jetbrainsMono.className}`} | ||
> | ||
<h1 className={`text-3xl font-extrabold truncate max-w-[80vw] py-2`}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: extra space before py-2 in className string
@@ -31,7 +31,7 @@ const PiPageContent = () => { | |||
|
|||
<Link | |||
href="/pi/setup" | |||
className=" bg-blue-500 p-5 bg-opacity-60 absolute top-1/2 left-1/2 transform translate-x-[30px] -translate-y-[110px] text-white font-bold" | |||
className="p-5 border-2 absolute top-1/2 left-1/2 transform translate-x-[16px] -translate-y-[90px] text-black font-bold h-[36.17px] px-[12.17px] py-[6.08px] origin-top-left -rotate-1 bg-white border-l-2 border-r-4 border-t-2 border-b-4 border-black flex-col justify-start items-start gap-[10.14px] inline-flex" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: extra space after border-2 in className string
const { data, isLoading } = useTestAPIKey(apiKey.data ?? ""); | ||
const jawn = useJawnClient(apiKey.data ?? ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: passing empty string as fallback for apiKey.data could trigger unnecessary API calls - consider adding enabled: !!apiKey.data to useTestAPIKey
@@ -31,7 +31,7 @@ const PiPageContent = () => { | |||
|
|||
<Link | |||
href="/pi/setup" | |||
className=" bg-blue-500 p-5 bg-opacity-60 absolute top-1/2 left-1/2 transform translate-x-[30px] -translate-y-[110px] text-white font-bold" | |||
className="p-5 border-2 absolute top-1/2 left-1/2 transform translate-x-[16px] -translate-y-[90px] text-black font-bold h-[36.17px] px-[12.17px] py-[6.08px] origin-top-left -rotate-1 bg-white border-l-2 border-r-4 border-t-2 border-b-4 border-black flex-col justify-start items-start gap-[10.14px] inline-flex" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: height and padding values conflict - h-[36.17px] with p-5 will make element taller than specified height
<div className="flex flex-col items-center"> | ||
<img | ||
src="/static/pi/arrow-right.png" | ||
alt="arrow-left" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: incorrect alt text 'arrow-left' for right arrow image
<img | ||
src="/static/pi/arrow-left.png" | ||
alt="arrow-left" | ||
className="w-16 h-16" | ||
/> | ||
<div className="flex flex-col items-center"> | ||
<img | ||
src="/static/pi/arrow-right.png" | ||
alt="arrow-left" | ||
className="w-16 h-16" | ||
/> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: navigation arrows are rendered but not wrapped in Link components or onClick handlers
const formatNumber = ( | ||
number: number | ||
): [ | ||
number | null, | ||
number | null, | ||
"." | "," | number | null, | ||
number | null | ".", | ||
number | null, | ||
number | null | "B" | "M" | ||
] => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: formatNumber function handles number formatting but may have edge cases with negative numbers or decimals
const query = ` | ||
WITH total_cost AS ( | ||
SELECT ${clickhousePriceCalc("request_response_rmt")} as cost | ||
FROM request_response_rmt | ||
WHERE ( | ||
(${filterString}) | ||
) | ||
) | ||
SELECT coalesce(sum(cost), 0) as cost | ||
FROM total_cost | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The nested subquery with WITH clause is unnecessary here since it's just wrapping a single SELECT. Could be simplified to a direct query.
"/v1/pi/total_requests": { | ||
post: operations["GetTotalRequests"]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: GetTotalRequests no longer requires a DataIsBeautifulRequestBody in the request body, which could affect existing API clients
No description provided.