Skip to content

Use Ai::Conversation::Message directly in GraphQL read

What does this MR do and why?

  • Adds duo_chat_read_directly_from_db feature flag to turn on/off the following changes:

    • Update ChatStorage#messages to return Ai::Conversation::Message.
    • For ChatMessagesResolver, instead of to_h every items, pass Ai::Conversation::Message directly to GraphQL for serialization
    • For Types::Ai::MessageType, make it able to handle both ChatMessage and Ai::Conversation::Message.
      • id has to be sourced from message_xid in Ai::Conversation::Message
      • thread has to be routed to object.thread instead of object['thread'] (this is a quirk of ActiveRecord).
      • errors has to be routed to error_details column (since errors is already reserved internally in ActiveRecord)
    • For Duo feedback, update message record directly
  • Other behavior changes not affected by the feature flag

    • Polyfill Ai::Conversation::Message so it behaves a much like ChatMessage as possible

References

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #501150 (closed)

Edited by Mark Chao

Merge request reports

Loading