From abc511d00f5105bebde146cb23752bc8598a6e0e Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 22 Aug 2024 23:04:14 +0530 Subject: [PATCH] fix: inconsistent OpenAI cache interface (#10009) Signed-off-by: Shivam Mishra Co-authored-by: Muhsin Keloth --- .../accounts/integrations/hooks_controller.rb | 7 ++++++- .../conversation/LabelSuggestion.vue | 2 +- lib/integrations/openai_base_service.rb | 17 +++++++++++++++-- lib/redis/redis_keys.rb | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/v1/accounts/integrations/hooks_controller.rb b/app/controllers/api/v1/accounts/integrations/hooks_controller.rb index 13bb2738b..087a9b78d 100644 --- a/app/controllers/api/v1/accounts/integrations/hooks_controller.rb +++ b/app/controllers/api/v1/accounts/integrations/hooks_controller.rb @@ -12,7 +12,12 @@ class Api::V1::Accounts::Integrations::HooksController < Api::V1::Accounts::Base def process_event response = @hook.process_event(params[:event]) - if response[:error] + + # for cases like an invalid event, or when conversation does not have enough messages + # for a label suggestion, the response is nil + if response.nil? + render json: { message: nil } + elsif response[:error] render json: { error: response[:error] }, status: :unprocessable_entity else render json: { message: response[:message] } diff --git a/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue b/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue index 4593f25e2..da8488262 100644 --- a/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue +++ b/app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue @@ -172,7 +172,7 @@ export default { delay: { show: 600, hide: 0 }, hideOnClick: true, }" - class="label-suggestion--option" + class="label-suggestion--option !px-0" @click="pushOrAddLabel(label.title)" >