fix: cosmetic changes

This commit is contained in:
cogwheel0
2025-08-17 00:26:12 +05:30
parent 3623422475
commit 7a38c645a1
3 changed files with 132 additions and 21 deletions

View File

@@ -275,7 +275,7 @@ final conversationsProvider = FutureProvider<List<Conversation>>((ref) async {
try {
foundation.debugPrint('DEBUG: Fetching conversations from OpenWebUI API...');
final conversations = await api.getConversations(limit: 50);
final conversations = await api.getConversations(); // Fetch all conversations
foundation.debugPrint(
'DEBUG: Successfully fetched ${conversations.length} conversations',
);
@@ -328,9 +328,17 @@ final conversationsProvider = FutureProvider<List<Conversation>>((ref) async {
}
foundation.debugPrint('DEBUG: Final conversation count: ${updatedConversations.length}');
// Sort conversations by updatedAt in descending order (most recent first)
updatedConversations.sort((a, b) => b.updatedAt.compareTo(a.updatedAt));
foundation.debugPrint('DEBUG: Sorted conversations by updatedAt (most recent first)');
return updatedConversations;
} catch (e) {
foundation.debugPrint('DEBUG: Failed to fetch folder information: $e');
// Sort conversations even when folder fetch fails
conversations.sort((a, b) => b.updatedAt.compareTo(a.updatedAt));
foundation.debugPrint('DEBUG: Sorted conversations by updatedAt (fallback case)');
return conversations; // Return original conversations if folder fetch fails
}
} catch (e, stackTrace) {