chrome-ai-bridge 1.0.16 → 1.0.17
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/build/src/tools/gemini-web.js +14 -19
- package/package.json +1 -1
|
@@ -267,32 +267,27 @@ export const askGeminiWeb = defineTool({
|
|
|
267
267
|
}
|
|
268
268
|
response.appendResponseLine('✅ ログイン確認完了');
|
|
269
269
|
response.appendResponseLine('質問を送信中...');
|
|
270
|
-
// Input text using
|
|
271
|
-
//
|
|
270
|
+
// Input text using innerText + event dispatch for proper Angular state updates
|
|
271
|
+
// This is more reliable than keyboard.type() which can cause sync issues with Angular
|
|
272
272
|
const textboxSelector = '[role="textbox"]';
|
|
273
273
|
const textbox = await page.$(textboxSelector);
|
|
274
274
|
if (!textbox) {
|
|
275
275
|
response.appendResponseLine('❌ 入力欄が見つかりません');
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
|
-
// Click to focus
|
|
279
|
-
await textbox.click(
|
|
280
|
-
|
|
281
|
-
//
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
await page.keyboard.press('Enter');
|
|
290
|
-
await page.keyboard.up('Shift');
|
|
291
|
-
}
|
|
292
|
-
await page.keyboard.type(lines[i], { delay: 2 });
|
|
293
|
-
}
|
|
278
|
+
// Click to focus
|
|
279
|
+
await textbox.click();
|
|
280
|
+
// Use innerText + input event dispatch for proper Angular state updates
|
|
281
|
+
// This approach is more reliable than keyboard.type() which can cause sync issues
|
|
282
|
+
await textbox.evaluate((el, text) => {
|
|
283
|
+
// Clear and set content
|
|
284
|
+
el.innerText = text;
|
|
285
|
+
// Dispatch input event to notify Angular of the change
|
|
286
|
+
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
287
|
+
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
288
|
+
}, sanitizedQuestion);
|
|
294
289
|
// Wait for Angular to process the input and show send button
|
|
295
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
290
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
296
291
|
// 質問送信前に model-response 要素数を記録(ChatGPTと同じカウント方式)
|
|
297
292
|
const initialModelResponseCount = await page.evaluate(() => {
|
|
298
293
|
return document.querySelectorAll('model-response').length;
|
package/package.json
CHANGED