feat: update file manager and file factory implementations (#22704)
Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -148,9 +148,7 @@ def _build_from_local_file(
|
||||
if strict_type_validation and detected_file_type.value != specified_type:
|
||||
raise ValueError("Detected file type does not match the specified type. Please verify the file.")
|
||||
|
||||
file_type = (
|
||||
FileType(specified_type) if specified_type and specified_type != FileType.CUSTOM.value else detected_file_type
|
||||
)
|
||||
file_type = FileType(specified_type) if specified_type and specified_type != FileType.CUSTOM else detected_file_type
|
||||
|
||||
return File(
|
||||
id=mapping.get("id"),
|
||||
@@ -199,9 +197,7 @@ def _build_from_remote_url(
|
||||
raise ValueError("Detected file type does not match the specified type. Please verify the file.")
|
||||
|
||||
file_type = (
|
||||
FileType(specified_type)
|
||||
if specified_type and specified_type != FileType.CUSTOM.value
|
||||
else detected_file_type
|
||||
FileType(specified_type) if specified_type and specified_type != FileType.CUSTOM else detected_file_type
|
||||
)
|
||||
|
||||
return File(
|
||||
@@ -286,9 +282,7 @@ def _build_from_tool_file(
|
||||
if strict_type_validation and specified_type and detected_file_type.value != specified_type:
|
||||
raise ValueError("Detected file type does not match the specified type. Please verify the file.")
|
||||
|
||||
file_type = (
|
||||
FileType(specified_type) if specified_type and specified_type != FileType.CUSTOM.value else detected_file_type
|
||||
)
|
||||
file_type = FileType(specified_type) if specified_type and specified_type != FileType.CUSTOM else detected_file_type
|
||||
|
||||
return File(
|
||||
id=mapping.get("id"),
|
||||
|
Reference in New Issue
Block a user