Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ You can create chat workflow automations using **two methods**:
- Admins must configure settings in the UI:
- Navigate to: `Marketplace → Private Apps → AI Chat Workflows Automation → Settings`
- Only users with admin access can configure the app’s LLM settings.
- **Confidence Threshold**: Adjust minimum confidence (0-100) for trigger validation. Lower (40-60) = creative/flexible, Higher (85-95) = strict/precise. Default: 75.

### 2. ⚙️ Use Slash Command `/chat-automation-create`
- Opens a UI modal where you can fill in all the necessary details to create a workflow.
Expand Down
13 changes: 12 additions & 1 deletion handler/PostMessageSentHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
} from "../utils/Messages";
import { ActionTypeEnum } from "../definitions/ActionTypeEnum";
import { createTextCompletion } from "../utils/AIProvider";
import { SettingEnum } from "../settings/settings";

interface CheckConditionResponse {
condition_met: boolean;
Expand Down Expand Up @@ -66,6 +67,16 @@ export class PostMessageSentHandler implements IPostMessageSent {
await findTriggerResponsesByNullCombinations(read);
const allResponses = [...triggerResponses, ...triggerResponses2];

const confidenceThresholdSetting = (await read
.getEnvironmentReader()
.getSettings()
.getValueById(SettingEnum.ID_CONFIDENCE_THRESHOLD)) as number;

const confidenceThreshold = Math.max(
0,
Math.min(100, confidenceThresholdSetting || 75)
);

for (const [index, response] of allResponses.entries()) {
// UI Approach
if (!response.data.usedLLM) {
Expand Down Expand Up @@ -141,7 +152,7 @@ export class PostMessageSentHandler implements IPostMessageSent {
: checkConditionPromptByLLM;

if (!checkConditionResponse.condition_met) continue;
if (checkConditionResponse.confidence < 75) continue;
if (checkConditionResponse.confidence < confidenceThreshold) continue;

if (
response.data.response.action ===
Expand Down
11 changes: 11 additions & 0 deletions settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export enum SettingEnum {
ID_RC_MODEL = `rc-model`,
ID_RC_AUTH_TOKEN = `rc-auth-token`,
ID_RC_USER_ID = `rc-user-id`,
ID_CONFIDENCE_THRESHOLD = `confidence-threshold`,
KEY_GROQ = `groq`,
KEY_GEMINI = `gemini`,
KEY_RC = `rocketchat`,
Expand Down Expand Up @@ -91,4 +92,14 @@ export const settings: ISetting[] = [
public: false,
packageValue: "",
},
{
id: SettingEnum.ID_CONFIDENCE_THRESHOLD,
i18nLabel: "Minimum Confidence Threshold (0-100)",
i18nDescription: "Lower = creative/flexible (less accurate), Higher = strict/precise (more accurate). Default: 75",
i18nPlaceholder: "75",
type: SettingType.NUMBER,
required: true,
public: true,
packageValue: 75,
},
];