feat(image): Improve image attachment loading and error handling

This commit is contained in:
cogwheel
2026-01-13 21:26:43 +05:30
parent 9380c036f5
commit 2b44ae3e5e
6 changed files with 185 additions and 51 deletions

View File

@@ -1092,7 +1092,8 @@ Future<Map<String, dynamic>> _buildMessagePayloadWithAttachments({
allFiles.add({
'type': 'file',
'id': attachmentId,
'url': '/api/v1/files/$attachmentId',
// OpenWebUI now stores just the file ID, not the full URL path
'url': attachmentId,
'name': fileName,
if (fileSize != null) 'size': fileSize,
});
@@ -1801,7 +1802,9 @@ Future<void> _sendMessageInternal(
'type': isImage ? 'image' : 'file',
'id': fileId,
'name': fileName,
'url': '/api/v1/files/$fileId', // Full URL for conversation parsing compatibility
// OpenWebUI now stores just the file ID, not the full URL path
// The frontend resolves it when displaying
'url': fileId,
if (fileSize != null) 'size': fileSize,
if (collectionName != null) 'collection_name': collectionName,
if (contentType.isNotEmpty) 'content_type': contentType,
@@ -1811,7 +1814,7 @@ Future<void> _sendMessageInternal(
'type': 'file',
'id': fileId,
'name': 'file',
'url': '/api/v1/files/$fileId',
'url': fileId,
};
}
});