MCPcopy
hub / github.com/Aider-AI/aider / show_send_output

Method show_send_output

aider/coders/base_coder.py:1836–1898  ·  view source on GitHub ↗
(self, completion)

Source from the content-addressed store, hash-verified

1834 self.io.ai_output(json.dumps(args, indent=4))
1835
1836 def show_send_output(self, completion):
1837 # Stop spinner once we have a response
1838 self._stop_waiting_spinner()
1839
1840 if self.verbose:
1841 print(completion)
1842
1843 if not completion.choices:
1844 self.io.tool_error(str(completion))
1845 return
1846
1847 show_func_err = None
1848 show_content_err = None
1849 try:
1850 if completion.choices[0].message.tool_calls:
1851 self.partial_response_function_call = (
1852 completion.choices[0].message.tool_calls[0].function
1853 )
1854 except AttributeError as func_err:
1855 show_func_err = func_err
1856
1857 try:
1858 reasoning_content = completion.choices[0].message.reasoning_content
1859 except AttributeError:
1860 try:
1861 reasoning_content = completion.choices[0].message.reasoning
1862 except AttributeError:
1863 reasoning_content = None
1864
1865 try:
1866 self.partial_response_content = completion.choices[0].message.content or ""
1867 except AttributeError as content_err:
1868 show_content_err = content_err
1869
1870 resp_hash = dict(
1871 function_call=str(self.partial_response_function_call),
1872 content=self.partial_response_content,
1873 )
1874 resp_hash = hashlib.sha1(json.dumps(resp_hash, sort_keys=True).encode())
1875 self.chat_completion_response_hashes.append(resp_hash.hexdigest())
1876
1877 if show_func_err and show_content_err:
1878 self.io.tool_error(show_func_err)
1879 self.io.tool_error(show_content_err)
1880 raise Exception("No data found in LLM response!")
1881
1882 show_resp = self.render_incremental_response(True)
1883
1884 if reasoning_content:
1885 formatted_reasoning = format_reasoning_content(
1886 reasoning_content, self.reasoning_tag_name
1887 )
1888 show_resp = formatted_reasoning + show_resp
1889
1890 show_resp = replace_reasoning_tags(show_resp, self.reasoning_tag_name)
1891
1892 self.io.assistant_output(show_resp, pretty=self.show_pretty())
1893

Callers 1

sendMethod · 0.95

Calls 8

_stop_waiting_spinnerMethod · 0.95
show_prettyMethod · 0.95
format_reasoning_contentFunction · 0.90
replace_reasoning_tagsFunction · 0.90
FinishReasonLengthClass · 0.85
assistant_outputMethod · 0.80
tool_errorMethod · 0.45

Tested by

no test coverage detected