reduce auto-build messages

This commit is contained in:
Chad Curtis committed 2025-08-20 11:16:33 +00:00
1 parent 0140e46894
commit 665ca097f9
3 files changed
+12 -28

No files matched your search

+7 -23
View File
@@ -235,14 +235,6 @@ BASE_DOMAIN=nostrdeploy.com`);
// Reset auto-fix attempts on successful completion
autoFixAttemptsRef.current = 0;
// Add a system message to indicate auto-build is starting
const autoBuildMessage: AIMessage = {
id: generateId(),
role: 'assistant',
content: '✅ Agent completed successfully. Auto-building project and checking deployment preview...',
};
addMessage(autoBuildMessage);
// Auto-build the project after a short delay
setTimeout(async () => {
try {
@@ -267,14 +259,6 @@ BASE_DOMAIN=nostrdeploy.com`);
window.dispatchEvent(buildCompleteEvent);
console.log('Dispatched buildComplete event for project:', projectId);
// Add success message
const buildSuccessMessage: AIMessage = {
id: generateId(),
role: 'assistant',
content: '🎉 Project built successfully! Checking deployment preview...',
};
addMessage(buildSuccessMessage);
// Switch to preview tab to show the updated deployment
setTimeout(() => {
try {
@@ -291,14 +275,14 @@ BASE_DOMAIN=nostrdeploy.com`);
previewButton.click();
console.log('Switched to preview tab');
// Add final success message
// Add single consolidated success message
setTimeout(() => {
const finalMessage: AIMessage = {
const successMessage: AIMessage = {
id: generateId(),
role: 'assistant',
content: '👀 Preview updated! Your changes are now visible in the preview pane.',
content: '✅ Agent completed successfully. Project built and preview updated!',
};
addMessage(finalMessage);
addMessage(successMessage);
}, 1000);
} else {
console.log('Preview tab button not found');
@@ -306,7 +290,7 @@ BASE_DOMAIN=nostrdeploy.com`);
const manualSwitchMessage: AIMessage = {
id: generateId(),
role: 'assistant',
content: '📱 Project built successfully! Switch to the "Preview" tab to see your changes.',
content: '✅ Agent completed successfully. Project built! Switch to the "Preview" tab to see your changes.',
};
addMessage(manualSwitchMessage);
}
@@ -373,7 +357,7 @@ Please fix this issue and ensure the project builds successfully.`,
// Get the current messages state using ref to ensure we have the latest
const currentMessages = messagesRef.current;
const aiMessages: AIMessage[] = [...currentMessages, autoBuildMessage, buildErrorMessage, errorFixRequest];
const aiMessages: AIMessage[] = [...currentMessages, buildErrorMessage, errorFixRequest];
await createAIChat(projectId, aiMessages);
} catch (fixError) {
console.error('Failed to get AI to fix build error:', fixError);
@@ -388,7 +372,7 @@ Please fix this issue and ensure the project builds successfully.`,
}
}, 1000);
}
}, 1000); // Small delay to show the auto-build message first
}, 1000); // Small delay before starting auto-build
}
},
tools: {
+4 -4
View File
@@ -9,7 +9,7 @@ describe('AssistantContent', () => {
describe('Build Action Detection', () => {
it('should render build action for string content with auto-build message', () => {
const content = '✅ Agent completed successfully. Auto-building project and checking deployment preview...';
const content = '✅ Agent completed successfully. Project built and preview updated!';
render(
<TestApp>
@@ -22,7 +22,7 @@ describe('AssistantContent', () => {
});
it('should render build action for string content with build success message', () => {
const content = '🎉 Project built successfully! Checking deployment preview...';
const content = '✅ Agent completed successfully. Project built! Switch to the "Preview" tab to see your changes.';
render(
<TestApp>
@@ -35,7 +35,7 @@ describe('AssistantContent', () => {
});
it('should render build action for string content with preview updated message', () => {
const content = '👀 Preview updated! Your changes are now visible in the preview pane.';
const content = '✅ Agent completed successfully. Project built and preview updated!';
render(
<TestApp>
@@ -62,7 +62,7 @@ describe('AssistantContent', () => {
it('should render build action for array content with auto-build message', () => {
const content = [
{ type: 'text' as const, text: '✅ Agent completed successfully. Auto-building project and checking deployment preview...' }
{ type: 'text' as const, text: '✅ Agent completed successfully. Project built and preview updated!' }
];
render(
+1 -1
View File
@@ -81,7 +81,7 @@ export const AssistantContent = memo(({ content, toolResults = [] }: AssistantCo
let isLoading = false;
// Determine action type and status based on full text content
if (fullText.includes('Auto-build') || fullText.includes('Auto-building')) {
if (fullText.includes('Auto-build') || fullText.includes('Auto-building') || (fullText.includes('Agent completed successfully') && fullText.includes('built'))) {
actionType = 'auto-build';
} else if (fullText.includes('Auto-fix') || fullText.includes('Fixing')) {
actionType = 'auto-fix';