fix: polish chat page refactor

This commit is contained in:
Jason
2026-05-06 22:36:11 +08:00
parent 0f0f5abb2a
commit ff15dc6e9f
6 changed files with 42 additions and 180 deletions

View File

@@ -1309,9 +1309,6 @@ function createChatHistoryRouteWindow(route: string) {
? join(process.resourcesPath, 'icon.icns')
: join(process.resourcesPath, 'icon.ico'))
// 根据系统主题设置窗口背景色
const isDark = nativeTheme.shouldUseDarkColors
const win = new BrowserWindow({
width: 600,
height: 800,
@@ -1326,13 +1323,31 @@ function createChatHistoryRouteWindow(route: string) {
titleBarStyle: 'hidden',
titleBarOverlay: false,
show: false,
backgroundColor: isDark ? '#1A1A1A' : '#F0F0F0',
backgroundColor: '#FFFFFF',
autoHideMenuBar: true
})
setupCustomTitleBarWindow(win)
win.once('ready-to-show', () => {
let hasShown = false
let isReadyToShow = false
let hasLoadedRoute = false
const showChatHistoryWindow = () => {
if (hasShown || !isReadyToShow || !hasLoadedRoute || win.isDestroyed()) return
hasShown = true
win.show()
}
win.webContents.once('did-finish-load', () => {
hasLoadedRoute = true
setTimeout(showChatHistoryWindow, 30)
})
win.webContents.once('did-fail-load', () => {
hasLoadedRoute = true
showChatHistoryWindow()
})
win.once('ready-to-show', () => {
isReadyToShow = true
showChatHistoryWindow()
})
if (process.env.VITE_DEV_SERVER_URL) {