Skip to content

Commit fbc888e

Browse files
authored
Merge pull request #30 from AnswerDotAI/version
fix: use default config values when missing from user config
2 parents 4f3ec81 + 0f7b9b5 commit fbc888e

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

nbs/00_core.ipynb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,11 @@
618618
"outputs": [],
619619
"source": [
620620
"#| export\n",
621+
"default_cfg = asdict(ShellSageConfig())\n",
621622
"def get_opts(**opts):\n",
622623
" cfg = get_cfg()\n",
623624
" for k, v in opts.items():\n",
624-
" if v is None: opts[k] = cfg[k]\n",
625+
" if v is None: opts[k] = cfg.get(k, default_cfg.get(k))\n",
625626
" return AttrDict(opts)"
626627
]
627628
},
@@ -635,11 +636,11 @@
635636
"data": {
636637
"text/markdown": [
637638
"```json\n",
638-
"{'model': 'deepseek-chat', 'provider': 'openai'}\n",
639+
"{'model': 'claude-3-5-sonnet-20241022', 'provider': 'anthropic'}\n",
639640
"```"
640641
],
641642
"text/plain": [
642-
"{'provider': 'openai', 'model': 'deepseek-chat'}"
643+
"{'provider': 'anthropic', 'model': 'claude-3-5-sonnet-20241022'}"
643644
]
644645
},
645646
"execution_count": null,
@@ -1072,6 +1073,14 @@
10721073
"main('Teach me about rsync', history_lines=0, s=True)"
10731074
]
10741075
},
1076+
{
1077+
"cell_type": "markdown",
1078+
"id": "1b4e66a1",
1079+
"metadata": {},
1080+
"source": [
1081+
"Here is an example of using a local LLM provider via Ollama:"
1082+
]
1083+
},
10751084
{
10761085
"cell_type": "code",
10771086
"execution_count": null,

shell_sage/core.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
22

33
# %% auto 0
4-
__all__ = ['print', 'sp', 'csp', 'ssp', 'clis', 'sps', 'conts', 'p', 'get_pane', 'get_panes', 'tmux_history_lim', 'get_history',
5-
'get_opts', 'get_sage', 'get_res', 'main']
4+
__all__ = ['print', 'sp', 'csp', 'ssp', 'default_cfg', 'clis', 'sps', 'conts', 'p', 'get_pane', 'get_panes', 'tmux_history_lim',
5+
'get_history', 'get_opts', 'get_sage', 'get_res', 'main']
66

77
# %% ../nbs/00_core.ipynb 3
88
from datetime import datetime
@@ -164,10 +164,11 @@ def get_history(n, pid='current'):
164164
except subprocess.CalledProcessError: return None
165165

166166
# %% ../nbs/00_core.ipynb 24
167+
default_cfg = asdict(ShellSageConfig())
167168
def get_opts(**opts):
168169
cfg = get_cfg()
169170
for k, v in opts.items():
170-
if v is None: opts[k] = cfg[k]
171+
if v is None: opts[k] = cfg.get(k, default_cfg.get(k))
171172
return AttrDict(opts)
172173

173174
# %% ../nbs/00_core.ipynb 26

0 commit comments

Comments
 (0)