Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/console/src/app/(console)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function TrendChart({ values, labels }: { values: number[]; labels?: string[] })
return <div className="h-48 rounded-2xl border border-white/10 bg-black/40" />;
}

const max = Math.max(...values, 1);
// ⚑ Bolt: Avoid spread operator overhead which can cause call stack issues with large arrays.
const max = values.reduce((m, v) => (v > m ? v : m), 1);
const linePoints = values
.map((value, index) => {
const x = (index / Math.max(values.length - 1, 1)) * 100;
Expand Down Expand Up @@ -44,7 +45,8 @@ function TrendChart({ values, labels }: { values: number[]; labels?: string[] })
}

function MeterList({ items }: { items: Array<{ label: string; value: number; hint?: string }> }) {
const max = Math.max(...items.map((i) => i.value), 1);
// ⚑ Bolt: Avoid O(N) intermediate array allocation and spread operator overhead by using a single reduce pass.
const max = items.reduce((currentMax, item) => (item.value > currentMax ? item.value : currentMax), 1);
return (
<div className="space-y-3">
{items.map((item) => (
Expand Down
9 changes: 6 additions & 3 deletions apps/console/src/components/console/charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export function MiniBarChart({
values: number[];
className?: string;
}) {
const max = Math.max(...values, 1);
// ⚑ Bolt: Avoid spread operator overhead which can cause call stack issues with large arrays.
const max = values.reduce((m, v) => (v > m ? v : m), 1);

return (
<div className={cn("flex h-40 items-end gap-2", className)}>
Expand All @@ -36,7 +37,8 @@ export function LinePulse({
return <div className={cn("h-36 rounded-[24px] bg-white/[0.03]", className)} />;
}

const max = Math.max(...values, 1);
// ⚑ Bolt: Avoid spread operator overhead which can cause call stack issues with large arrays.
const max = values.reduce((m, v) => (v > m ? v : m), 1);
const points = values
.map((value, index) => {
const x = (index / Math.max(values.length - 1, 1)) * 100;
Expand Down Expand Up @@ -79,7 +81,8 @@ export function TrendAreaChart({
return <div className={cn("h-52 rounded-[24px] bg-white/[0.03]", className)} />;
}

const max = Math.max(...values, 1);
// ⚑ Bolt: Avoid spread operator overhead which can cause call stack issues with large arrays.
const max = values.reduce((m, v) => (v > m ? v : m), 1);
const linePoints = values
.map((value, index) => {
const x = (index / Math.max(values.length - 1, 1)) * 100;
Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export default function LandingPage() {
</div>
{/* Code body */}
<div className="p-5 text-xs leading-relaxed">
<div className="text-zinc-500">// One endpoint β€” any model</div>
<div className="text-zinc-500">{"// One endpoint β€” any model"}</div>
<div className="mt-2">
<span className="text-purple-400">const</span> <span className="text-zinc-300">res</span> <span className="text-zinc-500">=</span> <span className="text-blue-400">await</span> <span className="text-zinc-300">fetch</span><span className="text-zinc-500">(</span>
</div>
Expand Down Expand Up @@ -215,12 +215,12 @@ export default function LandingPage() {

{/* Response */}
<div className="mt-4 border-t border-zinc-800 pt-4">
<div className="text-zinc-500">// ↳ Auto-routed to cheapest provider</div>
<div className="text-zinc-500">{"// ↳ Auto-routed to cheapest provider"}</div>
<div className="mt-1">
<span className="text-zinc-300">model</span><span className="text-zinc-500">:</span> <span className="text-emerald-400">&quot;gpt-4o&quot;</span> <span className="text-zinc-600">// via OpenAI</span>
<span className="text-zinc-300">model</span><span className="text-zinc-500">:</span> <span className="text-emerald-400">&quot;gpt-4o&quot;</span> <span className="text-zinc-600">{"// via OpenAI"}</span>
</div>
<div className="mt-1">
<span className="text-zinc-300">tokens</span><span className="text-zinc-500">:</span> <span className="text-amber-400">42</span> <span className="text-zinc-600">// 1 credit deducted</span>
<span className="text-zinc-300">tokens</span><span className="text-zinc-500">:</span> <span className="text-amber-400">42</span> <span className="text-zinc-600">{"// 1 credit deducted"}</span>
</div>
<div className="mt-1">
<span className="text-zinc-300">latency</span><span className="text-zinc-500">:</span> <span className="text-amber-400">842</span><span className="text-zinc-500">ms</span>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/terms/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function TermsPage() {
</section>
<section>
<h2 className="text-xl font-semibold text-zinc-100 mb-3">5. Limitation of Liability</h2>
<p className="text-zinc-400 leading-relaxed">AI Gateway is provided "as is" without warranties of any kind. We are not liable for indirect, incidental, or consequential damages arising from service use.</p>
<p className="text-zinc-400 leading-relaxed">AI Gateway is provided &quot;as is&quot; without warranties of any kind. We are not liable for indirect, incidental, or consequential damages arising from service use.</p>
</section>
<section>
<h2 className="text-xl font-semibold text-zinc-100 mb-3">6. Contact</h2>
Expand Down
Loading