Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 0d2ffba

Browse files
committed
FIX: llm selector memory broken
llm selector for bot was no longer remembering selected item.
1 parent 09a6841 commit 0d2ffba

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

assets/javascripts/discourse/components/ai-persona-llm-selector.gjs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,24 @@ export default class AiPersonaLlmSelector extends Component {
148148
this.setAllowLLMSelector();
149149

150150
if (this.hasLlmSelector) {
151-
let llm = this.keyValueStore.getItem(LLM_SELECTOR_KEY);
151+
let llmId = this.keyValueStore.getItem(LLM_SELECTOR_KEY);
152+
if (llmId) {
153+
llmId = parseInt(llmId, 10);
154+
}
152155

153156
const llmOption =
154-
this.llmOptions.find((innerLlmOption) => innerLlmOption.id === llm) ||
157+
this.llmOptions.find((innerLlmOption) => innerLlmOption.id === llmId) ||
155158
this.llmOptions[0];
156159

157160
if (llmOption) {
158-
llm = llmOption.id;
161+
llmId = llmOption.id;
159162
} else {
160-
llm = "";
163+
llmId = "";
161164
}
162165

163-
if (llm) {
166+
if (llmId) {
164167
next(() => {
165-
this.currentLlm = llm;
168+
this.currentLlm = llmId;
166169
});
167170
}
168171
}

spec/system/ai_bot/homepage_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@
257257
ai_pm_homepage.llm_selector.expand
258258
ai_pm_homepage.llm_selector.select_row_by_name(claude_2_dup.display_name)
259259
ai_pm_homepage.llm_selector.collapse
260+
261+
# confirm memory works for llm selection
262+
ai_pm_homepage.visit
263+
expect(ai_pm_homepage.llm_selector).to have_selected_name(claude_2_dup.display_name)
260264
end
261265

262266
it "renders back to forum link" do

0 commit comments

Comments
 (0)