fix: improve 404 detection for deleted conversations

- Check for 'not found' message (server response) in addition to '404'
- Only clear stored conversation ID on actual 404 errors
- Prevent unnecessary retries for deleted conversations
- Don't clear conversation on transient network errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nioasoft
2026-01-26 12:47:21 +02:00
parent 468e59f86c
commit 2b07625ce4
2 changed files with 11 additions and 4 deletions

View File

@@ -57,8 +57,12 @@ export function AssistantPanel({ projectName, isOpen, onClose }: AssistantPanelP
// Clear stored conversation ID if it no longer exists (404 error)
useEffect(() => {
if (conversationError && conversationId) {
console.warn(`Conversation ${conversationId} not found, clearing stored ID`)
setConversationId(null)
const message = conversationError.message.toLowerCase()
// Only clear for 404 errors, not transient network issues
if (message.includes('not found') || message.includes('404')) {
console.warn(`Conversation ${conversationId} not found, clearing stored ID`)
setConversationId(null)
}
}
}, [conversationError, conversationId])