zames_pro 2.44.0 → 2.45.0
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/browser.js +57 -15
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -2124,28 +2124,70 @@ export class DeepSeekBrowser {
|
|
|
2124
2124
|
finalPrompt = rewriteFailedAttachments(finalPrompt, failed);
|
|
2125
2125
|
}
|
|
2126
2126
|
await this._setInputText(input, finalPrompt);
|
|
2127
|
-
// Send
|
|
2128
|
-
//
|
|
2129
|
-
//
|
|
2127
|
+
// Send: wait for the send button to become ENABLED first. After an
|
|
2128
|
+
// attachment upload the button is DISABLED while the file is still
|
|
2129
|
+
// uploading; a click on a disabled button silently does nothing, so the
|
|
2130
|
+
// message stayed in the input and no generation started (the operator saw
|
|
2131
|
+
// the text + the file in the box, but nothing was sent). We poll for an
|
|
2132
|
+
// ENABLED button, then click; if none becomes enabled in time, fall back
|
|
2133
|
+
// to Enter (which is also ignored while the send is disabled).
|
|
2134
|
+
const sendDeadline = Date.now() + 8000;
|
|
2130
2135
|
let sent = false;
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2136
|
+
while (!sent && Date.now() < sendDeadline) {
|
|
2137
|
+
for (const sel of SEND_SELECTORS) {
|
|
2138
|
+
const btn = this.page.locator(sel).last();
|
|
2139
|
+
try {
|
|
2140
|
+
if ((await btn.count()) === 0)
|
|
2141
|
+
continue;
|
|
2142
|
+
if (!(await btn.isVisible().catch(() => false)))
|
|
2143
|
+
continue;
|
|
2144
|
+
// DeepSeek's send control is a div[role=button]; Playwright's
|
|
2145
|
+
// isEnabled() does NOT honor aria-disabled on a div, so read the
|
|
2146
|
+
// attribute (and a disabled class) directly — during an upload the
|
|
2147
|
+
// button is aria-disabled=true and a click is silently ignored.
|
|
2148
|
+
const enabled = await btn
|
|
2149
|
+
.evaluate((el) => {
|
|
2150
|
+
if (el.getAttribute('aria-disabled') === 'true')
|
|
2151
|
+
return false;
|
|
2152
|
+
const cls = (el.className || '').toString();
|
|
2153
|
+
if (/disabled|is-disabled/.test(cls))
|
|
2154
|
+
return false;
|
|
2155
|
+
return true;
|
|
2156
|
+
})
|
|
2157
|
+
.catch(() => true);
|
|
2158
|
+
if (!enabled)
|
|
2159
|
+
continue;
|
|
2160
|
+
await btn.click({ timeout: 1500 });
|
|
2161
|
+
sent = true;
|
|
2162
|
+
break;
|
|
2163
|
+
}
|
|
2164
|
+
catch { }
|
|
2141
2165
|
}
|
|
2142
|
-
|
|
2166
|
+
if (!sent)
|
|
2167
|
+
await this.page.waitForTimeout(150);
|
|
2143
2168
|
}
|
|
2144
2169
|
if (!sent) {
|
|
2145
2170
|
await this.page.keyboard.press('Enter');
|
|
2146
2171
|
}
|
|
2147
2172
|
this._lastSentAt = Date.now();
|
|
2148
|
-
this._askDebug('SENT at=' + this._lastSentAt);
|
|
2173
|
+
this._askDebug('SENT at=' + this._lastSentAt + ' viaButton=' + sent);
|
|
2174
|
+
// Verify the send REALLY went out: DeepSeek clears the input when the
|
|
2175
|
+
// message is accepted. If the text is still there a moment later, the
|
|
2176
|
+
// click/Enter was ignored (a disabled button during upload, a lost
|
|
2177
|
+
// keystroke) — press Enter once more so the message is not silently stuck
|
|
2178
|
+
// in the box (exactly the operator's "text + file in the box, no send").
|
|
2179
|
+
try {
|
|
2180
|
+
await this.page.waitForTimeout(300);
|
|
2181
|
+
const stillThere = await input
|
|
2182
|
+
.evaluate((el) => (el.value || el.innerText || el.textContent || '').trim())
|
|
2183
|
+
.catch(() => '');
|
|
2184
|
+
if (stillThere) {
|
|
2185
|
+
this._askDebug('SEND not cleared, pressing Enter again');
|
|
2186
|
+
await this.page.keyboard.press('Enter');
|
|
2187
|
+
this._lastSentAt = Date.now();
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
catch { }
|
|
2149
2191
|
// Wait for the start: either Stop appeared, or the answer text changed,
|
|
2150
2192
|
// or the page grew (a new answer node / longer last answer). In parallel we
|
|
2151
2193
|
// catch the rate-limit toast (only toasts, not the whole body).
|