v0.12.10: 修复工作空间目录设置不生效 + 版本号更新
fix: 工作空间目录设置三处断链修复 - ipc.ts: setDir 时持久化到 SQLite,启动时自动恢复 - settings-modal.ts: 设置成功后通知 workspace-panel 刷新 - workspace-panel.ts: 监听目录变更事件,立即重载文件列表 chore: 版本号 0.12.9 → 0.12.10
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://img.shields.io/badge/version-v0.12.9-E8734A?style=flat-square" alt="version">
|
<img src="https://img.shields.io/badge/version-v0.12.10-E8734A?style=flat-square" alt="version">
|
||||||
<img src="https://img.shields.io/badge/electron-33+-47848F?style=flat-square&logo=electron" alt="electron">
|
<img src="https://img.shields.io/badge/electron-33+-47848F?style=flat-square&logo=electron" alt="electron">
|
||||||
<img src="https://img.shields.io/badge/typescript-5.7+-3178C6?style=flat-square&logo=typescript" alt="typescript">
|
<img src="https://img.shields.io/badge/typescript-5.7+-3178C6?style=flat-square&logo=typescript" alt="typescript">
|
||||||
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="license">
|
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="license">
|
||||||
@@ -256,7 +256,7 @@ npm start
|
|||||||
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist
|
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist
|
||||||
```
|
```
|
||||||
|
|
||||||
产出:`release/Metona Ollama Setup v0.12.9.exe`
|
产出:`release/Metona Ollama Setup v0.12.10.exe`
|
||||||
|
|
||||||
## 🛠️ 常用命令
|
## 🛠️ 常用命令
|
||||||
|
|
||||||
@@ -507,7 +507,7 @@ npm start
|
|||||||
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist
|
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ npm run dist
|
||||||
```
|
```
|
||||||
|
|
||||||
Output: `release/Metona Ollama Setup v0.12.9.exe`
|
Output: `release/Metona Ollama Setup v0.12.10.exe`
|
||||||
|
|
||||||
## 🛠️ Common Commands
|
## 🛠️ Common Commands
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "metona-ollama-desktop",
|
"name": "metona-ollama-desktop",
|
||||||
"version": "0.12.9",
|
"version": "0.12.10",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "metona-ollama-desktop",
|
"name": "metona-ollama-desktop",
|
||||||
"version": "0.12.9",
|
"version": "0.12.10",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ffmpeg-static": "^5.2.0",
|
"ffmpeg-static": "^5.2.0",
|
||||||
|
|||||||
+7
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "metona-ollama-desktop",
|
"name": "metona-ollama-desktop",
|
||||||
"version": "0.12.9",
|
"version": "0.12.10",
|
||||||
"description": "Metona Ollama - TypeScript + Electron \u684c\u9762 AI \u804a\u5929\u5ba2\u6237\u7aef",
|
"description": "Metona Ollama - TypeScript + Electron 桌面 AI 聊天客户端",
|
||||||
"main": "dist/main/main.js",
|
"main": "dist/main/main.js",
|
||||||
"author": "thzxx",
|
"author": "thzxx",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -73,5 +73,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ffmpeg-static": "^5.2.0",
|
"ffmpeg-static": "^5.2.0",
|
||||||
"sql.js": "^1.11.0"
|
"sql.js": "^1.11.0"
|
||||||
|
},
|
||||||
|
"allowScripts": {
|
||||||
|
"electron@33.4.11": true,
|
||||||
|
"esbuild@0.21.5": true,
|
||||||
|
"ffmpeg-static@5.3.0": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,6 +283,8 @@ export async function setupIPC(): Promise<void> {
|
|||||||
ipcMain.handle('workspace:setDir', (_, dir: string) => {
|
ipcMain.handle('workspace:setDir', (_, dir: string) => {
|
||||||
try {
|
try {
|
||||||
setWorkspaceDir(dir);
|
setWorkspaceDir(dir);
|
||||||
|
// ── 持久化到 SQLite,重启后恢复 ──
|
||||||
|
saveSetting('workspaceDir', getWorkspaceDir());
|
||||||
return { success: true, dir: getWorkspaceDir() };
|
return { success: true, dir: getWorkspaceDir() };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return { success: false, error: (err as Error).message };
|
return { success: false, error: (err as Error).message };
|
||||||
@@ -344,6 +346,15 @@ export async function setupIPC(): Promise<void> {
|
|||||||
await initDatabase();
|
await initDatabase();
|
||||||
sendLog('success', '📦 SQLite 数据库已初始化');
|
sendLog('success', '📦 SQLite 数据库已初始化');
|
||||||
|
|
||||||
|
// ── 恢复工作空间目录 ──
|
||||||
|
try {
|
||||||
|
const savedWsDir = getSetting<string>('workspaceDir', '');
|
||||||
|
if (savedWsDir) {
|
||||||
|
setWorkspaceDir(savedWsDir);
|
||||||
|
sendLog('info', '📁 恢复工作空间目录', savedWsDir);
|
||||||
|
}
|
||||||
|
} catch { /* ignore */ }
|
||||||
|
|
||||||
// Sessions
|
// Sessions
|
||||||
ipcMain.handle('db:saveSession', (_, session) => {
|
ipcMain.handle('db:saveSession', (_, session) => {
|
||||||
try { return { success: true, id: saveSession(session) }; }
|
try { return { success: true, id: saveSession(session) }; }
|
||||||
|
|||||||
+1
-1
@@ -101,7 +101,7 @@ export function createMenu(): void {
|
|||||||
dialog.showMessageBox(mainWindow!, {
|
dialog.showMessageBox(mainWindow!, {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
title: '关于 Metona Ollama',
|
title: '关于 Metona Ollama',
|
||||||
message: 'Metona Ollama Desktop v0.12.9',
|
message: 'Metona Ollama Desktop v0.12.10',
|
||||||
detail: 'TypeScript + Electron Ollama AI 聊天客户端\n\nhttps://gitee.com/thzxx/metona-ollama',
|
detail: 'TypeScript + Electron Ollama AI 聊天客户端\n\nhttps://gitee.com/thzxx/metona-ollama',
|
||||||
icon: getIconPath()
|
icon: getIconPath()
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -288,6 +288,8 @@ export function initSettingsModal(): void {
|
|||||||
if (result.success) {
|
if (result.success) {
|
||||||
showToast('工作空间目录已更新', 'success');
|
showToast('工作空间目录已更新', 'success');
|
||||||
logSetting('工作空间目录', result.dir!);
|
logSetting('工作空间目录', result.dir!);
|
||||||
|
// ── 通知工作空间面板刷新目录 ──
|
||||||
|
window.dispatchEvent(new CustomEvent('workspaceDirChanged', { detail: { dir: result.dir } }));
|
||||||
} else {
|
} else {
|
||||||
showToast(`设置失败: ${result.error!}`, 'error');
|
showToast(`设置失败: ${result.error!}`, 'error');
|
||||||
// 恢复原值
|
// 恢复原值
|
||||||
@@ -308,6 +310,16 @@ export function openSettingsModal(): void {
|
|||||||
updateMemoryVectorStatus();
|
updateMemoryVectorStatus();
|
||||||
loadTimeoutSettings();
|
loadTimeoutSettings();
|
||||||
loadWatchdogSetting();
|
loadWatchdogSetting();
|
||||||
|
// 刷新工作空间目录显示
|
||||||
|
const bridge = window.metonaDesktop;
|
||||||
|
if (bridge?.isDesktop) {
|
||||||
|
const wsInput = document.querySelector('#inputWorkspaceDir') as HTMLInputElement;
|
||||||
|
if (wsInput) {
|
||||||
|
bridge.workspace.getDir().then((info: { dir: string }) => {
|
||||||
|
wsInput.value = info.dir;
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 加载看门狗设置到输入框 */
|
/** 加载看门狗设置到输入框 */
|
||||||
|
|||||||
@@ -237,6 +237,26 @@ export async function initWorkspacePanel(): Promise<void> {
|
|||||||
// 绑定 UI 事件
|
// 绑定 UI 事件
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
|
// ── 监听工作空间目录变更(来自设置面板)──
|
||||||
|
window.addEventListener('workspaceDirChanged', ((e: CustomEvent) => {
|
||||||
|
const newDir = e.detail?.dir;
|
||||||
|
if (newDir && newDir !== workspaceDir) {
|
||||||
|
workspaceDir = newDir;
|
||||||
|
currentFileDir = newDir;
|
||||||
|
logInfo('工作空间目录已刷新', newDir);
|
||||||
|
// 如果当前在文件页签,立即重新加载
|
||||||
|
if (activeTab === 'files') {
|
||||||
|
loadFiles(newDir);
|
||||||
|
}
|
||||||
|
// 刷新终端空闲状态中的目录显示
|
||||||
|
if (activeTab === 'terminal') {
|
||||||
|
renderTerminal();
|
||||||
|
}
|
||||||
|
// 刷新文件页签(即使不在当前 tab,下次切过去就是新路径)
|
||||||
|
renderPanel();
|
||||||
|
}
|
||||||
|
}) as EventListener);
|
||||||
|
|
||||||
// 创建唯一终端
|
// 创建唯一终端
|
||||||
terminal = {
|
terminal = {
|
||||||
id: genId(),
|
id: genId(),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<span class="logo">🦙</span>
|
<span class="logo">🦙</span>
|
||||||
<span class="app-title">Metona Ollama</span>
|
<span class="app-title">Metona Ollama</span>
|
||||||
<span class="app-version">v0.12.9</span>
|
<span class="app-version">v0.12.10</span>
|
||||||
<button class="icon-btn help-btn" id="btnHelp" title="使用帮助">
|
<button class="icon-btn help-btn" id="btnHelp" title="使用帮助">
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
|
<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user