This repository was archived by the owner on Jul 22, 2025. It is now read-only.
generated from discourse/discourse-plugin-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 41
FEATURE: add support for uploads when starting a convo #1301
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b7b555b
FEATURE: add support for uploads when starting a convo
SamSaffron d31a792
UX: additional styling for uploads
awesomerobot 86b681a
move uploads to the bottom
SamSaffron 3f0dd42
move to bottom
SamSaffron b2d13cb
Add specs for upload support
SamSaffron 55d0d1c
rename and default enable new bot ux
SamSaffron 5ba6cc9
rename setting
SamSaffron b0bda16
reduce amount of code by using core implementation
SamSaffron ed318ad
fix spec
SamSaffron 9d67df3
update styling and remove duplicate event
SamSaffron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { hash } from "@ember/helper"; | ||
| import { fn, hash } from "@ember/helper"; | ||
| import { on } from "@ember/modifier"; | ||
| import didInsert from "@ember/render-modifiers/modifiers/did-insert"; | ||
| import RouteTemplate from "ember-route-template"; | ||
|
|
@@ -17,15 +17,24 @@ export default RouteTemplate( | |
| /> | ||
|
|
||
| <div class="ai-bot-conversations__content-wrapper"> | ||
| <h1>{{i18n "discourse_ai.ai_bot.conversations.header"}}</h1> | ||
| <div class="ai-bot-conversations__title"> | ||
| {{i18n "discourse_ai.ai_bot.conversations.header"}} | ||
| </div> | ||
| <PluginOutlet | ||
| @name="ai-bot-conversations-above-input" | ||
| @outletArgs={{hash | ||
| [email protected] | ||
| submit=@controller.aiBotConversationsHiddenSubmit.submitToBot | ||
| submit=@controller.prepareAndSubmitToBot | ||
| }} | ||
| /> | ||
|
|
||
| <div class="ai-bot-conversations__input-wrapper"> | ||
| <DButton | ||
| @icon="upload" | ||
| @action={{@controller.openFileUpload}} | ||
| @title="discourse_ai.ai_bot.conversations.upload_files" | ||
| class="btn btn-transparent ai-bot-upload-btn" | ||
| /> | ||
| <textarea | ||
| {{didInsert @controller.setTextArea}} | ||
| {{on "input" @controller.updateInputValue}} | ||
|
|
@@ -38,13 +47,54 @@ export default RouteTemplate( | |
| rows="1" | ||
| /> | ||
| <DButton | ||
| @action={{@controller.aiBotConversationsHiddenSubmit.submitToBot}} | ||
| @action={{@controller.prepareAndSubmitToBot}} | ||
| @icon="paper-plane" | ||
| @isLoading={{@controller.loading}} | ||
| @title="discourse_ai.ai_bot.conversations.header" | ||
| class="ai-bot-button btn-primary ai-conversation-submit" | ||
| /> | ||
| </div> | ||
|
|
||
| {{! Hidden file input element }} | ||
| <input | ||
| type="file" | ||
| id="ai-bot-file-uploader" | ||
| class="hidden-upload-field" | ||
| multiple="multiple" | ||
| {{didInsert @controller.registerFileInput}} | ||
| /> | ||
|
|
||
| {{#if @controller.showUploadsContainer}} | ||
| <div class="ai-bot-conversations__uploads-container"> | ||
| {{#each @controller.uploads as |upload|}} | ||
| <div class="ai-bot-upload"> | ||
| <span class="ai-bot-upload__filename"> | ||
| {{upload.original_filename}} | ||
| </span> | ||
| <DButton | ||
| @icon="xmark" | ||
| @action={{fn @controller.removeUpload upload}} | ||
| class="btn-transparent ai-bot-upload__remove" | ||
| /> | ||
| </div> | ||
| {{/each}} | ||
|
|
||
| {{#each @controller.inProgressUploads as |upload|}} | ||
| <div class="ai-bot-upload ai-bot-upload--in-progress"> | ||
| <span class="ai-bot-upload__filename">{{upload.fileName}}</span> | ||
| <span class="ai-bot-upload__progress"> | ||
| {{upload.progress}}% | ||
| </span> | ||
| <DButton | ||
| @icon="xmark" | ||
| @action={{fn @controller.cancelUpload upload}} | ||
| class="btn-flat ai-bot-upload__remove" | ||
| /> | ||
| </div> | ||
| {{/each}} | ||
| </div> | ||
| {{/if}} | ||
|
|
||
| <p class="ai-disclaimer"> | ||
| {{i18n "discourse_ai.ai_bot.conversations.disclaimer"}} | ||
| </p> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.