fix: 工作空间面板定位、中文乱码、快捷键、帮助文档
- 工作空间面板 top 改用 CSS 变量 --nav-height,JS 动态计算 header+model-bar 实际高度
- Windows 下 spawn 子进程前加 chcp 65001 切换 UTF-8 代码页,修复中文乱码
- 补全 Ctrl+K(知识库)、Ctrl+M(记忆面板)快捷键,防止 Ctrl+M 默认行为冲突
- 帮助弹框内容全面更新,修正工作空间为常驻显示,补充 Ctrl+N、布局说明等
- Token 统计图标从 emoji 🪙 改为内联 SVG,兼容所有 Windows 字体
This commit is contained in:
@@ -212,6 +212,8 @@ async function init(): Promise<void> {
|
||||
setupDesktopIntegration();
|
||||
|
||||
bindGlobalEvents();
|
||||
updateNavHeight();
|
||||
window.addEventListener('resize', updateNavHeight);
|
||||
|
||||
await checkConnection();
|
||||
await loadModels();
|
||||
@@ -283,10 +285,25 @@ async function init(): Promise<void> {
|
||||
initSettingsModal();
|
||||
initHistoryModal();
|
||||
setupDesktopIntegration();
|
||||
updateNavHeight();
|
||||
window.addEventListener('resize', updateNavHeight);
|
||||
checkConnection().then(loadModels);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态计算顶部导航高度(header + model-bar),
|
||||
* 设为 CSS 变量 --nav-height,供 workspace-panel 引用
|
||||
*/
|
||||
function updateNavHeight(): void {
|
||||
const header = document.querySelector<HTMLElement>('.app-header');
|
||||
const modelBar = document.querySelector<HTMLElement>('.model-bar');
|
||||
const headerH = header?.getBoundingClientRect().height ?? 0;
|
||||
const modelBarH = modelBar?.getBoundingClientRect().height ?? 0;
|
||||
const total = Math.ceil(headerH + modelBarH);
|
||||
document.documentElement.style.setProperty('--nav-height', `${total}px`);
|
||||
}
|
||||
|
||||
function bindGlobalEvents(): void {
|
||||
document.querySelector('#btnNewChat')?.addEventListener('click', startNewSession);
|
||||
|
||||
@@ -298,6 +315,18 @@ function bindGlobalEvents(): void {
|
||||
(document.querySelector('#helpModal') as HTMLElement).style.display = 'none';
|
||||
(document.querySelector('#kbModal') as HTMLElement).style.display = 'none';
|
||||
}
|
||||
|
||||
// Ctrl+K — 知识库管理
|
||||
if (e.ctrlKey && e.key === 'k') {
|
||||
e.preventDefault();
|
||||
document.querySelector('#btnKB')?.dispatchEvent(new Event('click'));
|
||||
}
|
||||
|
||||
// Ctrl+M — 记忆面板
|
||||
if (e.ctrlKey && e.key === 'm') {
|
||||
e.preventDefault();
|
||||
document.querySelector('#btnMemory')?.dispatchEvent(new Event('click'));
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('error', (e) => {
|
||||
|
||||
Reference in New Issue
Block a user