Skip to content

fix: add role-aware, provider-specific AI error messages and empty room validation#69

Open
sezallagwal wants to merge 1 commit intoRocketChat:mainfrom
sezallagwal:fix/ai-config-validation-errors
Open

fix: add role-aware, provider-specific AI error messages and empty room validation#69
sezallagwal wants to merge 1 commit intoRocketChat:mainfrom
sezallagwal:fix/ai-config-validation-errors

Conversation

@sezallagwal
Copy link
Contributor

Closes #68

Changes

Role-aware, provider-specific error messages (AIHandler.ts)

  • Added a getConfigError(provider) helper that selects the right error message based on usage mode (Personal / Workspace) and user role (admin / regular user).
  • Each AI provider path (Self Hosted, OpenAI, Gemini) now passes its specific name (e.g. "OpenAI API key or model", "Gemini API key") to the error message.
  • Personal mode: directs user to /quick config.
  • Workspace admin: directs to app settings.
  • Workspace user: directs to contact administrator.

Empty room validation (Handler.ts)

  • Added an early return with a notification when /quick ai is used in a room with no messages, instead of silently failing.

Settings cleanup (settings.ts)

  • Changed all AI settings from required: true to required: false since only one provider's keys are needed at a time — the red asterisks were misleading.

Translation updates (all 5 locales)

  • Replaced 6 old translation keys with 3 parameterized keys using __provider__ placeholders, plus a new AI_No_Message_Found key.
  • Updated ErrorKeys array in translation.ts to match.

Pass user context (ExecuteBlockActionHandler.ts)

  • Passes user to AIHandler constructor so role-based error logic works.

Files Changed (10)

  • src/handlers/AIHandler.ts
  • src/handlers/Handler.ts
  • src/handlers/ExecuteBlockActionHandler.ts
  • src/config/settings.ts
  • src/lib/Translation/translation.ts
  • src/lib/Translation/locales/{en,de,pt,ru,pl}.ts

Demo

Untitled.Project.mp4

@iam-vipin
Copy link
Collaborator

@sezallagwal can you fix this conflicts

@sezallagwal sezallagwal force-pushed the fix/ai-config-validation-errors branch from 4ea0e2a to 680080e Compare March 21, 2026 09:04
@sezallagwal
Copy link
Contributor Author

@iam-vipin Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: /quick ai error messages are not role-aware and lack actionable guidance

2 participants