Skip to content

Commit ab2bbeb

Browse files
committed
Fix queued context-doc status and readiness check
1 parent db08521 commit ab2bbeb

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

apps/desktop/src/renderer/components/onboarding/ProjectSetupPage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ function isContextGenerationActive(status: ContextStatus["generation"] | null |
7272
}
7373

7474
function hasReadyContextDocs(status: ContextStatus | null): boolean {
75-
return status?.docs?.every((doc) => doc.exists && doc.sizeBytes >= 200) ?? false;
75+
const docs = status?.docs;
76+
return !!docs?.length && docs.every((doc) => doc.exists && doc.sizeBytes >= 200);
7677
}
7778

7879
export function ProjectSetupPage() {
@@ -277,7 +278,9 @@ export function ProjectSetupPage() {
277278
{contextLoading
278279
? "Checking status..."
279280
: isGenerating
280-
? "Generating docs — this can take a minute or two depending on your model and repo size."
281+
? (contextStatus?.generation.state === "pending"
282+
? "Doc generation is queued and will start shortly."
283+
: "Generating docs — this can take a minute or two depending on your model and repo size.")
281284
: contextStatus?.generation.state === "failed"
282285
? `Last generation failed${contextStatus.generation.error ? `: ${contextStatus.generation.error}` : "."}`
283286
: hasReadyContextDocs(contextStatus)

apps/desktop/src/renderer/components/settings/ContextSection.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,9 @@ export function ContextSection() {
238238

239239
{isContextGenerationActive(docsStatus?.generation) ? (
240240
<div style={{ fontFamily: SANS_FONT, fontSize: 11, color: COLORS.info, padding: "8px 12px", borderRadius: 8, background: `${COLORS.info}08`, border: `1px solid ${COLORS.info}18` }}>
241-
Context docs are being generated. This may take a minute depending on your model and project size.
241+
{docsStatus?.generation.state === "pending"
242+
? "Context doc generation is queued and will start shortly."
243+
: "Context docs are being generated. This may take a minute depending on your model and project size."}
242244
{describeGenerationSource(docsStatus?.generation) ? ` ${describeGenerationSource(docsStatus?.generation)}` : ""}
243245
</div>
244246
) : null}
@@ -258,7 +260,7 @@ export function ContextSection() {
258260
const hasContent = doc.exists && doc.sizeBytes >= MIN_DOC_SIZE;
259261
const statusColor = isGenerating ? COLORS.info : hasContent ? COLORS.success : COLORS.warning;
260262
const statusText = isGenerating
261-
? "generating..."
263+
? (docsStatus.generation.state === "pending" ? "queued..." : "generating...")
262264
: hasContent
263265
? `ready \u00b7 updated ${relativeTime(doc.updatedAt)}`
264266
: doc.exists

0 commit comments

Comments
 (0)