@youdie006/prodex 0.16.23 → 0.16.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chatgpt-browser.js +9 -0
- package/package.json +1 -1
package/dist/chatgpt-browser.js
CHANGED
|
@@ -1362,6 +1362,15 @@ export async function sendChatGptPrompt(options) {
|
|
|
1362
1362
|
beforeSubmit = await evaluateOnPage(page, answerExpression());
|
|
1363
1363
|
dbgSend(`baseline url=${beforeSubmit.url} user=${beforeSubmit.userMessageCount} assistant=${beforeSubmit.assistantMessageCount}`);
|
|
1364
1364
|
await insertComposerTextViaCdp(cdp, options.prompt);
|
|
1365
|
+
// The send button renders asynchronously after the prompt lands. Poll for it
|
|
1366
|
+
// BEFORE submitting so (a) submitButtonFound reflects whether the control
|
|
1367
|
+
// actually EXISTS - otherwise a successful Enter-key submit skips the fallback
|
|
1368
|
+
// loop below, leaves submitButtonFound false, and a slow/undetected answer
|
|
1369
|
+
// gets mislabeled "ChatGPT web UI may have changed, update prodex" (measured
|
|
1370
|
+
// live: submitExpression finds data-testid="send-button" fine, yet the
|
|
1371
|
+
// timeout error blamed a UI change) - and (b) we never press Enter before the
|
|
1372
|
+
// composer is submit-ready.
|
|
1373
|
+
submitButtonFound = await waitForExpressionTrue(cdp, `(${submitExpression()}).ok === true`, 3_000);
|
|
1365
1374
|
// Submit. Prefer the Enter key: it goes to the focused composer and does
|
|
1366
1375
|
// not depend on coordinates, whereas the send button moves ~100px as the
|
|
1367
1376
|
// composer grows after the prompt lands, so a click at captured coordinates
|