mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
[Refactor]: Update resolver instructions (#8601)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
@@ -143,7 +143,12 @@ class IssueResolver:
|
||||
os.path.dirname(__file__), 'prompts/resolve/basic-followup.jinja'
|
||||
)
|
||||
with open(prompt_file, 'r') as f:
|
||||
prompt_template = f.read()
|
||||
user_instructions_prompt_template = f.read()
|
||||
|
||||
with open(
|
||||
prompt_file.replace('.jinja', '-conversation-instructions.jinja')
|
||||
) as f:
|
||||
conversation_instructions_prompt_template = f.read()
|
||||
|
||||
base_domain = args.base_domain
|
||||
if base_domain is None:
|
||||
@@ -157,7 +162,10 @@ class IssueResolver:
|
||||
self.max_iterations = args.max_iterations
|
||||
self.output_dir = args.output_dir
|
||||
self.llm_config = llm_config
|
||||
self.prompt_template = prompt_template
|
||||
self.user_instructions_prompt_template = user_instructions_prompt_template
|
||||
self.conversation_instructions_prompt_template = (
|
||||
conversation_instructions_prompt_template
|
||||
)
|
||||
self.issue_type = issue_type
|
||||
self.repo_instruction = repo_instruction
|
||||
self.issue_number = args.issue_number
|
||||
@@ -394,8 +402,13 @@ class IssueResolver:
|
||||
|
||||
self.initialize_runtime(runtime)
|
||||
|
||||
instruction, images_urls = issue_handler.get_instruction(
|
||||
issue, self.prompt_template, self.repo_instruction
|
||||
instruction, conversation_instructions, images_urls = (
|
||||
issue_handler.get_instruction(
|
||||
issue,
|
||||
self.user_instructions_prompt_template,
|
||||
self.conversation_instructions_prompt_template,
|
||||
self.repo_instruction,
|
||||
)
|
||||
)
|
||||
# Here's how you can run the agent (similar to the `main` function) and get the final task state
|
||||
action = MessageAction(content=instruction, image_urls=images_urls)
|
||||
@@ -405,6 +418,7 @@ class IssueResolver:
|
||||
initial_user_action=action,
|
||||
runtime=runtime,
|
||||
fake_user_response_fn=codeact_user_response,
|
||||
conversation_instructions=conversation_instructions,
|
||||
)
|
||||
if state is None:
|
||||
raise RuntimeError('Failed to run the agent.')
|
||||
|
||||
Reference in New Issue
Block a user