fix: undefined method first for nil:NilClass (#7567)
Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
@@ -75,6 +75,8 @@ class Integrations::OpenaiBaseService
|
||||
}
|
||||
|
||||
response = HTTParty.post(API_URL, headers: headers, body: body)
|
||||
JSON.parse(response.body)['choices'].first['message']['content']
|
||||
choices = JSON.parse(response.body)['choices']
|
||||
|
||||
choices.present? ? choices.first['message']['content'] : nil
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user