Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/fastapi_poe/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
URL_ATTACHMENT_TEMPLATE,
)
from fastapi_poe.types import (
Attachment,
AttachmentUploadResponse,
ContentType,
CostItem,
Expand Down Expand Up @@ -420,7 +421,7 @@ async def post_message_attachment(
stacklevel=2,
)

attachment = await upload_file(
attachment = await self._upload_file(
file=file_data,
file_url=download_url,
file_name=filename or download_filename,
Expand All @@ -446,6 +447,23 @@ async def post_message_attachment(
inline_ref=inline_ref,
)

async def _upload_file(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be _upload_file? Marking it like that / private does not seem like it's intended to be overridden by a subclass.

Or would having self.upload_file and upload_file be too confusing?

self,
*,
file: Optional[Union[bytes, BinaryIO]],
file_url: Optional[str],
file_name: Optional[str],
api_key: str,
base_url: str,
) -> Attachment:
return await upload_file(
file=file,
file_url=file_url,
file_name=file_name,
api_key=api_key,
base_url=base_url,
)

@deprecated(
"This method is deprecated. Use `insert_attachment_messages` instead."
"This method will be removed in a future release."
Expand Down