多轮对话

This commit is contained in:
tuyang.yhj 2023-05-14 21:10:08 +08:00
parent 8721ea12c1
commit fee5e769e7
2 changed files with 11 additions and 8 deletions

View File

@ -51,7 +51,6 @@ class AutoModePrompt:
"""
prompt_start = (
"Based on the above definition, answer the current goal and ensure that the response meets both the current constraints and the above definition and constraints"
)
if prompt_generator is None:
prompt_generator = build_default_prompt_generator()
@ -65,7 +64,7 @@ class AutoModePrompt:
prompt_generator = plugin.post_prompt(prompt_generator)
full_prompt = f"{prompt_start}\n\nNEW GOALS:\n\n"
full_prompt = f"{prompt_start}\n\nGOALS:\n\n"
if not self.ai_goals :
self.ai_goals = user_input
for i, goal in enumerate(self.ai_goals):
@ -75,9 +74,9 @@ class AutoModePrompt:
# else:
# full_prompt += f"{last_auto_return}\n\n"
full_prompt += f"New Constraints:\n{DEFAULT_TRIGGERING_PROMPT}\n\n"
full_prompt += f"Constraints:\n\n{DEFAULT_TRIGGERING_PROMPT}\n"
full_prompt += "GENERATE NEXT COMMAND JSON, And ensure that JSON is correctly loadable by Python"
full_prompt += """Based on the above definition, answer the current goal and ensure that the response meets both the current constraints and the above definition and constraints"""
self.prompt_generator = prompt_generator
return full_prompt

View File

@ -6,7 +6,7 @@ from pilot.prompts.generator import PromptGenerator
CFG = Config()
DEFAULT_TRIGGERING_PROMPT = (
"Determine which next command to use, and respond using the format specified above:"
"Determine which next command to use, and respond using the format specified above"
)
@ -27,11 +27,15 @@ def build_default_prompt_generator() -> PromptGenerator:
# "~4000 word limit for short term memory. Your short term memory is short, so"
# " immediately save important information to files."
# )
# prompt_generator.add_constraint(
# "If you are unsure how you previously did something or want to recall past"
# " events, thinking about similar events will help you remember."
# )
# prompt_generator.add_constraint("No user assistance")
prompt_generator.add_constraint(
"If you are unsure how you previously did something or want to recall past"
" events, thinking about similar events will help you remember."
'Only output one correct JSON response at a time'
)
prompt_generator.add_constraint("No user assistance")
prompt_generator.add_constraint(
'Exclusively use the commands listed in double quotes e.g. "command name"'
)