feat: 浏览器面板体验修复与流式/思考组件简化

This commit is contained in:
Rick Ye
2026-09-09 02:24:25 +08:00
parent 3f9d79ca30
commit b9bb72ada9
13 changed files with 147 additions and 145 deletions
@@ -31,7 +31,9 @@ import {
*/
const PARTITION = 'persist:aso-browser'
const NEW_TAB_URL = 'https://www.google.com/'
// 新标签页默认地址:google.com 在目标市场(国内)不可达,新开标签会长时间白屏,
// 误以为浏览器故障;用可稳定访问的导航页
const NEW_TAB_URL = 'https://www.baidu.com/'
const MAX_TABS = 12
const MAX_FILL_CHARS = 10_000
const MAX_SCRIPT_CHARS = 20_000
@@ -932,6 +934,15 @@ export class BrowserController {
return { tabId: tab.tabId, url: tab.url, title: tab.title, dataUrl: image.toDataURL() }
})
}
/** 渲染层「冻结帧」用:菜单/浮层需要暂时隐藏原生视图前,截当前画面做占位,
* 视觉上等于菜单浮在页面之上(DOM 层级永远低于原生视图,菜单弹出必须先让位) */
async captureTabDataUrl(tabId?: string): Promise<string> {
const tab = tabId ? this.tabs.get(tabId) : this.activeTabId ? this.tabs.get(this.activeTabId) : null
if (!tab) throw new Error('标签页不存在,无法截取画面。')
const image = await tab.view.webContents.capturePage()
return image.toDataURL()
}
}
const MAX_BROWSER_OBSERVE_DEPTH_FALLBACK = 400
+4
View File
@@ -332,6 +332,10 @@ export function registerIpc(): AgentService {
browserPass(() => getBrowserController().closeTab(typeof tabId === 'string' ? tabId : undefined))
)
ipcMain.handle('browser:close', () => browserPass(() => getBrowserController().close()))
// 渲染层冻结帧:菜单弹出需暂时隐藏原生视图前,截当前页面画面做占位
ipcMain.handle('browser:captureTab', (_e, tabId: unknown) =>
browserPass(() => getBrowserController().captureTabDataUrl(typeof tabId === 'string' && tabId ? tabId : undefined))
)
ipcMain.handle('browser:acknowledgeRisk', () => browserPass(() => getBrowserController().acknowledgeRisk()))
// 渲染层 BrowserSlot 量出的占位矩形(原生 WebContentsView 对齐到 DOM 布局)
ipcMain.handle('browser:layout', (_e, layout: unknown) => {