Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix settings update and vertical scroll #249

Merged
merged 3 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/jupyter-ai/jupyter_ai/actors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ def get_llm_chain(self):
else None
)

if not lm_provider:
if not lm_provider or not lm_provider_params:
return None

if curr_lm_id != next_lm_id:
self.log.info(
f"Switching chat language model from {curr_lm_id} to {next_lm_id}."
)
self.create_llm_chain(lm_provider, lm_provider_params)
elif self.llm_params != lm_provider_params:
self.log.info("Chat model params changed, updating the llm chain.")
self.create_llm_chain(lm_provider, lm_provider_params)

return self.llm_chain

def get_embeddings(self):
Expand All @@ -104,10 +108,13 @@ def get_embeddings(self):
embedding_params = ray.get(actor.get_provider_params.remote())
embedding_model_id = ray.get(actor.get_model_id.remote())

if not provider:
if not provider or not embedding_params:
return None

if embedding_model_id != self.embedding_model_id:
if (
embedding_model_id != self.embedding_model_id
or self.embeddings_params != embedding_params
):
self.embeddings = provider(**embedding_params)

return self.embeddings
Expand Down
3 changes: 2 additions & 1 deletion packages/jupyter-ai/src/components/chat-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ export function ChatSettings(): JSX.Element {
sx={{
padding: 4,
boxSizing: 'border-box',
'& > .MuiAlert-root': { marginBottom: 2 }
'& > .MuiAlert-root': { marginBottom: 2 },
overflowY: 'auto'
}}
>
{state === ChatSettingsState.SubmitError && (
Expand Down