-
Notifications
You must be signed in to change notification settings - Fork 21
[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 13 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 |
|---|---|---|
|
|
@@ -83,6 +83,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 | ||
|
|
||
| #### Example: | ||
| ```sh | ||
| /quick create "greeting" Hello! How have you been? | ||
|
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. This is not what I ment How double quotes make the multiple words a single text for body use |
||
| ``` | ||
| This will add the reply name as **`greeting`** and the rest message as body in the modal, which can be used later by typing **`/qs greeting`** | ||
|
|
||
|
Comment on lines
+97
to
+107
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. That is just to much for such simple thing and can't we just do like /quick create "you can use double quotes to write the name with spaces" you write everything else as a body ??
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. this just looks like AI-generated markdown to me |
||
| ### Using Placeholders: | ||
|
|
||
|
|
||
| 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; | ||
| params?: string[]; | ||
|
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. Why optinal?
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. not answered ?
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. again not answered? |
||
| }; | ||
| 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 params?: string[]; | ||
|
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. stilll ?
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. man ? |
||
|
|
||
| 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.params = params.params; | ||
|
|
||
| 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 initialReplyName = this.params?.[1]; | ||
| const initialReplyBody = this.params?.slice(2).join(' '); | ||
| const modal = await CreateReplyModal( | ||
| this.app, | ||
| this.sender, | ||
|
|
@@ -64,13 +69,14 @@ export class Handler implements IHandler { | |
| this.modify, | ||
| this.room, | ||
| this.language, | ||
| initialReplyName, | ||
| initialReplyBody, | ||
| ); | ||
|
|
||
| if (modal instanceof Error) { | ||
| this.app.getLogger().error(modal.message); | ||
| return; | ||
| } | ||
|
|
||
| const triggerId = this.triggerId; | ||
|
|
||
| if (triggerId) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,7 @@ export function inputElementComponent( | |
| text: label, | ||
| element: plainTextInputElement, | ||
| optional, | ||
| blockId, | ||
|
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. ??
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. ??? |
||
| }); | ||
|
|
||
| return plainTextInputBlock; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,10 @@ export async function CreateReplyModal( | |
| modify: IModify, | ||
| room: IRoom, | ||
| language: Language, | ||
| initialReplyName?: string, | ||
|
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. i said already we can make a new type for this or interface |
||
| initialReplyBody?: string, | ||
| ): Promise<IUIKitSurfaceViewParam | Error> { | ||
|
|
||
| const { elementBuilder, blockBuilder } = app.getUtils(); | ||
|
|
||
| const blocks: InputBlock[] = []; | ||
|
|
@@ -39,6 +42,7 @@ export async function CreateReplyModal( | |
| placeholder: placeholderReplyName, | ||
| label: labelReplyName, | ||
| optional: false, | ||
| initialValue: initialReplyName, | ||
| }, | ||
| { | ||
| blockId: CreateModalEnum.REPLY_NAME_BLOCK_ID, | ||
|
|
@@ -56,6 +60,7 @@ export async function CreateReplyModal( | |
| label: labelReplyBody, | ||
| optional: false, | ||
| multiline: true, | ||
| initialValue: initialReplyBody, | ||
| }, | ||
| { | ||
| blockId: CreateModalEnum.REPLY_BODY_BLOCK_ID, | ||
|
|
@@ -91,4 +96,4 @@ export async function CreateReplyModal( | |
| close, | ||
| submit, | ||
| }; | ||
| } | ||
| } | ||
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 SS
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 SS man why you are not making requested changes before asking for review.