fix: no method error when conversation is nil (#7566)
This commit is contained in:
@@ -23,14 +23,17 @@ module Enterprise::Integrations::OpenaiProcessorService
|
||||
end
|
||||
|
||||
def labels_with_messages
|
||||
labels = hook.account.labels.pluck(:title).join(', ')
|
||||
|
||||
character_count = labels.length
|
||||
conversation = find_conversation
|
||||
|
||||
# return nil if conversation is not present
|
||||
return nil if conversation.nil?
|
||||
|
||||
# return nil if conversation has less than 3 incoming messages
|
||||
return nil if conversation.messages.incoming.count < 3
|
||||
|
||||
labels = hook.account.labels.pluck(:title).join(', ')
|
||||
character_count = labels.length
|
||||
|
||||
messages = init_messages_body(false)
|
||||
add_messages_until_token_limit(conversation, messages, false, character_count)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user