summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-29 13:33:53 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-29 13:33:53 -0700
commit17566c66e0a01ad3c38ece974e44c1c71a9188de (patch)
treec7144ef7ac6cd1106841ef45a37c659c35135dd7
parent3aa615a6c3243ecdd0334b94625b3d621b5d122b (diff)
downloadsncontinue-17566c66e0a01ad3c38ece974e44c1c71a9188de.tar.gz
sncontinue-17566c66e0a01ad3c38ece974e44c1c71a9188de.tar.bz2
sncontinue-17566c66e0a01ad3c38ece974e44c1c71a9188de.zip
docs: :memo: use hardcoded help info if no user_input
-rw-r--r--continuedev/src/continuedev/plugins/steps/help.py48
1 files changed, 25 insertions, 23 deletions
diff --git a/continuedev/src/continuedev/plugins/steps/help.py b/continuedev/src/continuedev/plugins/steps/help.py
index fef7f8e4..6997a547 100644
--- a/continuedev/src/continuedev/plugins/steps/help.py
+++ b/continuedev/src/continuedev/plugins/steps/help.py
@@ -34,31 +34,33 @@ class HelpStep(Step):
description: str = ""
async def run(self, sdk: ContinueSDK):
-
question = self.user_input
- prompt = dedent(f"""
- Information:
-
- {help}
-
- Instructions:
-
- Please us the information below to provide a succinct answer to the following question: {question}
-
- Do not cite any slash commands other than those you've been told about, which are: /edit and /feedback.""")
-
- self.chat_context.append(ChatMessage(
- role="user",
- content=prompt,
- summary="Help"
- ))
- messages = await sdk.get_chat_context()
- generator = sdk.models.gpt4.stream_chat(messages)
- async for chunk in generator:
- if "content" in chunk:
- self.description += chunk["content"]
- await sdk.update_ui()
+ if question.strip() == "":
+ self.description = help
+ else:
+ prompt = dedent(f"""
+ Information:
+
+ {help}
+
+ Instructions:
+
+ Please us the information below to provide a succinct answer to the following question: {question}
+
+ Do not cite any slash commands other than those you've been told about, which are: /edit and /feedback.""")
+
+ self.chat_context.append(ChatMessage(
+ role="user",
+ content=prompt,
+ summary="Help"
+ ))
+ messages = await sdk.get_chat_context()
+ generator = sdk.models.gpt4.stream_chat(messages)
+ async for chunk in generator:
+ if "content" in chunk:
+ self.description += chunk["content"]
+ await sdk.update_ui()
posthog_logger.capture_event(
"help", {"question": question, "answer": self.description})