Update app.py
Browse files
app.py
CHANGED
@@ -160,7 +160,7 @@ Please provide:
|
|
160 |
except Exception as e:
|
161 |
raise Exception(f"Error improving task description: {str(e)}")
|
162 |
|
163 |
-
def create_trello_card(task_description, selected_members, location=None):
|
164 |
"""Create a Trello card with the improved task description"""
|
165 |
try:
|
166 |
boards = trello_client.list_boards()
|
@@ -180,16 +180,29 @@ def create_trello_card(task_description, selected_members, location=None):
|
|
180 |
# Extract title and add timestamp
|
181 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
|
182 |
title = task_description.split('\n')[0]
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
|
185 |
location_text = "Remote/Virtual"
|
186 |
location_coords = None
|
187 |
|
188 |
if location:
|
189 |
location_text = location
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
formatted_description = f"""π― TASK DETAILS
|
195 |
------------------------
|
@@ -199,7 +212,7 @@ def create_trello_card(task_description, selected_members, location=None):
|
|
199 |
------------------------
|
200 |
π Created: {timestamp}
|
201 |
π·οΈ Source: TaskWhisper AI
|
202 |
-
|
203 |
π Location: {location_text}
|
204 |
|
205 |
β
CHECKLIST
|
@@ -222,11 +235,21 @@ Add your progress notes here...
|
|
222 |
if location_coords:
|
223 |
card.set_pos(location_coords)
|
224 |
|
225 |
-
# Add
|
226 |
available_labels = board.get_labels()
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
|
231 |
# Assign members to card
|
232 |
if selected_members:
|
|
|
160 |
except Exception as e:
|
161 |
raise Exception(f"Error improving task description: {str(e)}")
|
162 |
|
163 |
+
def create_trello_card(task_description, selected_members, location=None, urgency="normal"):
|
164 |
"""Create a Trello card with the improved task description"""
|
165 |
try:
|
166 |
boards = trello_client.list_boards()
|
|
|
180 |
# Extract title and add timestamp
|
181 |
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
|
182 |
title = task_description.split('\n')[0]
|
183 |
+
|
184 |
+
# Add urgency to title
|
185 |
+
urgency_markers = {
|
186 |
+
"normal": "π",
|
187 |
+
"high": "β οΈ",
|
188 |
+
"urgent": "π΄"
|
189 |
+
}
|
190 |
+
urgency_marker = urgency_markers.get(urgency.lower(), "π")
|
191 |
+
formatted_title = f"[{timestamp}] {urgency_marker} {title}"
|
192 |
|
193 |
location_text = "Remote/Virtual"
|
194 |
location_coords = None
|
195 |
|
196 |
if location:
|
197 |
location_text = location
|
198 |
+
|
199 |
+
# Map urgency to status text
|
200 |
+
urgency_status = {
|
201 |
+
"normal": "Normal Priority",
|
202 |
+
"high": "High Priority",
|
203 |
+
"urgent": "URGENT"
|
204 |
+
}
|
205 |
+
status_text = urgency_status.get(urgency.lower(), "Normal Priority")
|
206 |
|
207 |
formatted_description = f"""π― TASK DETAILS
|
208 |
------------------------
|
|
|
212 |
------------------------
|
213 |
π Created: {timestamp}
|
214 |
π·οΈ Source: TaskWhisper AI
|
215 |
+
β‘ Priority: {status_text}
|
216 |
π Location: {location_text}
|
217 |
|
218 |
β
CHECKLIST
|
|
|
235 |
if location_coords:
|
236 |
card.set_pos(location_coords)
|
237 |
|
238 |
+
# Add label based on urgency
|
239 |
available_labels = board.get_labels()
|
240 |
+
urgency_colors = {
|
241 |
+
"normal": "blue",
|
242 |
+
"high": "yellow",
|
243 |
+
"urgent": "red"
|
244 |
+
}
|
245 |
+
label_color = urgency_colors.get(urgency.lower(), "blue")
|
246 |
+
|
247 |
+
# Find and add the appropriate label
|
248 |
+
priority_label = next((label for label in available_labels if label.color == label_color), None)
|
249 |
+
if priority_label:
|
250 |
+
card.add_label(priority_label)
|
251 |
+
else:
|
252 |
+
print(f"Warning: {label_color} label not found on board")
|
253 |
|
254 |
# Assign members to card
|
255 |
if selected_members:
|