Skip to content
Merged
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
3 changes: 2 additions & 1 deletion ex_app/lib/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def export_conversation(checkpointer):
# prepare the to-serialize blob
state = {"last_config": last_config, "last_checkpoint": last_checkpoint}
serialized_state = JsonPlusSerializer().dumps(state)
print(serialized_state)
# sign the serialized state
conversation_token = add_signature(serialized_state.decode('utf-8'), key)
return conversation_token
Expand Down Expand Up @@ -139,6 +138,8 @@ async def call_model(
system_prompt_text += "Use the find_person_in_users tool to find a person's userId and user details.\n"
if tool_enabled("find_details_of_current_user"):
system_prompt_text += "Use the find_details_of_current_user tool to find the current user's location.\n"
if tool_enabled("list_mails"):
system_prompt_text += "Always check for the mail account id before requesting a folder list.\n"

if task['input'].get('memories', None) is not None:
system_prompt_text += "You can remember things from other conversations with the user. If relevant, take into account the following memories:\n\n" + "\n".join(task['input']['memories']) + "\n\n"
Expand Down
26 changes: 25 additions & 1 deletion ex_app/lib/all_tools/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,35 @@ async def get_mail_account_list():
"""

return await nc.ocs('GET', '/ocs/v2.php/apps/mail/account/list')


@tool
@safe_tool
async def get_mail_folder_list(account_id: int):
"""
Lists all mail folders for an email account
:param account_id: The id of the account to list as integer, obtainable via get_mail_account_list
"""
return await nc.ocs('GET', '/ocs/v2.php/apps/mail/ocs/mailboxes', json={'accountId': account_id})


@tool
@safe_tool
async def list_mails(folder_id: int, n_mails: int = 30):
"""
Lists all messages in a mailbox folder
:param folder_id: The id of the folder to list as integer, obtainable via get_mail_folder_list
:param n_mails: The number of mails to receive. Optional, default is 30
:return: a list of mails/messages, including timestamps
"""
return await nc.ocs('GET', f'/ocs/v2.php/apps/mail/ocs/mailboxes/{folder_id}/messages', json={'limit': n_mails})


return [
send_email,
get_mail_account_list
get_mail_account_list,
get_mail_folder_list,
list_mails,
]

def get_category_name():
Expand Down
Loading