Merge pull request #507 from zxrys/feature/openai-provider-json-fix

fix: OpenAI Provider json, jsonl file load error
This commit is contained in:
Yufan Dang 2026-01-12 18:39:03 +08:00 committed by GitHub
commit 2e65ba7c66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -544,7 +544,13 @@ class OpenAIProvider(ModelProvider):
mime = (attachment.mime_type or "").lower()
name = (attachment.name or "").lower()
if not mime.startswith("text/"):
is_json = mime in {
"application/json",
"application/jsonl",
"application/x-ndjson",
"application/ndjson",
} or name.endswith((".json", ".jsonl", ".ndjson"))
if not (mime.startswith("text/") or is_json):
return None
if attachment.remote_file_id:
return None # nothing to inline if already remote-only