diff --git a/apps/desktop/src/main/core/Browser.ts b/apps/desktop/src/main/core/Browser.ts
index 90c41200af..f56ff95196 100644
--- a/apps/desktop/src/main/core/Browser.ts
+++ b/apps/desktop/src/main/core/Browser.ts
@@ -55,6 +55,12 @@ export default class Browser {
return this.retrieveOrInitialize();
}
+ get webContents() {
+ if (this._browserWindow.isDestroyed()) return null;
+
+ return this._browserWindow.webContents;
+ }
+
/**
* Method to construct BrowserWindows object
* @param options
@@ -210,7 +216,6 @@ export default class Browser {
session: browserWindow.webContents.session,
});
- console.log('platform:',process.platform);
// Windows 11 can use this new API
if (process.platform === 'win32' && browserWindow.setBackgroundMaterial) {
logger.debug(`[${this.identifier}] Setting window background material for Windows 11`);
diff --git a/apps/desktop/src/main/core/BrowserManager.ts b/apps/desktop/src/main/core/BrowserManager.ts
index 5efeed293d..fcb9f043a3 100644
--- a/apps/desktop/src/main/core/BrowserManager.ts
+++ b/apps/desktop/src/main/core/BrowserManager.ts
@@ -157,8 +157,8 @@ export default class BrowserManager {
this.webContentsMap.set(browser.browserWindow.webContents, identifier);
// 当窗口关闭时清理映射
- browser.browserWindow.on('closed', () => {
- this.webContentsMap.delete(browser.browserWindow.webContents);
+ browser.browserWindow.on('close', () => {
+ if (browser.webContents) this.webContentsMap.delete(browser.webContents);
});
return browser;
diff --git a/package.json b/package.json
index bb8021a997..7c8d9627b1 100644
--- a/package.json
+++ b/package.json
@@ -163,6 +163,7 @@
"@vercel/edge-config": "^1.4.0",
"@vercel/functions": "^2.0.0",
"@vercel/speed-insights": "^1.2.0",
+ "@xterm/xterm": "^5.5.0",
"ahooks": "^3.8.4",
"ai": "^3.4.33",
"antd": "^5.24.6",
diff --git a/src/app/[variants]/(main)/settings/provider/(detail)/ollama/CheckError.tsx b/src/app/[variants]/(main)/settings/provider/(detail)/ollama/CheckError.tsx
index 63edb75db5..382bc1a035 100644
--- a/src/app/[variants]/(main)/settings/provider/(detail)/ollama/CheckError.tsx
+++ b/src/app/[variants]/(main)/settings/provider/(detail)/ollama/CheckError.tsx
@@ -44,7 +44,7 @@ const CheckError = ({
const errorMessage = errorBody.error?.message;
- if (error?.type === 'OllamaServiceUnavailable') return ;
+ if (error?.type === 'OllamaServiceUnavailable') return ;
// error of not pull the model
const unresolvedModel = errorMessage?.match(UNRESOLVED_MODEL_REGEXP)?.[1];
diff --git a/src/features/OllamaSetupGuide/Desktop.tsx b/src/features/OllamaSetupGuide/Desktop.tsx
index 7f5cca44af..9651c79a7e 100644
--- a/src/features/OllamaSetupGuide/Desktop.tsx
+++ b/src/features/OllamaSetupGuide/Desktop.tsx
@@ -9,8 +9,6 @@ import { Center } from 'react-layout-kit';
import FormAction from '@/components/FormAction';
import { useChatStore } from '@/store/chat';
-import { ErrorActionContainer } from '../Conversation/Error/style';
-
// TODO: 优化 Ollama setup 的流程,isDesktop 模式下可以直接做到端到端检测
const OllamaDesktopSetupGuide = memo<{ id?: string }>(({ id }) => {
const theme = useTheme();
@@ -22,44 +20,42 @@ const OllamaDesktopSetupGuide = memo<{ id?: string }>(({ id }) => {
]);
return (
-
-
- }
- description={
-
-
- 请确认你已经开启 Ollama ,如果没有安装 Ollama ,请前往官网
- 下载
-
-
- }
- title={t('OllamaSetupGuide.install.title')}
- />
- {id && (
- <>
-
-
- >
- )}
-
-
+
+ }
+ description={
+
+
+ 请确认你已经开启 Ollama ,如果没有安装 Ollama ,请前往官网
+ 下载
+
+
+ }
+ title={t('OllamaSetupGuide.install.title')}
+ />
+ {id && (
+ <>
+
+
+ >
+ )}
+
);
});
diff --git a/src/store/tool/slices/store/action.ts b/src/store/tool/slices/store/action.ts
index cadfbf3bd5..8ad6feef95 100644
--- a/src/store/tool/slices/store/action.ts
+++ b/src/store/tool/slices/store/action.ts
@@ -70,7 +70,7 @@ export const createPluginStoreSlice: StateCreator<
loadPluginStore: async () => {
const pluginMarketIndex = await toolService.getToolList();
- set({ pluginStoreList: pluginMarketIndex }, false, n('loadPluginList'));
+ set({ pluginStoreList: pluginMarketIndex || [] }, false, n('loadPluginList'));
return pluginMarketIndex;
},
diff --git a/src/tools/local-files/Render/RenameLocalFile/index.tsx b/src/tools/local-files/Render/RenameLocalFile/index.tsx
new file mode 100644
index 0000000000..dd52079e53
--- /dev/null
+++ b/src/tools/local-files/Render/RenameLocalFile/index.tsx
@@ -0,0 +1,46 @@
+import { RenameLocalFileParams } from '@lobechat/electron-client-ipc';
+import { Icon } from '@lobehub/ui';
+import { createStyles } from 'antd-style';
+import { ArrowRightIcon } from 'lucide-react';
+import React, { memo } from 'react';
+import { Flexbox } from 'react-layout-kit';
+
+import FileIcon from '@/components/FileIcon';
+import { LocalReadFileState } from '@/tools/local-files/type';
+import { ChatMessagePluginError } from '@/types/message';
+
+const useStyles = createStyles(({ css, token }) => ({
+ container: css`
+ color: ${token.colorTextQuaternary};
+ `,
+ new: css`
+ color: ${token.colorTextSecondary};
+ `,
+}));
+
+interface RenameLocalFileProps {
+ args: RenameLocalFileParams;
+ messageId: string;
+ pluginError: ChatMessagePluginError;
+ pluginState: LocalReadFileState;
+}
+
+const RenameLocalFile = memo(({ args }) => {
+ const { styles } = useStyles();
+
+ const oldFileName = args.path.split('/').at(-1);
+ return (
+
+ {oldFileName}
+
+
+
+
+
+ {args.newName}
+
+
+ );
+});
+
+export default RenameLocalFile;
diff --git a/src/tools/local-files/Render/index.tsx b/src/tools/local-files/Render/index.tsx
index 499bae639e..4d0431d13f 100644
--- a/src/tools/local-files/Render/index.tsx
+++ b/src/tools/local-files/Render/index.tsx
@@ -6,12 +6,14 @@ import { BuiltinRenderProps } from '@/types/tool';
import ListFiles from './ListFiles';
import ReadLocalFile from './ReadLocalFile';
+import RenameLocalFile from './RenameLocalFile';
import SearchFiles from './SearchFiles';
const RenderMap = {
[LocalFilesApiName.searchLocalFiles]: SearchFiles,
[LocalFilesApiName.listLocalFiles]: ListFiles,
[LocalFilesApiName.readLocalFile]: ReadLocalFile,
+ [LocalFilesApiName.renameLocalFile]: RenameLocalFile,
};
const LocalFilesRender = memo>(