Skip to content

Commit

Permalink
exclude empty str fields from config manager
Browse files Browse the repository at this point in the history
  • Loading branch information
dlqqq committed Dec 9, 2024
1 parent dc4e3af commit 80b24b7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/jupyter-ai/jupyter_ai/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,13 @@ def _provider_params(self, key, listing, completions: bool = False):
fields = config.completions_fields.get(model_uid, {})
else:
fields = config.fields.get(model_uid, {})

# exclude empty fields
# TODO: modify the config manager to never save empty fields in the
# first place.
for field_key in fields:
if isinstance(fields[field_key], str) and not len(fields[field_key]):
fields[field_key] = None

# get authn fields
_, Provider = get_em_provider(model_uid, listing)
Expand Down

0 comments on commit 80b24b7

Please sign in to comment.