Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions chatkit/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ async def _process_non_streaming(
attachment = await attachment_store.create_attachment(
request.params, context
)
await self.store.save_attachment(attachment, context=context)
return self._serialize(attachment)
case AttachmentsDeleteReq():
attachment_store = self._get_attachment_store()
Expand Down
17 changes: 14 additions & 3 deletions chatkit/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,16 +726,27 @@ class ToolChoice(BaseModel):
id: str


class AttachmentUploadDescriptor(BaseModel):
"""Two-phase upload instructions."""

url: AnyUrl
method: Literal["put", "post"]
"""The HTTP method to use when uploading the file for two-phase upload."""
headers: dict[str, str] = Field(default_factory=dict)
"""Optional headers to include in the upload request."""


class AttachmentBase(BaseModel):
"""Base metadata shared by all attachments."""

id: str
name: str
mime_type: str
upload_url: AnyUrl | None = None
upload_descriptor: AttachmentUploadDescriptor | None = None
"""
The URL to upload the file, used for two-phase upload.
Should be set to None after upload is complete or when using direct upload where uploading happens when creating the attachment object.
Two-phase upload instructions.
Should be set to None after upload is complete or when using direct upload
where uploading happens when creating the attachment object.
"""


Expand Down
Loading