FIX: llm selector memory broken (#1299)

llm selector for bot was no longer remembering selected item.
This commit is contained in:
Sam 2025-04-30 14:15:28 +10:00 committed by GitHub
parent ede65c971f
commit 8b90ce7c86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 10 deletions

View File

@ -148,21 +148,24 @@ export default class AiPersonaLlmSelector extends Component {
this.setAllowLLMSelector();
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 =
this.llmOptions.find((innerLlmOption) => innerLlmOption.id === llm) ||
this.llmOptions.find((innerLlmOption) => innerLlmOption.id === llmId) ||
this.llmOptions[0];
if (llmOption) {
llm = llmOption.id;
llmId = llmOption.id;
} else {
llm = "";
llmId = "";
}
if (llm) {
if (llmId) {
next(() => {
this.currentLlm = llm;
this.currentLlm = llmId;
});
}
}

View File

@ -254,13 +254,13 @@ RSpec.describe "AI Bot - Homepage", type: :system do
it "Allows choosing persona and LLM" do
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.select_row_by_name(claude_2_dup.display_name)
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
it "renders back to forum link" do