Skip to content
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

Merged
merged 14 commits into from
Dec 20, 2024
Merged

Pipipi #3087

merged 14 commits into from
Dec 20, 2024

Conversation

chitalian
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
helicone ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 11:14pm
helicone-bifrost ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 11:14pm
helicone-eu ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 11:14pm

Copy link

@greptile-apps greptile-apps bot left a 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

Comment on lines 22 to 25
if (apiKey.data && data && !isLoading && !apiKey.isLoading) {
router.push("/pi/first_page");
return <div>Loading...</div>;
}
Copy link

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`}>
Copy link

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"
Copy link

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

Comment on lines 15 to +16
const { data, isLoading } = useTestAPIKey(apiKey.data ?? "");
const jawn = useJawnClient(apiKey.data ?? "");
Copy link

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"
Copy link

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"
Copy link

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

Comment on lines 158 to 169
<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>
Copy link

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

Comment on lines +12 to +21
const formatNumber = (
number: number
): [
number | null,
number | null,
"." | "," | number | null,
number | null | ".",
number | null,
number | null | "B" | "M"
] => {
Copy link

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

Comment on lines +104 to +114
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
`;
Copy link

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.

Comment on lines +487 to +489
"/v1/pi/total_requests": {
post: operations["GetTotalRequests"];
};
Copy link

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

@kavinvalli kavinvalli merged commit 7d81c4d into main Dec 20, 2024
8 checks passed
@kavinvalli kavinvalli deleted the pipipi branch December 20, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants