Skip to content

Commit fa42db4

Browse files
authored
Fix empty directory for Jupyter AI config (#1472)
Signed-off-by: Andrey Velichkevich <[email protected]>
1 parent 6bdf969 commit fa42db4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/jupyter-ai/jupyter_ai/config_manager.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ def _write_config(self, new_config: JaiConfig):
317317
}
318318

319319
self._validate_config(new_config)
320+
321+
# Create config directory if it doesn't exist.
322+
os.makedirs(os.path.dirname(self.config_path), exist_ok=True)
323+
320324
with open(self.config_path, "w") as f:
321325
json.dump(new_config.model_dump(), f, indent=self.indentation_depth)
322326

@@ -361,7 +365,7 @@ def chat_model_args(self) -> dict[str, Any]:
361365
user.
362366
363367
If the current chat model is `None`, this returns an empty dictionary.
364-
Otherwise, it returns the model arguments set in the dictionary at
368+
Otherwise, it returns the model arguments set in the dictionary at
365369
`.fields.<chat-model-id>`.
366370
"""
367371
config = self._read_config()
@@ -401,4 +405,3 @@ def completion_model_params(self):
401405
def delete_api_key(self, key_name: str):
402406
# TODO: store in .env files
403407
pass
404-

0 commit comments

Comments
 (0)