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
7 changes: 5 additions & 2 deletions ex_app/lib/all_tools/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ def schedule_event(calendar_name: str, title: str, description: str, start_date:
start_datetime = tz.localize(start_datetime)
end_datetime = tz.localize(end_datetime)

description_with_ai_note = f"{description}\n\n---\n\nThis event was scheduled by Nextcloud AI Assistant."

# Create event
c = Calendar()
e = Event()
e.name = title
e.begin = start_datetime
e.end = end_datetime
e.description = description
e.description = description_with_ai_note
e.location = location
if attendees is not None:
for attendee in attendees:
Expand Down Expand Up @@ -200,11 +201,13 @@ def add_task(calendar_name: str, title: str, description: str, due_date: Optiona
:return: bool
"""

description_with_ai_note = f"{description}\n\n---\n\nThis task was scheduled by Nextcloud AI Assistant."

# Create task
c = Calendar()
t = Todo()
t.name = title
t.description = description
t.description = description_with_ai_note

# Parse date and times
if due_date:
Expand Down
1 change: 1 addition & 0 deletions ex_app/lib/all_tools/deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def add_card(deck_id: int, stack_id: int, title: str):
"Content-Type": "application/json",
}, json={
'title': title,
'description': 'Created by Nextcloud AI Assistant.',
'type': 'plain',
'order': 999,
})
Expand Down
3 changes: 2 additions & 1 deletion ex_app/lib/all_tools/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ def send_email(subject: str, body: str, account_id: int, from_email: str, to_ema
:param to_emails: The emails to send
"""
i = 0
body_with_ai_note = f"{body}\n\n---\n\nThis email was sent by Nextcloud AI Assistant."
while i < 20:
try:
return nc.ocs('POST', '/ocs/v2.php/apps/mail/message/send', json={
'accountId': account_id,
'fromEmail': from_email,
'subject': subject,
'body': body,
'body': body_with_ai_note,
'isHtml': False,
'to': [{'label': '', 'email': email} for email in to_emails],
})
Expand Down
12 changes: 7 additions & 5 deletions ex_app/lib/all_tools/openproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def create_work_package(project_id: int, title: str, description: Optional[str],
:param description: The description of the work package
:param assignee_id: The ID of the user the work package should be assigned to, obtainable via list_assignees
:return:
"""
"""

descrption_with_ai_note = f"{description}\n\nThis work package was created by Nextcloud AI Assistant."

links = {
"project": {
Expand Down Expand Up @@ -69,10 +71,10 @@ def create_work_package(project_id: int, title: str, description: Optional[str],

if description:
json["body"]["description"] = {
"format": "markdown",
"html": "",
"raw": description,
}
"format": "markdown",
"html": "",
"raw": descrption_with_ai_note,
}

response = nc.ocs('POST', '/ocs/v2.php/apps/integration_openproject/api/v1/create/work-packages', json=json)

Expand Down
3 changes: 2 additions & 1 deletion ex_app/lib/all_tools/talk.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def send_message_to_conversation(conversation_name: str, message: str):
"""
conversations = nc.talk.get_user_conversations()
conversation = {conv.display_name: conv for conv in conversations}[conversation_name]
nc.talk.send_message(message, conversation)
message_with_ai_note = f"{message}\n\nThis message was sent by Nextcloud AI Assistant."
nc.talk.send_message(message_with_ai_note, conversation)

return True

Expand Down
Loading