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

Commit b37aa96

Browse files
committed
wip: more dynamic availableForcedTools
1 parent f43137e commit b37aa96

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

assets/javascripts/discourse/components/ai-persona-editor.gjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export default class PersonaEditor extends Component {
3030

3131
@tracked allGroups = [];
3232
@tracked isSaving = false;
33-
@tracked availableForcedTools = [];
3433

3534
dirtyFormData = null;
3635

@@ -208,10 +207,6 @@ export default class PersonaEditor extends Component {
208207
toolOptions: updatedOptions,
209208
});
210209

211-
this.availableForcedTools = this.allTools.filter((tool) =>
212-
updatedTools.includes(tool.id)
213-
);
214-
215210
if (currentData.forcedTools?.length > 0) {
216211
const updatedForcedTools = currentData.forcedTools.filter(
217212
(fct) => !removedTools.includes(fct)
@@ -220,6 +215,11 @@ export default class PersonaEditor extends Component {
220215
}
221216
}
222217

218+
@action
219+
availableForcedTools(tools) {
220+
return this.allTools.filter((tool) => tools.includes(tool.id));
221+
}
222+
223223
mapToolOptions(currentOptions, toolNames) {
224224
const updatedOptions = Object.assign({}, currentOptions);
225225

@@ -439,7 +439,7 @@ export default class PersonaEditor extends Component {
439439
@value={{field.value}}
440440
@disabled={{data.system}}
441441
@onChange={{field.set}}
442-
@content={{this.availableForcedTools}}
442+
@content={{this.availableForcedTools data.tools}}
443443
/>
444444
</field.Custom>
445445
</form.Field>

0 commit comments

Comments
 (0)