Skip to content

[fix]: 🎸 修复因为AiStudio UI变化导致的selector失效问题#229

Merged
CJackHwang merged 1 commit intoCJackHwang:mainfrom
cbweixin:main
Aug 24, 2025
Merged

[fix]: 🎸 修复因为AiStudio UI变化导致的selector失效问题#229
CJackHwang merged 1 commit intoCJackHwang:mainfrom
cbweixin:main

Conversation

@cbweixin
Copy link
Contributor

最近Aistudio的UI又有变化,导致这些问题

问题1:对话历史无法清空

2025-08-22 11:39:10,837 - ERROR [SERVER] - [05hhcni] 清空聊天过程中发生错误: Locator.click: Timeout 3000ms exceeded.
Call log:
  - waiting for locator('button.primary:has-text("Continue")')

2025-08-22 11:39:10,838 - INFO [SERVER] - [05hhcni] 尝试保存错误快照 (clear_chat_error)...
2025-08-22 11:39:11,102 - INFO [SERVER] - [05hhcni]   快照已保存到: /Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/../errors_py/clear_chat_error_05hhcni_1755887950838.png
2025-08-22 11:39:11,126 - INFO [SERVER] - [05hhcni]   HTML 已保存到: /Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/../errors_py/clear_chat_error_05hhcni_1755887950838.html
2025-08-22 11:39:11,126 - ERROR [SERVER] - [05hhcni] (Worker) 清空操作时发生错误: Locator.click: Timeout 3000ms exceeded.
Call log:
  - waiting for locator('button.primary:has-text("Continue")')
Traceback (most recent call last):
  File "/Users/xinwei/github/personal/AIstudioProxyAPI/api_utils/queue_worker.py", line 328, in queue_worker
    await page_controller.clear_chat_history(client_disco_checker)
  File "/Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/page_controller.py", line 573, in clear_chat_history
    await self._execute_chat_clear(clear_chat_button_locator, confirm_button_locator, overlay_locator, check_client_disconnected)
  File "/Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/page_controller.py", line 618, in _execute_chat_clear
    await confirm_button_locator.click(timeout=CLICK_TIMEOUT_MS)

修复后

 INFO [SERVER] - [ev4ohth] 点击"清空聊天"按钮: button[data-test-clear="outside"][aria-label="Clear chat"]
2025-08-23 19:58:08,625 - INFO [SERVER] - [ev4ohth] 等待清空聊天确认遮罩层出现: .mat-mdc-dialog-inner-container
2025-08-23 19:58:08,635 - INFO [SERVER] - [ev4ohth] 清空聊天确认遮罩层已出现。
2025-08-23 19:58:08,636 - INFO [SERVER] - [ev4ohth] 点击"继续"按钮 (在对话框中): button.ms-button-primary:has-text("Continue")
2025-08-23 19:58:08,702 - INFO [SERVER] - [ev4ohth] 等待清空聊天确认按钮/对话框消失 (尝试 1/3)...
2025-08-23 19:58:08,831 - INFO [SERVER] - [ev4ohth] ✅ 清空聊天确认对话框已成功消失。
2025-08-23 19:58:09,356 - INFO [SERVER] - [ev4ohth] ✅ 聊天已成功清空 (验证通过 - 最后响应容器隐藏)。
2025-08-23 19:58:09,356 - INFO [SERVER] - [ev4ohth] (Worker) ✅ 聊天历史清空完成。

问题2 : temperature 无法调整

2025-08-23 19:21:45,376 - INFO [SERVER] - [c3pjwre] 请求温度 (1.0) 与缓存值 (None) 不一致或缓存中无值。需要与页面交互。
2025-08-23 19:21:50,383 - ERROR [SERVER] - [c3pjwre] ❌ 操作温度输入框时发生错误: Locator expected to be visible
Actual value: <element(s) not found>
Call log:
  - LocatorAssertions.to_be_visible with timeout 5000ms
  - waiting for locator('div[data-test-id="temperatureSliderContainer"] input[type="number"].slider-input')
