poe-platform / fastapi_poe

A helper library for writing Poe API bots using FastAPI
Apache License 2.0
112 stars 21 forks source link

add helper to concatenate attachment content to message #78

Closed JohntheLi closed 3 months ago

JohntheLi commented 3 months ago

Add 3 bot-level settings:

  1. expand_text_attachments: whether to send parsed content from text attachments with the attachment object in ProtocolMessage. Defaults to True
  2. enable_image_comprehension: whether to send parsed image description from image attachments with the attachment object in ProtocolMessage. Defaults to False. Will limit the # of image attachments per message to one.
  3. enforce_author_role_alternation: whether Poe should modify the messages to follow strict user/bot alternation before sending to the bot. Defaults to False.

Added concat_attachment_content_to_message_body helper function that is called before get_response, which takes parsed content from attachments and concatenates it to the message content. It is enabled by default, but can be disabled by passing in concat_attachments_to_message=False when creating the PoeBot class.