2023-03-07 13:39:28 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-03-08 10:39:03 -05:00
|
|
|
require_dependency "reviewable_serializer"
|
|
|
|
|
2023-03-14 15:03:50 -04:00
|
|
|
class ReviewableAiChatMessageSerializer < ReviewableSerializer
|
2023-03-08 10:39:03 -05:00
|
|
|
payload_attributes :accuracies, :message_cooked
|
|
|
|
target_attributes :cooked
|
|
|
|
attributes :target_id
|
|
|
|
|
2023-03-14 15:03:50 -04:00
|
|
|
has_one :chat_channel, serializer: AiChatChannelSerializer, root: false, embed: :objects
|
2023-03-08 10:39:03 -05:00
|
|
|
|
|
|
|
def chat_channel
|
2024-01-03 09:49:47 -05:00
|
|
|
object.chat_message&.chat_channel
|
2023-03-08 10:39:03 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def target_id
|
|
|
|
object.target&.id
|
|
|
|
end
|
2023-03-07 13:39:28 -05:00
|
|
|
end
|