Add additional context to AiChat GraphQL mutation
What does this MR do and why?
Adds additional context argument to AiChatInput GraphQL type.
Related to #477258 (closed), #478241 (closed), !162202 (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.
How to validate locally
- Run bundle exec rails c
- Enable feature flag Feature.enable(:duo_additional_context)
- Enable feature flag Feature.enable(:v2_chat_agent_integration)
- Start gdkwith LLM debug. In yourgdkdirectory run the following commands:- export LLM_DEBUG=1
- gdk start
- tail -f rails/log/llm.log
 
- Navigate to http://gdk.test:3000/-/graphql-explorer
- Run the following mutation:
mutation { aiAction(input: {chat: {content: "Explain this code", additionalContext: [ { type: SNIPPET, name: "hello world", content: "puts 'Hello, world'" } ]}}) { clientMutationId errors } }
- Check LLM logs
- You should see a record similar to this truncated example
{"severity":"DEBUG","time":"2024-08-08T09:40:34.337Z","action_name":"chat","options":{"content":"Explain this code","additional_context":[{"type":"snippet","name":"hello world","content":"puts 'Hello, world'"}],"referer_url":"http://gdk.test:3000/-/graphql-explorer"}}
Edited  by Missy Davies