Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,8 @@ lastfm_api_root = 'http://ws.audioscrobbler.com/2.0/'
|
|
| 12 |
cache = {
|
| 13 |
"current_track": None,
|
| 14 |
"last_fetched": 0,
|
| 15 |
-
"listening": False
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
@@ -132,10 +133,10 @@ def get_recent_tracks(user: str) -> str:
|
|
| 132 |
except Exception as e:
|
| 133 |
return f'An error occurred: {e}'
|
| 134 |
|
| 135 |
-
prompt = (f'
|
| 136 |
if cache['listening']
|
| 137 |
-
else f'
|
| 138 |
-
return prompt
|
| 139 |
|
| 140 |
|
| 141 |
final_answer = FinalAnswerTool()
|
|
|
|
| 12 |
cache = {
|
| 13 |
"current_track": None,
|
| 14 |
"last_fetched": 0,
|
| 15 |
+
"listening": False,
|
| 16 |
+
"user": None
|
| 17 |
}
|
| 18 |
|
| 19 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 133 |
except Exception as e:
|
| 134 |
return f'An error occurred: {e}'
|
| 135 |
|
| 136 |
+
prompt = (f'currently listening: {cache["current_track"]}'
|
| 137 |
if cache['listening']
|
| 138 |
+
else f'recently listened: {cache["current_track"]}')
|
| 139 |
+
return f'{user} {prompt}'
|
| 140 |
|
| 141 |
|
| 142 |
final_answer = FinalAnswerTool()
|