DEV: Don't attempt to update log if completion request fails. (#321)
We already log the request failure when we raise the exception.
This commit is contained in:
parent
02f7b368a1
commit
2e7c5f047d
|
@ -105,12 +105,14 @@ module DiscourseAi
|
|||
|
||||
return response_data
|
||||
ensure
|
||||
log.raw_response_payload = response_raw
|
||||
log.response_tokens = tokenizer.size(response_data)
|
||||
log.save!
|
||||
if log
|
||||
log.raw_response_payload = response_raw
|
||||
log.response_tokens = tokenizer.size(response_data)
|
||||
log.save!
|
||||
|
||||
if Rails.env.development? && log
|
||||
puts "#{self.class.name}: request_tokens #{log.request_tokens} response_tokens #{log.response_tokens}"
|
||||
if Rails.env.development?
|
||||
puts "#{self.class.name}: request_tokens #{log.request_tokens} response_tokens #{log.response_tokens}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue