Skip to content

Commit

Permalink
add flag to remove only annoyances but not separators
Browse files Browse the repository at this point in the history
  • Loading branch information
gptlang committed Feb 4, 2024
1 parent 8338ee2 commit f8ec3fe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions rplugin/python3/handlers/chat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()')

Expand All @@ -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

Expand Down Expand Up @@ -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"))

0 comments on commit f8ec3fe

Please sign in to comment.