Add AdditionalContext to GraphQL AIMessageType
requested to merge 480703-retrieve-additional-context-from-history into 480702-store-additional-context-to-cache
What does this MR do and why?
Allow to retrieve additional context from AIMessages
Related to #480703 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
- Run
bundle exec rails c
- Find a required user
user = User.find_by_username('<YOUR-USERNAME>')
- Make sure feature flag is enabled
Feature.enable(:duo_additional_context, user)
- In your browser make sure you're logged in at
http://gdk.test:3000
as a user from previous steps - Navigate to
http://gdk.test:3000/-/graphql-explorer
- Run the following mutation to create a message with the context
mutation { aiAction(input: {chat: {content: "Explain this code", additionalContext: [ { category: SNIPPET, id: "hello world", content: "puts 'Hello, world'", metadata: "{\"freeform\":\"json\"}" } ]}}) { clientMutationId errors } }
- Read the recent messages using following GraphQL query
query getMessages { aiMessages { edges { node { id content additionalContext { id category content metadata } } } } }
Edited by Vitali Tatarintev