Skip to content

An AI-powered search engine with a generative UI

fix: suppress abort noise in title generation

Yoshiki Miuraf0f9741c4b97
diff --git a/lib/agents/title-generator.ts b/lib/agents/title-generator.ts
index f4570513..26cc4f42 100644
--- a/lib/agents/title-generator.ts
+++ b/lib/agents/title-generator.ts
@@ -59,8 +59,17 @@ export async function generateChatTitle({
// Remove any surrounding quotes that the model might have added
return cleanedTitle.replace(/^[\"']|[\"']$/g, '')
} catch (error) {
- console.error('Error generating chat title with LLM:', error)
- // If LLM generation fails, return the fallback title.
+ if (
+ error instanceof Error &&
+ (error.name === 'AbortError' || error.name === 'ResponseAborted')
+ ) {
+ if (process.env.NODE_ENV === 'development') {
+ console.info('Title generation aborted; using fallback title.')
+ }
+ } else {
+ console.error('Error generating chat title with LLM:', error)
+ }
+ // If LLM generation fails or is aborted, return the fallback title.
return fallbackTitle
}
}