mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-11 13:11:23 +00:00
Merge branch 'main' into reautho_fix
This commit is contained in:
commit
c09a9e2c1e
4 changed files with 49 additions and 15 deletions
|
|
@ -312,6 +312,24 @@ function registerIpcHandlers() {
|
|||
});
|
||||
ipcMain.handle('get-app-version', () => app.getVersion());
|
||||
ipcMain.handle('get-backend-port', () => backendPort);
|
||||
ipcMain.handle('restart-backend', async () => {
|
||||
try {
|
||||
if (backendPort) {
|
||||
log.info('Restarting backend service...');
|
||||
await cleanupPythonProcess();
|
||||
await checkAndStartBackend();
|
||||
log.info('Backend restart completed successfully');
|
||||
return { success: true };
|
||||
} else {
|
||||
log.warn('No backend port found, starting fresh backend');
|
||||
await checkAndStartBackend();
|
||||
return { success: true };
|
||||
}
|
||||
} catch (error) {
|
||||
log.error('Failed to restart backend:', error);
|
||||
return { success: false, error: String(error) };
|
||||
}
|
||||
});
|
||||
ipcMain.handle('get-system-language', getSystemLanguage);
|
||||
ipcMain.handle('is-fullscreen', () => win?.isFullScreen() || false);
|
||||
ipcMain.handle('get-home-dir', () => {
|
||||
|
|
|
|||
|
|
@ -112,18 +112,23 @@ export class WebViewManager {
|
|||
}
|
||||
console.log(`Webview ${id} navigated to: ${navigationUrl}`)
|
||||
if (webViewInfo.isActive && webViewInfo.isShow && navigationUrl !== 'about:blank?use=0' && navigationUrl !== 'about:blank') {
|
||||
console.log("did-navigate", id, url)
|
||||
this.win?.webContents.send("url-updated", url);
|
||||
console.log("did-navigate", id, navigationUrl)
|
||||
this.win?.webContents.send("url-updated", navigationUrl);
|
||||
return
|
||||
}
|
||||
webViewInfo.view.setBounds({ x: -1919, y: -1079, width: 1920, height: 1080 })
|
||||
const activeSize = this.getActiveWebview().length
|
||||
const allSize = Array.from(this.webViews.values()).length
|
||||
if (allSize - activeSize <= 3) {
|
||||
const newId = Array.from(this.webViews.keys()).length + 2
|
||||
this.createWebview(newId.toString(), 'about:blank?use=0')
|
||||
this.createWebview((newId + 1).toString(), 'about:blank?use=0')
|
||||
this.createWebview((newId + 2).toString(), 'about:blank?use=0')
|
||||
const existingKeys = Array.from(this.webViews.keys()).map(Number).filter(n => !isNaN(n))
|
||||
const maxId = existingKeys.length > 0 ? Math.max(...existingKeys) : 0
|
||||
const startId = maxId + 1
|
||||
|
||||
// Create webviews sequentially to avoid race conditions
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const nextId = (startId + i).toString()
|
||||
this.createWebview(nextId, 'about:blank?use=0')
|
||||
}
|
||||
}
|
||||
|
||||
// setTimeout(() => {
|
||||
|
|
@ -242,8 +247,12 @@ export class WebViewManager {
|
|||
}
|
||||
}
|
||||
|
||||
public distroy() {
|
||||
// TODO: Destroy all webviews
|
||||
public destroy() {
|
||||
// Destroy all webviews
|
||||
Array.from(this.webViews.keys()).forEach(id => {
|
||||
this.destroyWebview(id)
|
||||
})
|
||||
this.webViews.clear()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -682,9 +682,6 @@ export default function SettingModels() {
|
|||
<SelectItem value="gpt-5">GPT-5</SelectItem>
|
||||
<SelectItem value="gpt-5-mini">GPT-5 mini</SelectItem>
|
||||
<SelectItem value="gpt-5-nano">GPT-5 nano</SelectItem>
|
||||
<SelectItem value="claude-opus-4-1-20250805">
|
||||
Claude Opus 4.1
|
||||
</SelectItem>
|
||||
<SelectItem value="claude-sonnet-4-20250514">
|
||||
Claude Sonnet 4
|
||||
</SelectItem>
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ const chatStore = create<ChatStore>()(
|
|||
setTaskAssigning(taskId, taskAssigning)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Activate agent
|
||||
if (agentMessages.step === "activate_agent" || agentMessages.step === "deactivate_agent") {
|
||||
let taskAssigning = [...tasks[taskId].taskAssigning]
|
||||
|
|
@ -607,7 +607,7 @@ const chatStore = create<ChatStore>()(
|
|||
if (taskAssigning && taskAssigning[assigneeAgentIndex]) {
|
||||
// Check if task already exists in the agent's task list
|
||||
const existingTaskIndex = taskAssigning[assigneeAgentIndex].tasks.findIndex(item => item.id === task_id);
|
||||
|
||||
|
||||
if (existingTaskIndex !== -1) {
|
||||
// Task already exists, update its status
|
||||
taskAssigning[assigneeAgentIndex].tasks[existingTaskIndex].status = "running";
|
||||
|
|
@ -624,7 +624,7 @@ const chatStore = create<ChatStore>()(
|
|||
taskAssigning[assigneeAgentIndex].tasks.push(taskTemp ?? { id: task_id, content, status: "running", });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Only update or add to taskRunning, never duplicate
|
||||
if (taskRunningIndex === -1) {
|
||||
// Task not in taskRunning, add it
|
||||
|
|
@ -1638,7 +1638,17 @@ const chatStore = create<ChatStore>()(
|
|||
clearTasks: () => {
|
||||
const { create } = get()
|
||||
console.log('clearTasks')
|
||||
fetchDelete('/task/stop-all')
|
||||
|
||||
window.ipcRenderer.invoke('restart-backend')
|
||||
.then((res) => {
|
||||
console.log('restart-backend', res)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error in clearTasks cleanup:', error)
|
||||
})
|
||||
|
||||
|
||||
// Immediately create new task to maintain UI responsiveness
|
||||
const newTaskId = create()
|
||||
set((state) => ({
|
||||
...state,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue