Improve chat session catalog creation

This commit is contained in:
2026-10-21 13:48:35 +01:00
parent f239a26bfd
commit a2b02b3810
5 changed files with 243 additions and 36 deletions
+20 -10
View File
@@ -39,17 +39,27 @@ class ChatRepository {
'chat_query': {'session_id': sessionId},
}))['chat_shells'],
);
Future<List<String>> directories() async =>
((await gateway.call('chat_directories'))['chat_directories'] as List? ??
const [])
.whereType<String>()
.toList();
Future<List<String>> directories() async {
final value = (await gateway.call('chat_directories'))['chat_directories'];
if (value is! List)
throw StateError('Server did not return chat directories.');
return value
.whereType<String>()
.where((entry) => entry.trim().isNotEmpty)
.toList();
}
Future<List<String>> backends() async =>
((await gateway.call('chat_backends'))['chat_backends'] as List? ??
const [])
.whereType<String>()
.toList();
Future<List<String>> backends() async {
final value = (await gateway.call('chat_backends'))['chat_backends'];
if (value is! List)
throw StateError('Server did not return chat backends.');
final result = value
.whereType<String>()
.where((entry) => entry.trim().isNotEmpty)
.toList();
if (result.isEmpty) throw StateError('Server returned no chat backends.');
return result;
}
Future<JsonMap> shellOutput(
String sessionId,