@@ -28,12 +28,13 @@ export default class AiToolEditorForm extends Component {
2828 ];
2929
3030 get formData () {
31+ const parameters = this .args .editingModel .parameters || [];
3132 return {
3233 name: this .args .editingModel .name || " " ,
3334 tool_name: this .args .editingModel .tool_name || " " ,
3435 description: this .args .editingModel .description || " " ,
3536 summary: this .args .editingModel .summary || " " ,
36- parameters: this . args . editingModel . parameters || [] ,
37+ parameters,
3738 script: this .args .editingModel .script || " " ,
3839 rag_uploads: this .args .editingModel .rag_uploads || [],
3940 };
@@ -109,6 +110,10 @@ export default class AiToolEditorForm extends Component {
109110 return data .parameters [index].type ;
110111 }
111112
113+ parameterIsEnum (data , index ) {
114+ return data .parameters [index].isEnum ;
115+ }
116+
112117 get ragUploadsDescription () {
113118 return this .siteSettings .rag_images_enabled
114119 ? i18n (" discourse_ai.rag.uploads.description_with_images" )
@@ -229,7 +234,7 @@ export default class AiToolEditorForm extends Component {
229234 </row.Col >
230235
231236 <row.Col @ size ={{ 4 }} >
232- <collection.Field @ name =" enum " @ title =" Enum" as | field | >
237+ <collection.Field @ name =" isEnum " @ title =" Enum" as | field | >
233238 <field.Checkbox />
234239 </collection.Field >
235240 </row.Col >
@@ -243,6 +248,9 @@ export default class AiToolEditorForm extends Component {
243248 />
244249 </row.Col >
245250 </form.Row >
251+ {{#if ( this.parameterIsEnum data index ) }}
252+ I am an enum
253+ {{/if }}
246254 </div >
247255 </form.Collection >
248256
@@ -252,7 +260,9 @@ export default class AiToolEditorForm extends Component {
252260 @ action ={{fn
253261 form.addItemToCollection
254262 " parameters"
255- ( hash name =" " type =" string" description =" " required =false enum =false )
263+ ( hash
264+ name =" " type =" string" description =" " required =false isEnum =false
265+ )
256266 }}
257267 />
258268
@@ -299,18 +309,20 @@ export default class AiToolEditorForm extends Component {
299309 class =" ai-tool-editor__test-button"
300310 />
301311
312+ {{/unless }}
313+
314+ <form.Submit
315+ @ label =" discourse_ai.tools.save"
316+ class =" ai-tool-editor__save"
317+ />
318+ {{#unless @ isNew }}
302319 <form.Button
303320 @ label =" discourse_ai.tools.delete"
304321 @ icon =" trash-can"
305322 @ action ={{this .delete }}
306323 class =" btn-danger ai-tool-editor__delete"
307324 />
308325 {{/unless }}
309-
310- <form.Submit
311- @ label =" discourse_ai.tools.save"
312- class =" ai-tool-editor__save"
313- />
314326 </form.Actions >
315327 </Form >
316328 </template >
0 commit comments