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
|
return response_data
|
||||||
ensure
|
ensure
|
||||||
log.raw_response_payload = response_raw
|
if log
|
||||||
log.response_tokens = tokenizer.size(response_data)
|
log.raw_response_payload = response_raw
|
||||||
log.save!
|
log.response_tokens = tokenizer.size(response_data)
|
||||||
|
log.save!
|
||||||
|
|
||||||
if Rails.env.development? && log
|
if Rails.env.development?
|
||||||
puts "#{self.class.name}: request_tokens #{log.request_tokens} response_tokens #{log.response_tokens}"
|
puts "#{self.class.name}: request_tokens #{log.request_tokens} response_tokens #{log.response_tokens}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue