diff --git a/chat/public/builder.js b/chat/public/builder.js index 6930800..232379f 100644 --- a/chat/public/builder.js +++ b/chat/public/builder.js @@ -2071,13 +2071,27 @@ function renderMessages(session) { const isPlanPhase = msg.phase === 'plan'; const isBuildPhase = msg.phase === 'build'; - if (isOpenRouterMessage && hasReply && (isPlanPhase || isBuildPhase)) { + // Check if the plan message is asking for clarification (not ready to build yet) + const replyContent = msg.reply || msg.partialOutput || ''; + const clarificationPatterns = [ + /To create a complete plan[,.\s\w]*I need clarification/i, + /need clarification on a few points/i, + /before I can create a plan/i, + /I have a few questions/i, + /need more (?:details|information|context)/i, + /need some clarification/i, + /could you clarify/i, + /I need to ask/i + ]; + const needsClarification = clarificationPatterns.some(pattern => pattern.test(replyContent)); + + if (isOpenRouterMessage && hasReply && (isPlanPhase || isBuildPhase) && !needsClarification) { const proceedBtn = document.createElement('button'); proceedBtn.className = 'primary'; proceedBtn.style.marginTop = '12px'; proceedBtn.style.width = '100%'; proceedBtn.textContent = 'Proceed with Build'; - proceedBtn.onclick = () => proceedWithBuild(msg.reply || msg.partialOutput); + proceedBtn.onclick = () => proceedWithBuild(replyContent); assistantBody.appendChild(proceedBtn); }