Skip to content

Clean Question Answerer responses to remove citations and fix spacing#3

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-2
Open

Clean Question Answerer responses to remove citations and fix spacing#3
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 12, 2025

The Question Answerer was returning responses with unwanted citations and spacing issues that needed to be cleaned before presenting to users. Answers contained citations like 【3:0†source】 and 【message_idx:search_0†source】, and had improper spacing before periods (e.g., "dataset ." instead of "dataset.").

Problem

The main question processing workflows were using simple .strip() to clean answers instead of leveraging the existing comprehensive citation cleaning functionality:

# Before - only basic whitespace trimming
clean_answer = candidate_answer.strip()

Solution

Updated both workflow functions to use the existing extract_links_and_clean function that properly handles:

  • Citation removal: 【3:0†source】, 【message_idx:search_0†source】, [1], (2), etc.
  • Space-before-period fixes: "dataset .""dataset."
  • URL extraction and markdown formatting cleanup
  • Content preservation
# After - comprehensive citation and formatting cleanup
clean_answer, extracted_urls = self.extract_links_and_clean(candidate_answer)

Changes Made

  • _execute_workflow (line 655): Replace basic strip with citation cleaning
  • process_question_with_agents (line 1571): Same change for Excel processing workflow

Verification

  • ✅ Citations like 【3:0†source】 and 【message_idx:search_0†source】 are properly removed
  • ✅ Space-before-period issues are fixed: "distances .""distances."
  • ✅ Content and formatting are preserved
  • ✅ Works in both CLI and GUI modes
  • ✅ Excel processing workflow also benefits from the fix
  • ✅ All existing tests pass (15/15)

The fix leverages existing, well-tested functionality rather than adding new code, ensuring consistency and maintainability.

Fixes #2.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: mcasalaina <1323111+mcasalaina@users.noreply.github.com>
Copilot AI changed the title [WIP] Clean Question Answerer responses to remove citations Clean Question Answerer responses to remove citations and fix spacing Sep 12, 2025
Copilot AI requested a review from mcasalaina September 12, 2025 21:52
@mcasalaina mcasalaina marked this pull request as ready for review September 18, 2025 14:26
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.

Clean Question Answerer responses to remove citations

2 participants