。清除缓存中的温度。
2025-08-23 19:21:50,383 - INFO [SERVER] - [c3pjwre] 尝试保存错误快照 (temperature_playwright_error)...
2025-08-23 19:21:50,450 - INFO [SERVER] - [c3pjwre]   快照已保存到: /Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/../errors_py/temperature_playwright_error_c3pjwre_1756002110383.png
2025-08-23 19:21:50,470 - INFO [SERVER] - [c3pjwre]   HTML 已保存到: /Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/../errors_py/temperature_playwright_error_c3pjwre_1756002110383.html

修复后

- [ev4ohth] 开始调整所有请求参数...
2025-08-23 19:56:34,190 - INFO [SERVER] - [ev4ohth] 检查并调整温度设置...
2025-08-23 19:56:34,190 - INFO [SERVER] - [ev4ohth] 请求温度 (1.0) 与缓存值 (None) 不一致或缓存中无值。需要与页面交互。
2025-08-23 19:56:34,237 - INFO [SERVER] - [ev4ohth] 页面当前温度: 1.0, 请求调整后温度: 1.0
2025-08-23 19:56:34,237 - INFO [SERVER] - [ev4ohth] 页面当前温度 (1.0) 与请求温度 (1.0) 一致。更新缓存并跳过写入。
2025-08-23 19:56:34,237 - INFO [SERVER] - [ev4ohth] 检查并调整最大输出 Token 设置...
2025-08-23 19:56:34,263 - INFO [SERVER] - [ev4ohth] 页面当前最大输出 Tokens (65536) 与请求值 (65536) 一致。更新缓存并跳过写入。

问题3: topK 无法调整

2025-08-23 19:21:55,777 - ERROR [SERVER] - [c3pjwre] ❌ 调整 Top P 时出错: Locator expected to be visible
Actual value: <element(s) not found>
Call log:
  - LocatorAssertions.to_be_visible with timeout 5000ms
  - waiting for locator('div.settings-item-column:has(h3:text-is("Top P")) input[type="number"].slider-input')

2025-08-23 19:21:55,778 - INFO [SERVER] - [c3pjwre] 尝试保存错误快照 (top_p_error)...
2025-08-23 19:21:55,832 - INFO [SERVER] - [c3pjwre]   快照已保存到: /Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/../errors_py/top_p_error_c3pjwre_1756002115779.png
2025-08-23 19:21:55,852 - INFO [SERVER] - [c3pjwre]   HTML 已保存到: /Users/xinwei/github/personal/AIstudioProxyAPI/browser_utils/../errors_py/top_p_error_c3pjwre_1756002115779.html

修复后:

2025-08-23 19:56:34,263 - INFO [SERVER] - [ev4ohth] 检查并设置停止序列...
2025-08-23 19:56:34,579 - INFO [SERVER] - [ev4ohth] ✅ 停止序列已成功设置。缓存已更新。
2025-08-23 19:56:34,579 - INFO [SERVER] - [ev4ohth] 检查并调整 Top P 设置...
2025-08-23 19:56:34,591 - INFO [SERVER] - [ev4ohth] 页面 Top P (0.95) 与请求值 (1.0) 不同,正在更新...
2025-08-23 19:56:34,748 - INFO [SERVER] - [ev4ohth] ✅ Top P 已成功更新为: 1.0
2025-08-23 19:56:34,748 - INFO [SERVER] - [ev4ohth] 检查并确保工具面板已展开...
2025-08-23 19:56:34,762 - INFO [SERVER] - [ev4ohth] 工具面板已处于展开状态。
2025-08-23 19:56:34,762 - INFO [SERVER] - [ev4ohth] URL Context 功能已禁用,跳过调整。

我对selector也不很熟,也是问的AI, 但是看起来好像还能work。

@CJackHwang CJackHwang merged commit af21fb6 into CJackHwang:main Aug 24, 2025
@CJackHwang
Copy link
Owner

感谢,这个修改是正确的

@cbweixin
Copy link
Contributor Author

@CJackHwang ,谢谢你接受我的修改,十分开心。我每天都在使用,伟大的项目!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants