Compare commits

...
2 Commits
Author SHA1 Message Date
f9fd121fad revert: remove unnecessary frontend validation changes
Keep only backend Sentry filtering change. The frontend validation
changes in useAI.js, integrations.json, and apps.yml are not needed
as validation already exists.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:29:49 +00:00
Tanmay Deep Sharmaandroot 4c36cea89d fix: validate OpenAI API key format and improve error handling 2026-01-19 17:46:15 +00:00
+10 -1
View File
@@ -96,6 +96,10 @@ class Integrations::LlmBaseService
end
end
# User configuration errors that should not be reported to Sentry
# Only UnauthorizedError is included as it clearly indicates an invalid API key
USER_ERRORS = %w[RubyLLM::UnauthorizedError].freeze
def execute_ruby_llm_request(parsed_body)
messages = parsed_body['messages']
model = parsed_body['model']
@@ -105,10 +109,15 @@ class Integrations::LlmBaseService
setup_chat_with_messages(chat, messages)
end
rescue StandardError => e
ChatwootExceptionTracker.new(e, account: hook.account).capture_exception
# Don't report user configuration errors (invalid API key, etc.) to Sentry
ChatwootExceptionTracker.new(e, account: hook.account).capture_exception unless user_configuration_error?(e)
build_error_response_from_exception(e, messages)
end
def user_configuration_error?(error)
USER_ERRORS.include?(error.class.name)
end
def setup_chat_with_messages(chat, messages)
apply_system_instructions(chat, messages)
response = send_conversation_messages(chat, messages)