Skip to content

Commit 5b6aa3b

Browse files
author
lrhh123
committed
fix: 修复超时导致的报错
1 parent e8c3941 commit 5b6aa3b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/main/backend/services/appService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class AppService {
5757
tasks.push(instance);
5858
const result = await this.dispatchService.updateTasks(tasks);
5959
if (!result || result.length === 0) {
60-
throw new Error('Failed to update tasks');
60+
throw new Error('添加任务失败,请重新尝试');
6161
}
6262

6363
// 遍历 result 检查,判断是否存在 error 属性

src/main/backend/services/dispatchService.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,18 @@ export class DispatchService {
165165
| null
166166
> {
167167
try {
168-
return await emitAndWait(this.io, 'strategyService-updateTasks', {
169-
tasks: tasks.map((task) => ({
170-
task_id: task.id,
171-
app_id: task.app_id,
172-
env_id: task.env_id,
173-
})),
174-
});
168+
return await emitAndWait(
169+
this.io,
170+
'strategyService-updateTasks',
171+
{
172+
tasks: tasks.map((task) => ({
173+
task_id: task.id,
174+
app_id: task.app_id,
175+
env_id: task.env_id,
176+
})),
177+
},
178+
20000,
179+
);
175180
} catch (error) {
176181
console.error('Failed to add task', error);
177182
return null;

src/main/gptproxy/dify/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class DifyAI extends APIClient {
2828
const {
2929
apiKey = process.env.DIFY_API_KEY || '',
3030
baseURL = 'https://api.dify.ai/v1/',
31-
timeout = 30000,
31+
timeout = 50000,
3232
httpAgent = undefined,
3333
...rest
3434
} = options;

0 commit comments

Comments
 (0)