Skip to content

Commit bb1ffee

Browse files
authored
Merge pull request #95 from nextcloud/feat/watermarking
feat(tools): Add "AI-generated" notes where appropriate
2 parents 86d9917 + eb6196e commit bb1ffee

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

ex_app/lib/all_tools/calendar.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ def schedule_event(calendar_name: str, title: str, description: str, start_date:
7070
start_datetime = tz.localize(start_datetime)
7171
end_datetime = tz.localize(end_datetime)
7272

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

7475
# Create event
7576
c = Calendar()
7677
e = Event()
7778
e.name = title
7879
e.begin = start_datetime
7980
e.end = end_datetime
80-
e.description = description
81+
e.description = description_with_ai_note
8182
e.location = location
8283
if attendees is not None:
8384
for attendee in attendees:
@@ -200,11 +201,13 @@ def add_task(calendar_name: str, title: str, description: str, due_date: Optiona
200201
:return: bool
201202
"""
202203

204+
description_with_ai_note = f"{description}\n\n---\n\nThis task was scheduled by Nextcloud AI Assistant."
205+
203206
# Create task
204207
c = Calendar()
205208
t = Todo()
206209
t.name = title
207-
t.description = description
210+
t.description = description_with_ai_note
208211

209212
# Parse date and times
210213
if due_date:

ex_app/lib/all_tools/deck.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def add_card(deck_id: int, stack_id: int, title: str):
5050
"Content-Type": "application/json",
5151
}, json={
5252
'title': title,
53+
'description': 'Created by Nextcloud AI Assistant.',
5354
'type': 'plain',
5455
'order': 999,
5556
})

ex_app/lib/all_tools/mail.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ def send_email(subject: str, body: str, account_id: int, from_email: str, to_ema
2323
:param to_emails: The emails to send
2424
"""
2525
i = 0
26+
body_with_ai_note = f"{body}\n\n---\n\nThis email was sent by Nextcloud AI Assistant."
2627
while i < 20:
2728
try:
2829
return nc.ocs('POST', '/ocs/v2.php/apps/mail/message/send', json={
2930
'accountId': account_id,
3031
'fromEmail': from_email,
3132
'subject': subject,
32-
'body': body,
33+
'body': body_with_ai_note,
3334
'isHtml': False,
3435
'to': [{'label': '', 'email': email} for email in to_emails],
3536
})

ex_app/lib/all_tools/openproject.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def create_work_package(project_id: int, title: str, description: Optional[str],
4040
:param description: The description of the work package
4141
:param assignee_id: The ID of the user the work package should be assigned to, obtainable via list_assignees
4242
:return:
43-
"""
43+
"""
44+
45+
descrption_with_ai_note = f"{description}\n\nThis work package was created by Nextcloud AI Assistant."
4446

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

7072
if description:
7173
json["body"]["description"] = {
72-
"format": "markdown",
73-
"html": "",
74-
"raw": description,
75-
}
74+
"format": "markdown",
75+
"html": "",
76+
"raw": descrption_with_ai_note,
77+
}
7678

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

ex_app/lib/all_tools/talk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def send_message_to_conversation(conversation_name: str, message: str):
4343
"""
4444
conversations = nc.talk.get_user_conversations()
4545
conversation = {conv.display_name: conv for conv in conversations}[conversation_name]
46-
nc.talk.send_message(message, conversation)
46+
message_with_ai_note = f"{message}\n\nThis message was sent by Nextcloud AI Assistant."
47+
nc.talk.send_message(message_with_ai_note, conversation)
4748

4849
return True
4950

0 commit comments

Comments
 (0)