Skip to content
Merged
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
2 changes: 1 addition & 1 deletion cli/src/image/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('generateImage (gemini)', () => {
contents: 'the prompt',
config: {
responseModalities: ['TEXT', 'IMAGE'],
imageConfig: { aspectRatio: '3:2', imageSize: '2K' },
imageConfig: { aspectRatio: '3:2', imageSize: '1K' },
},
});
});
Expand Down
6 changes: 5 additions & 1 deletion cli/src/image/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export async function generateImage(
contents: prompt,
config: {
responseModalities: ['TEXT', 'IMAGE'],
imageConfig: { aspectRatio: '3:2', imageSize: '2K' },
// 1K (~1024px) covers our largest render — the feed hero at 720px CSS
// (~1440px on a 2x display) and the ~480px side panel. 2K (~2048px) is
// bigger than anything we show and costs ~50% more per image
// ($0.101 vs $0.067), so it's wasted resolution + heavier Blob uploads.
imageConfig: { aspectRatio: '3:2', imageSize: '1K' },
},
}),
GEMINI_TIMEOUT_MS,
Expand Down
18 changes: 18 additions & 0 deletions site/src/app/commit/[sha]/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';
import Link from 'next/link';
import Image from 'next/image';
import { primaryCategory, categoryDisplayName } from '@/lib/stories';
import { loadStories, loadStoryBySha } from '@/lib/stories-loader';
import { buildStoryMetadata, canonicalUrl } from '@/lib/seo';
Expand Down Expand Up @@ -89,6 +90,23 @@ export default async function CommitStoryPage({
</h1>
<p className="font-feed-body standfirst mb-2xl">{story.standfirst}</p>

{story.imageUrl && (
<div
className="relative w-full overflow-hidden rounded-md mb-2xl"
style={{ aspectRatio: '3/2' }}
>
<Image
src={story.imageUrl}
alt={story.headline}
fill
className="object-cover"
sizes="(max-width: 768px) 100vw, 672px"
priority
unoptimized
/>
Comment thread
greptile-apps[bot] marked this conversation as resolved.
</div>
)}

<div className="font-feed-body text-foreground-secondary leading-relaxed whitespace-pre-line mb-2xl">
{story.story}
</div>
Expand Down
19 changes: 19 additions & 0 deletions site/src/components/PRArticle.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Image from 'next/image';
import type { Story } from '@/lib/stories';
import { PRMetaRow } from './PRMetaRow';
import { PRSubtitle, PRMobileReference } from './PRSubtitle';
Expand Down Expand Up @@ -42,6 +43,24 @@ export function PRArticle({
commitUrl={story.kind === 'direct-push' ? story.commitUrl : undefined}
/>
<p className="standfirst font-feed-body mb-10">{story.standfirst}</p>
{story.imageUrl && (
<div
className="relative w-full overflow-hidden rounded-md mb-10"
style={{ aspectRatio: '3/2' }}
>
<Image
src={story.imageUrl}
alt={story.headline}
fill
className="object-cover"
sizes={variant === 'panel' ? '(max-width: 768px) 100vw, 480px' : '(max-width: 768px) 100vw, 720px'}
// The full-page illustration is above the fold (likely LCP) — eager-load
// + preload it. The panel can open below the fold, so leave it lazy.
priority={variant === 'page'}
unoptimized
/>
Comment thread
greptile-apps[bot] marked this conversation as resolved.
</div>
)}
<PRStoryBody
story={story.story}
technicalDescription={story.technicalDescription || undefined}
Expand Down