Skip to content

Conversation

Copy link

Copilot AI commented Jun 18, 2025

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:

  • "Make me a summary of the document"
  • "Get me the most relevant topics of the document"
  • "Explain the document for a CEO"
  • "Explain the document for a kid"
  • "Translate the main topics of the document to X language"

🔧 Technical Implementation

Backend Changes:

  • Created ChatOnYourDataModel for type-safe configuration handling
  • Updated ChatOnYourDataController to read questions from appsettings.json
  • Added configuration sections to both appsettings.template.json and appsettings.Development.json

Frontend Enhancements:

  • Added responsive question cards with Bootstrap styling
  • Implemented clickable buttons with hover and active states
  • Added JavaScript to handle question selection and visual feedback
  • Questions attempt to communicate with chat iframe via postMessage API

Infrastructure Updates:

  • Added DEFAULT_QUESTIONS environment variable to chat container configuration
  • Questions are passed as JSON array for potential chat application integration

🎨 User Experience

  • Questions are displayed as attractive, clickable cards above the chat interface
  • Responsive design works on both desktop and mobile devices
  • Visual feedback shows selected questions with active styling
  • Backward compatible - existing deployments continue to work seamlessly

📊 Code Impact

  • 131 lines added, 9 deleted across 6 files
  • All changes are surgical and maintain existing functionality
  • Successfully builds in both Debug and Release configurations

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-demo
    • Triggering command: curl -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.

Copilot AI changed the title [WIP] Chat on your data - change the default questions Add configurable default questions for Chat on Your Data feature Jun 18, 2025
Copilot finished work on behalf of rag2111 June 18, 2025 14:30
Copilot AI requested a review from rag2111 June 18, 2025 14:30
@rag2111 rag2111 requested a review from Copilot June 23, 2025 11:29
Copy link

Copilot AI left a 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 DefaultQuestions configuration in appsettings.*.json and terraform
  • Introduces ChatOnYourDataModel and 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 DefaultQuestions is populated.
                    @if (Model.DefaultQuestions != null && Model.DefaultQuestions.Any())

src/AIHub/appsettings.template.json:64

  • The new DefaultQuestions setting isn't documented. Please update README or configuration docs to explain this section and its expected JSON format.
      "DefaultQuestions": [

value = "DEBUG"
},
{
name = "DEFAULT_QUESTIONS"
Copy link

Copilot AI Jun 23, 2025

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.

Suggested change
name = "DEFAULT_QUESTIONS"
name = "ChatOnYourData__DefaultQuestions"

Copilot uses AI. Check for mistakes.
</div>
<!-- container -->

<style>
Copy link

Copilot AI Jun 23, 2025

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.

Copilot uses AI. Check for mistakes.
iframe.contentWindow.postMessage({
type: 'set_question',
question: question
}, '*');
Copy link

Copilot AI Jun 23, 2025

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.

Suggested change
}, '*');
}, iframeOrigin); // Use the extracted origin

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat on your data - change the default questions

2 participants