mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
error message name
This commit is contained in:
1 parent
24e23e4a6e
commit
0445b4d0c0
1 file changed
+7
-10
@@ -93,9 +93,6 @@ export function ChatPane({ projectId, projectName }: ChatPaneProps) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Unified auto-fix handler
|
||||
const handleAutoFix = async (errorType: 'build' | 'api', error: unknown) => {
|
||||
if (autoFixAttemptsRef.current >= 3) {
|
||||
const errorDetails = error instanceof Error ? error.message : 'Unknown error';
|
||||
@@ -460,15 +457,15 @@ When creating new components or pages, follow the existing patterns in the codeb
|
||||
updateMetadata('Shakespeare', `Processing your request for ${projectName}...`);
|
||||
|
||||
await createAIChat(projectId, aiMessages);
|
||||
} catch (caughtError) {
|
||||
console.error('AI chat error:', caughtError);
|
||||
} catch (error) {
|
||||
console.error('AI chat error:', error);
|
||||
|
||||
// Check if this is an AI API error that can be auto-fixed
|
||||
if (caughtError && typeof caughtError === 'object' && 'name' in caughtError &&
|
||||
(caughtError.name === 'AI_APICallError' || caughtError.name === 'AI_TypeValidationError' ||
|
||||
caughtError.name === 'ZodError')) {
|
||||
if (error && typeof error === 'object' && 'name' in error &&
|
||||
(error.name === 'AI_APICallError' || error.name === 'AI_TypeValidationError' ||
|
||||
error.name === 'ZodError')) {
|
||||
|
||||
await handleAutoFix('api', caughtError);
|
||||
await handleAutoFix('api', error);
|
||||
return; // Don't set isLoading(false) here as it's handled in handleAutoFix
|
||||
}
|
||||
|
||||
@@ -476,7 +473,7 @@ When creating new components or pages, follow the existing patterns in the codeb
|
||||
const errorMessage: AIMessage = {
|
||||
id: generateId(),
|
||||
role: 'assistant',
|
||||
content: caughtError instanceof Error ? caughtError.message : 'Sorry, I encountered an error. Please try again.',
|
||||
content: error instanceof Error ? error.message : 'Sorry, I encountered an error. Please try again.',
|
||||
};
|
||||
addMessage(errorMessage);
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user