Skip to content

Commit cdcb5a0

Browse files
author
maebahesioru
committed
fix: downgrade TargetClosedError in model localStorage init to debug
1 parent f0e2a81 commit cdcb5a0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/browser/model_management.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ async def _handle_initial_model_state_and_storage(page: AsyncPage):
407407
else:
408408
logger.info(' localStorage 状态良好 (isAdvancedOpen=true, promptModel有效),无需刷新页面。')
409409
except Exception as e:
410+
from playwright._impl._errors import TargetClosedError
411+
if isinstance(e, TargetClosedError):
412+
logger.debug(f'处理初始模型状态时浏览器已关闭: {e}')
413+
return
410414
logger.error(f'❌ (新) 处理初始模型状态和 localStorage 时发生严重错误: {e}', exc_info=True)
411415
try:
412416
logger.warning(' 由于发生错误,尝试回退仅从页面显示设置全局模型 ID (不写入localStorage)...')

0 commit comments

Comments
 (0)