diff --git a/rplugin/python3/handlers/chat_handler.py b/rplugin/python3/handlers/chat_handler.py index db49c638..b87d4fe3 100644 --- a/rplugin/python3/handlers/chat_handler.py +++ b/rplugin/python3/handlers/chat_handler.py @@ -37,9 +37,6 @@ def chat( ): if system_prompt is None: system_prompt = self._construct_system_prompt(prompt) - if self.nvim.eval("g:copilot_chat_disable_separators") == "yes": - disable_start_separator = True - disable_end_separator = True # Start the spinner self.nvim.exec_lua('require("CopilotChat.spinner").show()') @@ -56,7 +53,9 @@ def chat( self.nvim.exec_lua('require("CopilotChat.spinner").hide()') if not disable_end_separator: - self._add_end_separator(model) + self._add_end_separator( + model, self.nvim.eval("g:copilot_chat_disable_separators") == "yes" + ) # private @@ -224,13 +223,17 @@ def _add_chat_messages( token.split("\n"), ) - def _add_end_separator(self, model: str): + def _add_end_separator(self, model: str, no_annoyance: bool = False): current_datetime = datetime.now().strftime("%Y-%m-%d %H:%M:%S") model_info = f"\n#### Answer provided by Copilot (Model: `{model}`) on {current_datetime}." additional_instructions = ( "\n> For additional queries, please use the `CopilotChat` command." ) - disclaimer = "\n> Please be aware that the AI's output may not always be accurate. Always cross-verify the output.\n---\n" + disclaimer = "\n> Please be aware that the AI's output may not always be accurate. Always cross-verify the output." end_message = model_info + additional_instructions + disclaimer + + if no_annoyance: + end_message = current_datetime + "\n---\n" + self.buffer.append(end_message.split("\n"))