2024-05-09 21:32:34 -04:00
|
|
|
import Component from "@glimmer/component";
|
2023-12-07 16:42:56 -05:00
|
|
|
import { Input } from "@ember/component";
|
2024-05-09 21:32:34 -04:00
|
|
|
import { on } from "@ember/modifier";
|
|
|
|
import { action } from "@ember/object";
|
2023-12-07 16:42:56 -05:00
|
|
|
|
2024-06-11 04:14:14 -04:00
|
|
|
export default class AiPersonaToolOptionEditor extends Component {
|
2024-05-09 21:32:34 -04:00
|
|
|
get isBoolean() {
|
|
|
|
return this.args.option.type === "boolean";
|
|
|
|
}
|
|
|
|
|
|
|
|
get selectedValue() {
|
|
|
|
return this.args.option.value.value === "true";
|
|
|
|
}
|
2024-01-12 18:28:06 -05:00
|
|
|
|
2024-05-09 21:32:34 -04:00
|
|
|
@action
|
|
|
|
onCheckboxChange(event) {
|
|
|
|
this.args.option.value.value = event.target.checked ? "true" : "false";
|
|
|
|
}
|
|
|
|
|
|
|
|
<template>
|
2024-06-11 04:14:14 -04:00
|
|
|
<div class="control-group ai-persona-tool-option-editor">
|
2024-05-09 21:32:34 -04:00
|
|
|
<label>
|
|
|
|
{{@option.name}}
|
|
|
|
</label>
|
|
|
|
<div class="">
|
|
|
|
{{#if this.isBoolean}}
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
|
|
|
checked={{this.selectedValue}}
|
|
|
|
{{on "click" this.onCheckboxChange}}
|
|
|
|
/>
|
|
|
|
{{@option.description}}
|
|
|
|
{{else}}
|
|
|
|
<Input @value={{@option.value.value}} />
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{#unless this.isBoolean}}
|
2024-06-11 04:14:14 -04:00
|
|
|
<div class="ai-persona-tool-option-editor__instructions">
|
2024-05-09 21:32:34 -04:00
|
|
|
{{@option.description}}
|
|
|
|
</div>
|
|
|
|
{{/unless}}
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
}
|