Skip to content

Conversation

@jqnatividad
Copy link
Collaborator

also added special handling to run_qsv_cmd to properly handle sample as it expects options before input argument

- --addl-props option to handle more than one property, also remove unwrap
- replace unwrap with if let when checking session state for --prompt
- consolidated JSON extraction and cache handling, removing dupe code
- more consistent error handling across DuckDB and Polars SQL RAG mode
Copy link
Contributor

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 refactors the describegpt command to consolidate JSON response parsing, improve cache handling consistency, and make DuckDB and Polars error handling more uniform. It also adds special handling for the sample command in the run_qsv_cmd utility function.

Key changes include:

  • Consolidation of duplicate JSON extraction logic into a single extract_json_from_output function
  • Introduction of helper functions track_sql_error_in_session, update_session_after_sql_success, and remove_cache_entry_by_key to eliminate code duplication
  • Replacement of unwrap() calls with proper error handling in the --addl-props validation
  • Special handling in run_qsv_cmd to properly order arguments for the sample command

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/util.rs Added special case logic to handle sample command argument ordering in run_qsv_cmd
src/cmd/describegpt.rs Consolidated JSON parsing, refactored cache handling into reusable helper functions, improved error handling consistency between DuckDB and Polars SQL execution paths, replaced unwrap() with proper error handling for --addl-props, and minor documentation alignment fix

@jqnatividad jqnatividad merged commit 85bf23d into master Dec 28, 2025
14 of 15 checks passed
@jqnatividad jqnatividad deleted the describegpt-refactoring branch December 28, 2025 02:43
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.

2 participants