@@ -17,6 +17,7 @@ import AdminUser from "admin/models/admin-user";
1717import GroupChooser from " select-kit/components/group-chooser" ;
1818import AiPersonaResponseFormatEditor from " ../components/modal/ai-persona-response-format-editor" ;
1919import AiLlmSelector from " ./ai-llm-selector" ;
20+ import AiPersonaCollapsableExample from " ./ai-persona-example" ;
2021import AiPersonaToolOptions from " ./ai-persona-tool-options" ;
2122import AiToolSelector from " ./ai-tool-selector" ;
2223import RagOptionsFk from " ./rag-options-fk" ;
@@ -230,6 +231,18 @@ export default class PersonaEditor extends Component {
230231 return this .allTools .filter ((tool ) => tools .includes (tool .id ));
231232 }
232233
234+ @action
235+ addExamplesPair (form , data ) {
236+ const newExamples = [... data .examples , [" " , " " ]];
237+ form .set (" examples" , newExamples);
238+ }
239+
240+ @action
241+ removeExamplesPair (form , data , idxToRemove ) {
242+ const updatedExamples = data .examples .toSpliced (idxToRemove, 1 );
243+ form .set (" examples" , updatedExamples);
244+ }
245+
233246 mapToolOptions (currentOptions , toolNames ) {
234247 const updatedOptions = Object .assign ({}, currentOptions);
235248
@@ -422,6 +435,32 @@ export default class PersonaEditor extends Component {
422435 </form.Field >
423436 {{/unless }}
424437
438+ <form.Section
439+ @ title ={{i18n " discourse_ai.ai_persona.examples.title" }}
440+ @ subtitle ={{i18n " discourse_ai.ai_persona.examples.examples_help" }}
441+ >
442+ {{#unless data.system }}
443+ <form.Container >
444+ <form.Button
445+ @ action ={{fn this . addExamplesPair form data }}
446+ @ label =" discourse_ai.ai_persona.examples.new"
447+ class =" ai-persona-editor__new_example"
448+ />
449+ </form.Container >
450+ {{/unless }}
451+
452+ {{#if ( gt data.examples.length 0 ) }}
453+ <form.Collection @ name =" examples" as | exCollection exCollectionIdx | >
454+ <AiPersonaCollapsableExample
455+ @ examplesCollection ={{exCollection }}
456+ @ exampleNumber ={{exCollectionIdx }}
457+ @ system ={{data.system }}
458+ @ form ={{form }}
459+ />
460+ </form.Collection >
461+ {{/if }}
462+ </form.Section >
463+
425464 <form.Section @ title ={{i18n " discourse_ai.ai_persona.ai_tools" }} >
426465 <form.Field
427466 @ name =" tools"
0 commit comments