diff --git a/src/definition/helper/userPreference.ts b/src/definition/helper/userPreference.ts
index 1f88b2b..743625e 100644
--- a/src/definition/helper/userPreference.ts
+++ b/src/definition/helper/userPreference.ts
@@ -20,12 +20,27 @@ export enum AIProviderEnum {
SelfHosted = 'Self Hosted',
}
+export enum PromptOptionsEnum {
+ Professional = 'Professional',
+ Friendly = 'Friendly',
+ Supportive = 'Supportive',
+ Concise = 'Concise',
+ Detailed = 'Detailed',
+ Actionable = 'Actionable',
+ Persuasive = 'Persuasive',
+ Analytical = 'Analytical',
+ Neutral = 'Neutral',
+ Helpful = 'Helpful',
+}
+
+export type PromptOptions = keyof typeof PromptOptionsEnum;
+
export interface IPreference {
userId: string;
language: Language;
AIusagePreference: AIusagePreference;
AIconfiguration: {
- AIPrompt: string;
+ AIPromptOptions: PromptOptions[];
AIProvider: AIProviderType;
selfHosted: {
url: string;
diff --git a/src/definition/ui-kit/Element/IMultiStaticSelectElement.ts b/src/definition/ui-kit/Element/IMultiStaticSelectElement.ts
new file mode 100644
index 0000000..ea3fd28
--- /dev/null
+++ b/src/definition/ui-kit/Element/IMultiStaticSelectElement.ts
@@ -0,0 +1,17 @@
+import { MultiStaticSelectElement } from '@rocket.chat/ui-kit';
+
+export type MultiStaticSelectElementParam = Pick<
+ MultiStaticSelectElement,
+ | 'options'
+ | 'optionGroups'
+ | 'initialOption'
+ | 'initialValue'
+ | 'dispatchActionConfig'
+> & { placeholder: string };
+
+export type MultiStaticSelectOptionsParam = Array<{
+ text: string;
+ value: string;
+ description?: string;
+ url?: string;
+}>;
diff --git a/src/enum/modals/UserPreferenceModal.ts b/src/enum/modals/UserPreferenceModal.ts
index 957b5db..c0a2593 100644
--- a/src/enum/modals/UserPreferenceModal.ts
+++ b/src/enum/modals/UserPreferenceModal.ts
@@ -20,8 +20,8 @@ export enum UserPreferenceModalEnum {
GEMINI_API_KEY_BLOCK_ID = 'gemini-api-key-block-id',
SELF_HOSTED_URL_ACTION_ID = 'self-hosted-url-action-id',
SELF_HOSTED_URL_BLOCK_ID = 'self-hosted-url-block-id',
- PROMPT_CONFIG_INPUT_BLOCK_ID = 'prompt-config-input-block-id',
- PROMPT_CONFIG_INPUT_ACTION_ID = 'prompt-config-input-action-id',
+ PROMPT_CONFIG_OPTIONS_BLOCK_ID = 'prompt-config-options-block-id',
+ PROMPT_CONFIG_OPTIONS_ACTION_ID = 'prompt-config-options-action-id',
SUBMIT_ACTION_ID = 'submit-set-user-preference-language-modal-action-id',
SUBMIT_BLOCK_ID = 'submit-set-user-preference-language-modal-block-id',
diff --git a/src/handlers/AIHandler.ts b/src/handlers/AIHandler.ts
index e4ddf52..36a4285 100644
--- a/src/handlers/AIHandler.ts
+++ b/src/handlers/AIHandler.ts
@@ -64,7 +64,7 @@ class AIHandler {
}
private getPrompt(message: string, prompt: string): string {
- return `Write a reply to this message: "${message}". ${this.userPreference.AIconfiguration.AIPrompt} and Use the following as a prompt or response reply: "${prompt}" and make sure you respond with just the reply without quotes.`;
+ return `Write a reply to this message: "${message}".Reply must be ${this.userPreference.AIconfiguration.AIPromptOptions} Use the as a prompt or response reply: "${prompt}" and make sure you respond with just the reply without quotes.`;
}
private async handleSelfHostedModel(
diff --git a/src/handlers/ExecuteViewSubmitHandler.ts b/src/handlers/ExecuteViewSubmitHandler.ts
index 53334e5..df171d9 100644
--- a/src/handlers/ExecuteViewSubmitHandler.ts
+++ b/src/handlers/ExecuteViewSubmitHandler.ts
@@ -210,10 +210,10 @@ export class ExecuteViewSubmitHandler {
UserPreferenceModalEnum.SELF_HOSTED_URL_ACTION_ID
];
- const PromptConfigurationInput =
+ const PromptConfigurationOptions =
view.state?.[
- UserPreferenceModalEnum.PROMPT_CONFIG_INPUT_BLOCK_ID
- ]?.[UserPreferenceModalEnum.PROMPT_CONFIG_INPUT_ACTION_ID];
+ UserPreferenceModalEnum.PROMPT_CONFIG_OPTIONS_BLOCK_ID
+ ]?.[UserPreferenceModalEnum.PROMPT_CONFIG_OPTIONS_ACTION_ID];
const userPreference = new UserPreferenceStorage(
this.persistence,
@@ -226,7 +226,7 @@ export class ExecuteViewSubmitHandler {
language: languageInput,
AIusagePreference: AIpreferenceInput,
AIconfiguration: {
- AIPrompt: PromptConfigurationInput,
+ AIPromptOptions: PromptConfigurationOptions,
AIProvider: AIoptionInput,
openAI: {
apiKey: OpenAIAPIKeyInput,
diff --git a/src/lib/ElementBuilder.ts b/src/lib/ElementBuilder.ts
index 7fa0dbc..2c79466 100644
--- a/src/lib/ElementBuilder.ts
+++ b/src/lib/ElementBuilder.ts
@@ -12,12 +12,17 @@ import {
PlainTextInputElement,
Option,
StaticSelectElement,
+ MultiStaticSelectElement,
} from '@rocket.chat/ui-kit';
import { PlainTextInputParam } from '../definition/ui-kit/Element/IPlainTextInputElement';
import {
StaticSelectElementParam,
StaticSelectOptionsParam,
} from '../definition/ui-kit/Element/IStaticSelectElement';
+import {
+ MultiStaticSelectElementParam,
+ MultiStaticSelectOptionsParam,
+} from '../definition/ui-kit/Element/IMultiStaticSelectElement';
export class ElementBuilder implements IElementBuilder {
constructor(private readonly appId: string) {}
@@ -146,4 +151,62 @@ export class ElementBuilder implements IElementBuilder {
});
return options;
}
+
+ public addMultiSelect(
+ param: MultiStaticSelectElementParam,
+ interaction: ElementInteractionParam,
+ ): MultiStaticSelectElement {
+ const {
+ placeholder,
+ options,
+ optionGroups,
+ initialOption,
+ initialValue,
+ dispatchActionConfig,
+ } = param;
+ const { blockId, actionId } = interaction;
+ const multiSelect: MultiStaticSelectElement = {
+ type: BlockElementType.MULTI_STATIC_SELECT,
+ placeholder: {
+ type: TextObjectType.PLAIN_TEXT,
+ text: placeholder,
+ },
+ options,
+ optionGroups,
+ initialOption,
+ initialValue,
+ appId: this.appId,
+ blockId,
+ actionId,
+ dispatchActionConfig,
+ };
+ return multiSelect;
+ }
+
+ public createMultiSelectOptions(
+ param: MultiStaticSelectOptionsParam,
+ ): Array