2023-08-23 13:35:40 -04:00
|
|
|
<div {{did-insert this.setupContextMenu}}>
|
|
|
|
{{#if this.showContextMenu}}
|
|
|
|
<div class="ai-helper-context-menu">
|
|
|
|
{{#if (eq this.menuState this.CONTEXT_MENU_STATES.triggers)}}
|
|
|
|
<ul class="ai-helper-context-menu__trigger">
|
|
|
|
<li>
|
|
|
|
<DButton
|
2023-09-05 16:21:05 -04:00
|
|
|
@icon="discourse-sparkles"
|
2023-08-23 13:35:40 -04:00
|
|
|
@action={{this.toggleAiHelperOptions}}
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.trigger"
|
|
|
|
class="btn-flat"
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
{{else if (eq this.menuState this.CONTEXT_MENU_STATES.options)}}
|
|
|
|
<ul class="ai-helper-context-menu__options">
|
|
|
|
{{#each this.helperOptions as |option|}}
|
2023-09-25 14:12:54 -04:00
|
|
|
{{#if (eq option.name "custom_prompt")}}
|
2023-12-14 11:47:20 -05:00
|
|
|
<AiHelperCustomPrompt
|
|
|
|
@value={{this.customPromptValue}}
|
|
|
|
@promptArgs={{option}}
|
|
|
|
@submit={{this.updateSelected}}
|
|
|
|
/>
|
2023-09-25 14:12:54 -04:00
|
|
|
{{else}}
|
|
|
|
<li data-name={{option.translated_name}} data-value={{option.id}}>
|
|
|
|
<DButton
|
|
|
|
@icon={{option.icon}}
|
|
|
|
@translatedLabel={{option.translated_name}}
|
2024-01-12 18:28:06 -05:00
|
|
|
@action={{fn this.updateSelected option}}
|
|
|
|
class="btn-flat"
|
2023-09-25 14:12:54 -04:00
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
{{/if}}
|
2023-08-23 13:35:40 -04:00
|
|
|
{{/each}}
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
{{else if (eq this.menuState this.CONTEXT_MENU_STATES.loading)}}
|
2023-12-12 12:28:39 -05:00
|
|
|
<AiHelperLoading @cancel={{this.cancelAIAction}} />
|
2023-08-23 13:35:40 -04:00
|
|
|
|
2023-08-24 20:49:24 -04:00
|
|
|
{{else if (eq this.menuState this.CONTEXT_MENU_STATES.review)}}
|
|
|
|
<ul class="ai-helper-context-menu__review">
|
|
|
|
<li>
|
|
|
|
<DButton
|
|
|
|
@icon="exchange-alt"
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.view_changes"
|
|
|
|
@action={{this.viewChanges}}
|
|
|
|
class="btn-flat view-changes"
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<DButton
|
|
|
|
@icon="undo"
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.revert"
|
|
|
|
@action={{this.undoAIAction}}
|
|
|
|
class="btn-flat revert"
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<DButton
|
|
|
|
@icon="check"
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.confirm"
|
|
|
|
@action={{this.confirmChanges}}
|
|
|
|
class="btn-flat confirm"
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
2023-08-23 13:35:40 -04:00
|
|
|
{{else if (eq this.menuState this.CONTEXT_MENU_STATES.resets)}}
|
|
|
|
<ul class="ai-helper-context-menu__resets">
|
|
|
|
<li>
|
|
|
|
<DButton
|
|
|
|
@icon="undo"
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.undo"
|
|
|
|
@action={{this.undoAIAction}}
|
|
|
|
class="btn-flat undo"
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<DButton
|
|
|
|
@icon="discourse-sparkles"
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.regen"
|
2024-01-12 18:28:06 -05:00
|
|
|
@action={{fn this.updateSelected this.lastUsedOption}}
|
2023-08-23 13:35:40 -04:00
|
|
|
class="btn-flat"
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
2023-08-24 20:49:24 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{{#if this.showDiffModal}}
|
|
|
|
<Modal::DiffModal
|
|
|
|
@confirm={{this.confirmChanges}}
|
|
|
|
@diff={{this.diff}}
|
2023-12-20 13:46:22 -05:00
|
|
|
@oldValue={{this.initialValue}}
|
2023-08-24 20:49:24 -04:00
|
|
|
@newValue={{this.newSelectedText}}
|
2023-10-06 18:17:21 -04:00
|
|
|
@revert={{this.undoAIAction}}
|
2023-08-24 20:49:24 -04:00
|
|
|
@closeModal={{fn (mut this.showDiffModal) false}}
|
|
|
|
/>
|
2023-12-19 14:17:34 -05:00
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#if this.showThumbnailModal}}
|
|
|
|
<Modal::ThumbnailSuggestions
|
|
|
|
@thumbnails={{this.thumbnailSuggestions}}
|
|
|
|
@closeModal={{fn (mut this.showThumbnailModal) false}}
|
|
|
|
/>
|
2023-08-24 20:49:24 -04:00
|
|
|
{{/if}}
|