-
Notifications
You must be signed in to change notification settings - Fork 19
[FEAT] : Added dynamic initial values in create modal #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
7d8d7b0
1a58780
cca74eb
c4ec6cc
d8ce982
9bf47bb
3a5355d
bf658de
69818f2
a275aea
aed5898
8a4b62a
1c9b802
30f37ab
b4e19a8
a42ce1c
f28fd6e
ca43cde
8f85896
22cd3c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,13 @@ By selecting quick replies instead of typing manually, agents/users can respond | |
| - **`/quick ai`**: Use AI to generate replies | ||
| - **`/quick help`**: Get help with Quick Reply | ||
| - **`/qs <reply name>`**: Quickly search and send a reply by name | ||
| - **`/quick create <name> <message>`**: Create a quick reply directly from the input box with a name and message | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add SS
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add SS man why you are not making requested changes before asking for review. |
||
| #### Example: | ||
| ```sh | ||
| /quick create greeting Hello! How have you been? | ||
| ``` | ||
| This will create a quick reply named **`greeting`**, which can be used later by typing **`/qs greeting`** | ||
|
|
||
| ### Using Placeholders: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,8 +65,17 @@ export class CommandUtility implements ICommandUtility { | |
| triggerId: this.triggerId, | ||
| threadId: this.threadId, | ||
| language, | ||
| args: this.params, | ||
|
||
| }); | ||
|
|
||
| if(this.params.length && this.params.length > 1){ | ||
| const subCommand = this.params[0].toLowerCase(); | ||
| if(subCommand === CommandParam.CREATE){ | ||
| await this.handleSingleParam(handler) | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| switch (this.params.length) { | ||
| case 0: { | ||
| await handler.sendDefault(); | ||
|
|
@@ -76,7 +85,7 @@ export class CommandUtility implements ICommandUtility { | |
| await this.handleSingleParam(handler); | ||
| break; | ||
| } | ||
| default: { | ||
| default: { | ||
|
||
| await handler.sendDefault(); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,5 @@ export interface IHandler extends Omit<ICommandUtilityParams, 'params'> { | |
|
|
||
| export type IHanderParams = Omit<ICommandUtilityParams, 'params'> & { | ||
| language: Language; | ||
| args? : string[]; | ||
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,14 +119,12 @@ export class ExecuteViewSubmitHandler { | |
| language: Language, | ||
| triggerId: string, | ||
| ): Promise<IUIKitResponse> { | ||
| const nameStateValue = | ||
| view.state?.[CreateModalEnum.REPLY_NAME_BLOCK_ID]?.[ | ||
| CreateModalEnum.REPLY_NAME_ACTION_ID | ||
| ]; | ||
| const bodyStateValue = | ||
| view.state?.[CreateModalEnum.REPLY_BODY_BLOCK_ID]?.[ | ||
| CreateModalEnum.REPLY_BODY_ACTION_ID | ||
| ]; | ||
| const nameStateValue = view.state && Object.values(view.state) | ||
|
||
| .find(obj => 'reply-name-action-id' in obj) | ||
| ?.['reply-name-action-id']; | ||
| const bodyStateValue = view.state && Object.values(view.state) | ||
| .find(obj => 'reply-body-action-id' in obj) | ||
| ?.['reply-body-action-id']; | ||
|
|
||
| const name = nameStateValue ? nameStateValue.trim() : ''; | ||
| const body = bodyStateValue ? bodyStateValue.trim() : ''; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ export class Handler implements IHandler { | |
| public triggerId?: string; | ||
| public threadId?: string; | ||
| public language: Language; | ||
| public args? : string[]; | ||
|
||
|
|
||
| constructor(params: IHanderParams) { | ||
| this.app = params.app; | ||
|
|
@@ -47,6 +48,8 @@ export class Handler implements IHandler { | |
| this.triggerId = params.triggerId; | ||
| this.threadId = params.threadId; | ||
| this.language = params.language; | ||
| this.args = params.args; | ||
|
||
|
|
||
| const persistenceRead = params.read.getPersistenceReader(); | ||
| this.roomInteractionStorage = new RoomInteractionStorage( | ||
| params.persis, | ||
|
|
@@ -56,6 +59,8 @@ export class Handler implements IHandler { | |
| } | ||
|
|
||
| public async CreateReply(): Promise<void> { | ||
| const cliName = this.args?.[1] || ''; | ||
|
||
| const cliBody = this.args?.slice(2).join(' ') || ''; | ||
| const modal = await CreateReplyModal( | ||
| this.app, | ||
| this.sender, | ||
|
|
@@ -64,13 +69,15 @@ export class Handler implements IHandler { | |
| this.modify, | ||
| this.room, | ||
| this.language, | ||
| cliName, | ||
|
||
| cliBody, | ||
| ); | ||
|
|
||
| if (modal instanceof Error) { | ||
| this.app.getLogger().error(modal.message); | ||
| return; | ||
| } | ||
|
|
||
| const triggerId = this.triggerId; | ||
|
|
||
| if (triggerId) { | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add screen shot how it look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put create command together , explain how double quotes works to name a reply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double quotes ("") ? Explain double quote behavior here