Skip to content
Open
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
18 changes: 10 additions & 8 deletions apps/web/components/onboarding/setup/chat-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
const isProcessingRef = useRef(false)
const draftRequestIdRef = useRef(0)

const backendUrl = new URL(process.env.NEXT_PUBLIC_BACKEND_URL!)

Check warning on line 79 in apps/web/components/onboarding/setup/chat-sidebar.tsx

View workflow job for this annotation

GitHub Actions / Quality Checks

lint/style/noNonNullAssertion

Forbidden non-null assertion.
const agent = useAgent({
agent: "chat-agent",
name: user?.id ?? "anonymous",
Expand Down Expand Up @@ -381,11 +381,9 @@
setIsLoading(true)

try {
const documentIds: string[] = []

for (const draft of draftDocs) {
const promises = draftDocs.map(async (draft) => {
if (draft.kind === "x_research" && xResearchStatus !== "correct") {
continue
return null
}

try {
Expand All @@ -397,13 +395,17 @@
},
})

if (docResponse.data?.id) {
documentIds.push(docResponse.data.id)
}
return docResponse.data?.id
} catch (error) {
console.warn("Error creating document:", error)
return null
}
}
})

const results = await Promise.all(promises)
const documentIds = results.filter(
(id): id is string => id !== null && id !== undefined,
)

if (documentIds.length > 0) {
await pollForMemories(documentIds)
Expand Down
Loading