-
Notifications
You must be signed in to change notification settings - Fork 0
add simple form and loading state #7
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { Sparkles } from "lucide-react"; | ||
| import { Navbar } from "@/components/layout/Navbar"; | ||
|
|
||
| export default function Loading() { | ||
| return ( | ||
| <> | ||
| <Navbar /> | ||
| <main className="mx-auto w-full max-w-5xl px-4 py-8 sm:px-6 lg:px-8"> | ||
| <section className="paper-card relative overflow-hidden rounded-[2.5rem] p-6 sm:p-8"> | ||
| <div className="pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(178,74,47,0.12),transparent_34%),radial-gradient(circle_at_top_right,rgba(23,19,17,0.08),transparent_30%)]" /> | ||
| <div className="relative flex flex-col gap-6"> | ||
| <div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"> | ||
| <div> | ||
| <div className="h-3 w-28 animate-pulse rounded-full bg-black/10" /> | ||
| <div className="mt-4 h-12 w-4/5 animate-pulse rounded-[1.25rem] bg-black/10 sm:h-14 sm:w-3/5" /> | ||
| <div className="mt-4 h-4 w-full max-w-2xl animate-pulse rounded-full bg-black/10" /> | ||
| <div className="mt-3 h-4 w-5/6 animate-pulse rounded-full bg-black/10" /> | ||
| </div> | ||
|
|
||
| <div className="inline-flex items-center gap-2 self-start rounded-full border border-[color:theme(--color-border)] bg-white/80 px-4 py-3 text-sm font-semibold text-ink"> | ||
| <Sparkles className="h-4 w-4" /> | ||
| Forging | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="rounded-[2rem] border border-[color:theme(--color-border)] bg-white/75 p-5 sm:p-6"> | ||
| <div className="space-y-5"> | ||
| <div className="inline-flex items-center gap-2 rounded-full border border-[color:theme(--color-border)] bg-white/80 px-3 py-2 text-xs font-semibold tracking-[0.2em] text-muted uppercase"> | ||
| <Sparkles className="h-4 w-4" /> | ||
| Generating | ||
| </div> | ||
| <div className="space-y-3"> | ||
| <div className="h-4 w-1/4 animate-pulse rounded-full bg-black/10" /> | ||
| <div className="h-4 w-5/6 animate-pulse rounded-full bg-black/10" /> | ||
| <div className="h-4 w-4/5 animate-pulse rounded-full bg-black/10" /> | ||
| <div className="h-4 w-3/4 animate-pulse rounded-full bg-black/10" /> | ||
| <div className="h-4 w-2/3 animate-pulse rounded-full bg-black/10" /> | ||
| </div> | ||
| <div className="rounded-[1.5rem] border border-dashed border-[color:theme(--color-border)] bg-white/70 p-4"> | ||
| <div className="space-y-3"> | ||
| <div className="h-3 w-2/5 animate-pulse rounded-full bg-black/10" /> | ||
| <div className="h-3 w-full animate-pulse rounded-full bg-black/10" /> | ||
| <div className="h-3 w-11/12 animate-pulse rounded-full bg-black/10" /> | ||
| <div className="h-3 w-4/5 animate-pulse rounded-full bg-black/10" /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </section> | ||
| </main> | ||
| </> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🌐 Web query:
In the Gemini generateContent API response schema, can candidates[0].content.parts contain multiple text parts for one candidate, and should clients concatenate them to reconstruct the full text response?💡 Result:
Yes, the Gemini generateContent API response schema can contain multiple text parts within candidates.content.parts [1][2][3]. While many simple requests return a single text part, the API may return multiple parts in scenarios such as when the model includes "thinking" blocks, function calls, or other structured content alongside the generated text [2][3]. Clients should not rely solely on convenience accessors (like response.text) if they need to handle all response types robustly, as these accessors often only work for simple, single-part responses and may fail or return incomplete data when multiple parts are present [4][5][6]. To reconstruct the full text response correctly, clients should iterate through the parts array, check for the presence of text, and concatenate all text segments [4][2][3]. Example logic for reconstruction: const fullText = response.candidates.content.parts.filter(part => part.text).map(part => part.text).join(''); [4][2]
Citations:
🏁 Script executed:
Repository: JasonDebnath001/PromptForge
Length of output: 686
🏁 Script executed:
Repository: JasonDebnath001/PromptForge
Length of output: 1295
Concatenate all returned Gemini text parts instead of reading only the first part.
At lines 172–174, the code uses only
parts[0]?.text, which can truncate valid output when the Gemini API response splits content across multiple parts. The API may return multiple text parts in thecontent.partsarray—for example, when the model includes thinking blocks or other structured content—and clients should concatenate all text segments to reconstruct the full response.Proposed fix
🤖 Prompt for AI Agents