Hide Proceed with Build button when AI needs clarification

- Add pattern matching to detect clarification requests in plan responses
- Hide Proceed with Build button when AI asks questions about missing details
- Button will still show for complete plans that are ready to build
This commit is contained in:
southseact-3d
2026-02-09 18:05:59 +00:00
parent f9dc1a6920
commit a52572ede1

View File

@@ -2071,13 +2071,27 @@ function renderMessages(session) {
const isPlanPhase = msg.phase === 'plan'; const isPlanPhase = msg.phase === 'plan';
const isBuildPhase = msg.phase === 'build'; 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'); const proceedBtn = document.createElement('button');
proceedBtn.className = 'primary'; proceedBtn.className = 'primary';
proceedBtn.style.marginTop = '12px'; proceedBtn.style.marginTop = '12px';
proceedBtn.style.width = '100%'; proceedBtn.style.width = '100%';
proceedBtn.textContent = 'Proceed with Build'; proceedBtn.textContent = 'Proceed with Build';
proceedBtn.onclick = () => proceedWithBuild(msg.reply || msg.partialOutput); proceedBtn.onclick = () => proceedWithBuild(replyContent);
assistantBody.appendChild(proceedBtn); assistantBody.appendChild(proceedBtn);
} }