Skip to main content

extract_response_text

Function extract_response_text 

Source
pub fn extract_response_text(response: &Value) -> Option<String>
Expand description

Extract text from various response formats.

Handles three formats:

  1. New array format (VS Code Copilot Chat 0.37+): response is a JSON array of response parts, each with an optional kind field. Markdown content parts have kind: "" (or absent) and a value field containing the text.
  2. Legacy object format: response is {"value": [{"value": "text"}, ...]}.
  3. Simple formats: response has "text" or "content" string fields.