-
Notifications
You must be signed in to change notification settings - Fork 29
Add configurable default questions for Chat on Your Data feature #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: rag2111 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR makes the set of “suggested questions” for the Chat on Your Data feature fully configurable via ASP.NET Core settings and environment variables.
- Adds new
DefaultQuestionsconfiguration inappsettings.*.jsonand terraform - Introduces
ChatOnYourDataModeland updates controller/view to render question cards - Implements responsive UI cards with click/hover states and postMessage integration
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/AIHub/appsettings.template.json | Added DefaultQuestions array under ChatOnYourData |
| src/AIHub/appsettings.Development.json | Populated dev defaults for ChatOnYourData:DefaultQuestions |
| src/AIHub/Models/ChatOnYourDataModel.cs | New model for link and default questions |
| src/AIHub/Controllers/ChatOnYourDataController.cs | Reads Link and DefaultQuestions from config and passes to view |
| src/AIHub/Views/ChatOnYourData/ChatOnYourData.cshtml | Renders question cards, CSS/JS for interactions |
| infra/modules/ca-chat/main.tf | Exposes DEFAULT_QUESTIONS env var for container |
Comments suppressed due to low confidence (2)
src/AIHub/Views/ChatOnYourData/ChatOnYourData.cshtml:28
- This new rendering logic for default questions isn’t covered by any automated tests. Consider adding a view or integration test that verifies the cards appear when
DefaultQuestionsis populated.
@if (Model.DefaultQuestions != null && Model.DefaultQuestions.Any())
src/AIHub/appsettings.template.json:64
- The new
DefaultQuestionssetting isn't documented. Please update README or configuration docs to explain this section and its expected JSON format.
"DefaultQuestions": [
| value = "DEBUG" | ||
| }, | ||
| { | ||
| name = "DEFAULT_QUESTIONS" |
Copilot
AI
Jun 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable DEFAULT_QUESTIONS won’t map to the nested config key ChatOnYourData:DefaultQuestions. Use ChatOnYourData__DefaultQuestions to match ASP.NET Core’s environment variable binding convention.
| name = "DEFAULT_QUESTIONS" | |
| name = "ChatOnYourData__DefaultQuestions" |
| </div> | ||
| <!-- container --> | ||
|
|
||
| <style> |
Copilot
AI
Jun 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Inline CSS in the Razor view can make maintenance harder. Consider moving these styles into a shared stylesheet or component-specific CSS file.
| iframe.contentWindow.postMessage({ | ||
| type: 'set_question', | ||
| question: question | ||
| }, '*'); |
Copilot
AI
Jun 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using '*' as the targetOrigin in postMessage is insecure. Specify the exact origin of the iframe (e.g. new URL(Model.Link).origin) to prevent message spoofing.
| }, '*'); | |
| }, iframeOrigin); // Use the extracted origin |
This PR implements configurable default questions for the "Chat on your data" feature, making them document/domain agnostic as requested in the issue.
Changes Made
🎯 New Default Questions
The feature now displays 5 document-agnostic questions above the chat interface:
🔧 Technical Implementation
Backend Changes:
ChatOnYourDataModelfor type-safe configuration handlingChatOnYourDataControllerto read questions fromappsettings.jsonappsettings.template.jsonandappsettings.Development.jsonFrontend Enhancements:
postMessageAPIInfrastructure Updates:
DEFAULT_QUESTIONSenvironment variable to chat container configuration🎨 User Experience
📊 Code Impact
The implementation is fully configurable through standard ASP.NET Core configuration, allowing administrators to customize questions per deployment without code changes.
Fixes #16.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/Azure-Samples/azure-search-openai-democurl -s REDACTED(http block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.