Fix basedpyright type errors (#25435)
Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
2ac7a9c8fc
commit
08dd3f7b50
100 changed files with 847 additions and 497 deletions
|
|
@ -98,7 +98,7 @@ def to_prompt_message_content(
|
|||
|
||||
def download(f: File, /):
|
||||
if f.transfer_method in (FileTransferMethod.TOOL_FILE, FileTransferMethod.LOCAL_FILE):
|
||||
return _download_file_content(f._storage_key)
|
||||
return _download_file_content(f.storage_key)
|
||||
elif f.transfer_method == FileTransferMethod.REMOTE_URL:
|
||||
response = ssrf_proxy.get(f.remote_url, follow_redirects=True)
|
||||
response.raise_for_status()
|
||||
|
|
@ -134,9 +134,9 @@ def _get_encoded_string(f: File, /):
|
|||
response.raise_for_status()
|
||||
data = response.content
|
||||
case FileTransferMethod.LOCAL_FILE:
|
||||
data = _download_file_content(f._storage_key)
|
||||
data = _download_file_content(f.storage_key)
|
||||
case FileTransferMethod.TOOL_FILE:
|
||||
data = _download_file_content(f._storage_key)
|
||||
data = _download_file_content(f.storage_key)
|
||||
|
||||
encoded_string = base64.b64encode(data).decode("utf-8")
|
||||
return encoded_string
|
||||
|
|
|
|||
|
|
@ -146,3 +146,11 @@ class File(BaseModel):
|
|||
if not self.related_id:
|
||||
raise ValueError("Missing file related_id")
|
||||
return self
|
||||
|
||||
@property
|
||||
def storage_key(self) -> str:
|
||||
return self._storage_key
|
||||
|
||||
@storage_key.setter
|
||||
def storage_key(self, value: str):
|
||||
self._storage_key = value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue