Skip to content

Commit

Permalink
Merge pull request #39 from socode-marcelo/patch-1
Browse files Browse the repository at this point in the history
Adding default value for modelicon dictionary in case of KeyError
  • Loading branch information
ruecat authored Mar 10, 2024
2 parents 6f317ae + 16b224b commit 4af6b36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bot/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ async def modelmanager_callback_handler(query: types.CallbackQuery):
modelfamilies = ""
if model["details"]["families"]:
modelicon = {"llama": "🦙", "clip": "📷"}
modelfamilies = "".join([modelicon[family] for family in model['details']['families']])
try:
modelfamilies = "".join([modelicon[family] for family in model['details']['families']])
except KeyError as e:
# Use a default value when the key is not found
modelfamilies = f"✨"
# Add a button for each model
modelmanager_builder.row(
types.InlineKeyboardButton(
Expand Down

0 comments on commit 4af6b36

Please sign in to comment.