feat(upload): Update document metadata handling to exclude empty fields during upload
This commit is contained in:
@@ -156,7 +156,8 @@ class XAIUploadUtils:
|
||||
|
||||
# Build metadata fields – werden einmalig beim Upload gesetzt;
|
||||
# Custom fields können nachträglich NICHT aktualisiert werden.
|
||||
fields = {
|
||||
# xAI erlaubt KEINE leeren Strings als Feldwerte → nur befüllte Felder senden.
|
||||
fields_raw = {
|
||||
'document_name': doc.get('name', filename),
|
||||
'description': str(doc.get('beschreibung', '') or ''),
|
||||
'advoware_art': str(doc.get('advowareArt', '') or ''),
|
||||
@@ -165,6 +166,7 @@ class XAIUploadUtils:
|
||||
'created_at': str(doc.get('createdAt', '') or ''),
|
||||
'modified_at': str(doc.get('modifiedAt', '') or ''),
|
||||
}
|
||||
fields = {k: v for k, v in fields_raw.items() if v}
|
||||
|
||||
# Single-request upload directly to collection incl. metadata fields
|
||||
self._log.info(f" 📤 Uploading '{filename}' ({mime_type}) with metadata...")
|
||||
|
||||
Reference in New Issue
Block a user