feat(consultation): add AI-generated response summaries in multiple languages - #1249
Open
austinjb32 wants to merge 1 commit into
Open
feat(consultation): add AI-generated response summaries in multiple languages#1249austinjb32 wants to merge 1 commit into
austinjb32 wants to merge 1 commit into
Conversation
…anguages - Added ConsultationSummaryService to generate AI summaries using GPT-5.6 Luna via OpenRouter - Added ConsultationSummaryJob triggered on consultation expiry - Added prompt template for narrative summary in 4 parts with translated labels - Added per-language rich text fields (english_response_summary, hindi_response_summary, etc.) - Exposed new response summary fields in GraphQL consultation type - Removed dead summary_hindi resolver method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bridge Ticket: CIV-116
What does this change do?
Adds AI-generated response summaries for consultations in 5 languages (English, Hindi, Marathi, Odia, Kannada). When a consultation expires, a background job generates narrative summaries from all question responses (excluding clause feedback) using GPT-5.6 Luna via OpenRouter.
Why is this change needed?
Consultations need automated summaries of public responses to help policymakers quickly understand consensus, diverging views, and minority opinions — without manually reading every response.
How were the changes done?
Consultation#expire, calls the service.config/prompts/consultation_ai_summary.prompt) — instructs the AI to produce a 4-part narrative (opening paragraph, Frequently Raised, Diverging Views, Also Raised) with labels translated into the target language.english_response_summary,hindi_response_summary,marathi_response_summary,odia_response_summary,kannada_response_summaryon the Consultation model.response_summarycolumn as{ language: text }hash.How was testing done?
Tested end-to-end against consultation #128 in dev — all 5 languages generated correctly with proper scripts (Devanagari, Odia, Kannada) and translated labels.
AI Code Review Summary
base.rb:94-96summary_hindiresolver method remained after field was removedbase.rbresponse_summaryJSONB field not exposed in GraphQLBlast Radius: High