Skip to content

Commit f54e9bd

Browse files
committed
Version 1.0.3 is expected to be released.
1 parent 2dacfb9 commit f54e9bd

6 files changed

Lines changed: 89 additions & 25 deletions

File tree

.qdrant-initialized

Whitespace-only changes.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# V1.0.3
2+
3+
## zh
4+
5+
- 提供了在线访问Agent的功能
6+
7+
## en
8+
9+
- Provides online access to the Agent.
10+
11+
112
# V1.0.2
213

314
## zh

lib/features/chat/chat_page.dart

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,13 +1332,27 @@ class _WorkDirChip extends ConsumerWidget {
13321332
}
13331333

13341334
Future<void> _pickDir(BuildContext context, WidgetRef ref) async {
1335-
final dir = await FilePicker.platform.getDirectoryPath(
1336-
dialogTitle: context.s.chatSelectWorkingDir,
1337-
);
1338-
if (dir != null && context.mounted) {
1339-
ref.read(workingDirectoryProvider.notifier).state = dir;
1340-
// 同步到设置持久化
1341-
await ref.read(settingsProvider.notifier).updateWorkingDirectory(dir);
1335+
final title = context.s.chatSelectWorkingDir;
1336+
1337+
// 如果当前工作目录已被删除,先清空,避免系统文件对话框卡死
1338+
final current = ref.read(workingDirectoryProvider);
1339+
if (current.isNotEmpty && !Directory(current).existsSync()) {
1340+
ref.read(workingDirectoryProvider.notifier).state = '';
1341+
await ref.read(settingsProvider.notifier).updateWorkingDirectory('');
1342+
}
1343+
1344+
try {
1345+
final dir = await FilePicker.platform
1346+
.getDirectoryPath(dialogTitle: title)
1347+
.timeout(const Duration(seconds: 60));
1348+
if (dir != null && context.mounted) {
1349+
ref.read(workingDirectoryProvider.notifier).state = dir;
1350+
await ref.read(settingsProvider.notifier).updateWorkingDirectory(dir);
1351+
}
1352+
} on TimeoutException {
1353+
// 文件对话框超时(系统级卡死),静默忽略
1354+
} catch (_) {
1355+
// 其他平台异常,静默忽略
13421356
}
13431357
}
13441358

lib/features/chat/widgets/new_workspace_dialog.dart

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:async';
12
import 'dart:convert';
23
import 'dart:io';
34

@@ -450,12 +451,20 @@ class _NewWorkspaceDialogState extends ConsumerState<NewWorkspaceDialog> {
450451
// ─── 操作逻辑 ─────────────────────────────────────────────
451452

452453
Future<void> _pickParentDir() async {
453-
final dir = await FilePicker.platform.getDirectoryPath(
454-
dialogTitle: context.s.wsDialogSelectParentTitle,
455-
);
456-
if (dir != null) {
457-
setState(() => _parentDir = dir);
454+
// 如果已选目录被删除,清空以避免系统对话框卡死
455+
if (_parentDir.isNotEmpty && !Directory(_parentDir).existsSync()) {
456+
setState(() => _parentDir = '');
458457
}
458+
try {
459+
final dir = await FilePicker.platform
460+
.getDirectoryPath(dialogTitle: context.s.wsDialogSelectParentTitle)
461+
.timeout(const Duration(seconds: 60));
462+
if (dir != null) {
463+
setState(() => _parentDir = dir);
464+
}
465+
} on TimeoutException {
466+
// 系统文件对话框超时
467+
} catch (_) {}
459468
}
460469

461470
Future<void> _runTest(EmbeddingConfig? cfg) async {

lib/features/multi_agent/widgets/agent_workspace.dart

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'dart:async';
12
import 'dart:io';
23

34
import 'package:flutter/material.dart';
@@ -260,10 +261,16 @@ class _WorkspaceSetup extends StatelessWidget {
260261
const SizedBox(height: 28),
261262
FilledButton.icon(
262263
onPressed: () async {
263-
final dir = await FilePicker.platform.getDirectoryPath(
264-
dialogTitle: context.s.multiAgentSelectDirTitle,
265-
);
266-
if (dir != null) onSelected(dir);
264+
try {
265+
final dir = await FilePicker.platform
266+
.getDirectoryPath(
267+
dialogTitle: context.s.multiAgentSelectDirTitle,
268+
)
269+
.timeout(const Duration(seconds: 60));
270+
if (dir != null) onSelected(dir);
271+
} on TimeoutException {
272+
// 系统文件对话框超时
273+
} catch (_) {}
267274
},
268275
icon: const Icon(Icons.folder, size: 20),
269276
label: Text(context.s.multiAgentOpenDir),

lib/features/settings/settings_page.dart

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:async';
2+
13
import 'package:flutter/material.dart';
24
import 'package:flutter_riverpod/flutter_riverpod.dart';
35
import 'package:file_picker/file_picker.dart';
@@ -119,9 +121,16 @@ class SettingsPage extends ConsumerWidget {
119121
}
120122

121123
Future<void> _pickHistoryPath(BuildContext context, WidgetRef ref) async {
122-
final result = await FilePicker.platform.getDirectoryPath(
123-
dialogTitle: '选择历史记录保存目录',
124-
);
124+
final String? result;
125+
try {
126+
result = await FilePicker.platform
127+
.getDirectoryPath(dialogTitle: '选择历史记录保存目录')
128+
.timeout(const Duration(seconds: 60));
129+
} on TimeoutException {
130+
return;
131+
} catch (_) {
132+
return;
133+
}
125134
if (result == null) return;
126135
if (!context.mounted) return;
127136

@@ -134,9 +143,16 @@ class SettingsPage extends ConsumerWidget {
134143
}
135144

136145
Future<void> _pickSkillsPath(BuildContext context, WidgetRef ref) async {
137-
final result = await FilePicker.platform.getDirectoryPath(
138-
dialogTitle: '选择技能存放目录',
139-
);
146+
final String? result;
147+
try {
148+
result = await FilePicker.platform
149+
.getDirectoryPath(dialogTitle: '选择技能存放目录')
150+
.timeout(const Duration(seconds: 60));
151+
} on TimeoutException {
152+
return;
153+
} catch (_) {
154+
return;
155+
}
140156
if (result == null) return;
141157
if (!context.mounted) return;
142158

@@ -151,9 +167,16 @@ class SettingsPage extends ConsumerWidget {
151167
}
152168

153169
Future<void> _pickLogsPath(BuildContext context, WidgetRef ref) async {
154-
final result = await FilePicker.platform.getDirectoryPath(
155-
dialogTitle: '选择日志存放目录',
156-
);
170+
final String? result;
171+
try {
172+
result = await FilePicker.platform
173+
.getDirectoryPath(dialogTitle: '选择日志存放目录')
174+
.timeout(const Duration(seconds: 60));
175+
} on TimeoutException {
176+
return;
177+
} catch (_) {
178+
return;
179+
}
157180
if (result == null) return;
158181
if (!context.mounted) return;
159182

0 commit comments

Comments
 (0)