FIX: llm selector memory broken (#1299)
llm selector for bot was no longer remembering selected item.
This commit is contained in:
parent
ede65c971f
commit
8b90ce7c86
|
@ -148,21 +148,24 @@ export default class AiPersonaLlmSelector extends Component {
|
||||||
this.setAllowLLMSelector();
|
this.setAllowLLMSelector();
|
||||||
|
|
||||||
if (this.hasLlmSelector) {
|
if (this.hasLlmSelector) {
|
||||||
let llm = this.keyValueStore.getItem(LLM_SELECTOR_KEY);
|
let llmId = this.keyValueStore.getItem(LLM_SELECTOR_KEY);
|
||||||
|
if (llmId) {
|
||||||
|
llmId = parseInt(llmId, 10);
|
||||||
|
}
|
||||||
|
|
||||||
const llmOption =
|
const llmOption =
|
||||||
this.llmOptions.find((innerLlmOption) => innerLlmOption.id === llm) ||
|
this.llmOptions.find((innerLlmOption) => innerLlmOption.id === llmId) ||
|
||||||
this.llmOptions[0];
|
this.llmOptions[0];
|
||||||
|
|
||||||
if (llmOption) {
|
if (llmOption) {
|
||||||
llm = llmOption.id;
|
llmId = llmOption.id;
|
||||||
} else {
|
} else {
|
||||||
llm = "";
|
llmId = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (llm) {
|
if (llmId) {
|
||||||
next(() => {
|
next(() => {
|
||||||
this.currentLlm = llm;
|
this.currentLlm = llmId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,13 +254,13 @@ RSpec.describe "AI Bot - Homepage", type: :system do
|
||||||
it "Allows choosing persona and LLM" do
|
it "Allows choosing persona and LLM" do
|
||||||
ai_pm_homepage.visit
|
ai_pm_homepage.visit
|
||||||
|
|
||||||
ai_pm_homepage.persona_selector.expand
|
|
||||||
ai_pm_homepage.persona_selector.select_row_by_name(persona.name)
|
|
||||||
ai_pm_homepage.persona_selector.collapse
|
|
||||||
|
|
||||||
ai_pm_homepage.llm_selector.expand
|
ai_pm_homepage.llm_selector.expand
|
||||||
ai_pm_homepage.llm_selector.select_row_by_name(claude_2_dup.display_name)
|
ai_pm_homepage.llm_selector.select_row_by_name(claude_2_dup.display_name)
|
||||||
ai_pm_homepage.llm_selector.collapse
|
ai_pm_homepage.llm_selector.collapse
|
||||||
|
|
||||||
|
# confirm memory works for llm selection
|
||||||
|
ai_pm_homepage.visit
|
||||||
|
expect(ai_pm_homepage.llm_selector).to have_selected_name(claude_2_dup.display_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders back to forum link" do
|
it "renders back to forum link" do
|
||||||
|
|
Loading…
Reference in New Issue