diff --git a/packages/jupyter-ai/src/components/chat-settings.tsx b/packages/jupyter-ai/src/components/chat-settings.tsx index e793906a0..c32eb46fd 100644 --- a/packages/jupyter-ai/src/components/chat-settings.tsx +++ b/packages/jupyter-ai/src/components/chat-settings.tsx @@ -88,6 +88,9 @@ export function ChatSettings(props: ChatSettingsProps): JSX.Element { const [apiKeys, setApiKeys] = useState>({}); const [sendWse, setSendWse] = useState(false); const [fields, setFields] = useState>({}); + const [embeddingModelFields, setEmbeddingModelFields] = useState< + Record + >({}); const [isCompleterEnabled, setIsCompleterEnabled] = useState( props.completionProvider && props.completionProvider.isEnabled() @@ -188,7 +191,15 @@ export function ChatSettings(props: ChatSettingsProps): JSX.Element { const currFields: Record = server.config.fields?.[lmGlobalId] ?? {}; setFields(currFields); - }, [server, lmProvider]); + + if (!emGlobalId) { + return; + } + + const initEmbeddingModelFields: Record = + server.config.fields?.[emGlobalId] ?? {}; + setEmbeddingModelFields(initEmbeddingModelFields); + }, [server, lmGlobalId, emGlobalId]); const handleSave = async () => { // compress fields with JSON values @@ -222,6 +233,9 @@ export function ChatSettings(props: ChatSettingsProps): JSX.Element { }), ...(clmGlobalId && { [clmGlobalId]: fields + }), + ...(emGlobalId && { + [emGlobalId]: embeddingModelFields }) } }), @@ -400,8 +414,8 @@ export function ChatSettings(props: ChatSettingsProps): JSX.Element { {emGlobalId && ( )}