Improve chat session catalog creation
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user