mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-08 09:59:35 +00:00
feat: getInstallationStatus event to catch up after rending registers
This commit is contained in:
parent
2b567189ba
commit
761d11dae2
3 changed files with 39 additions and 0 deletions
|
|
@ -151,6 +151,36 @@ const installedLockPath = path.join(backendPath, 'uv_installed.lock')
|
|||
// const proxyArgs = ['--default-index', 'https://pypi.tuna.tsinghua.edu.cn/simple']
|
||||
const proxyArgs = ['--default-index', 'https://mirrors.aliyun.com/pypi/simple/']
|
||||
|
||||
/**
|
||||
* Get current installation status by checking lock files
|
||||
* @returns Object with installation status information
|
||||
*/
|
||||
export async function getInstallationStatus(): Promise<{
|
||||
isInstalling: boolean;
|
||||
hasLockFile: boolean;
|
||||
installedExists: boolean;
|
||||
}> {
|
||||
try {
|
||||
const installingExists = fs.existsSync(installingLockPath);
|
||||
const installedExists = fs.existsSync(installedLockPath);
|
||||
|
||||
// If installing lock exists, installation is in progress
|
||||
// If installed lock exists, installation completed previously
|
||||
return {
|
||||
isInstalling: installingExists,
|
||||
hasLockFile: installingExists || installedExists,
|
||||
installedExists: installedExists
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('[getInstallationStatus] Error checking installation status:', error);
|
||||
return {
|
||||
isInstalling: false,
|
||||
hasLockFile: false,
|
||||
installedExists: false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class InstallLogs {
|
||||
private node_process;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
// install dependencies related API
|
||||
checkAndInstallDepsOnUpdate: () => ipcRenderer.invoke('install-dependencies'),
|
||||
checkInstallBrowser: () => ipcRenderer.invoke('check-install-browser'),
|
||||
getInstallationStatus: () => ipcRenderer.invoke('get-installation-status'),
|
||||
onInstallDependenciesStart: (callback: () => void) => {
|
||||
ipcRenderer.on('install-dependencies-start', callback);
|
||||
},
|
||||
|
|
|
|||
8
src/types/electron.d.ts
vendored
8
src/types/electron.d.ts
vendored
|
|
@ -47,6 +47,14 @@ interface ElectronAPI {
|
|||
executeCommand: (command: string,email:string) => Promise<{ success: boolean; stdout?: string; stderr?: string; error?: string }>;
|
||||
checkAndInstallDepsOnUpdate: () => Promise<{ success: boolean; error?: string }>;
|
||||
checkInstallBrowser: () => Promise<{ data:any[] }>;
|
||||
getInstallationStatus: () => Promise<{
|
||||
success: boolean;
|
||||
isInstalling?: boolean;
|
||||
hasLockFile?: boolean;
|
||||
installedExists?: boolean;
|
||||
timestamp?: number;
|
||||
error?: string
|
||||
}>;
|
||||
onInstallDependenciesStart: (callback: () => void) => void;
|
||||
onInstallDependenciesLog: (callback: (data: { type: string; data: string }) => void) => void;
|
||||
onInstallDependenciesComplete: (callback: (data: { success: boolean; code?: number; error?: string }) => void) => void;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue