Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -128,14 +128,25 @@ def responsenew(data):
|
|
128 |
},
|
129 |
}
|
130 |
elif "note down" in text:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
respo = {
|
132 |
-
'messages': "
|
133 |
'action': "create_note",
|
134 |
'function': {
|
135 |
-
'title':
|
136 |
'id': idval,
|
137 |
'type': 'Note',
|
138 |
-
'description':
|
139 |
'time': datetime.now().strftime("%d/%m/%Y"),
|
140 |
'mainTime': datetime.now().strftime("%I:%M %p"),
|
141 |
'complete': False,
|
|
|
128 |
},
|
129 |
}
|
130 |
elif "note down" in text:
|
131 |
+
# 1. Replace "note down" with an empty string:
|
132 |
+
replaced_string = text.replace("note down", "")
|
133 |
+
|
134 |
+
# 2. Split the string into words:
|
135 |
+
words = replaced_string.split()
|
136 |
+
|
137 |
+
# 3. Extract the first two words:
|
138 |
+
first_two_words = words[:2] # Get the first two elements of the list
|
139 |
+
|
140 |
+
# 4. Join the words back into a string (if needed):
|
141 |
+
result_string = " ".join(first_two_words)
|
142 |
respo = {
|
143 |
+
'messages': "I have noted your message.",
|
144 |
'action': "create_note",
|
145 |
'function': {
|
146 |
+
'title': result_string,
|
147 |
'id': idval,
|
148 |
'type': 'Note',
|
149 |
+
'description': replaced_string,
|
150 |
'time': datetime.now().strftime("%d/%m/%Y"),
|
151 |
'mainTime': datetime.now().strftime("%I:%M %p"),
|
152 |
'complete': False,
|