fix: prompt optimizations

This commit is contained in:
Florian Hönicke
2023-04-17 11:23:13 +02:00
parent bf2cd9edc7
commit badf295f71
7 changed files with 146 additions and 132 deletions

View File

@@ -248,6 +248,13 @@ def update_client_line_in_file(file_path, host):
file.write(replaced_content)
def remove_after_stderr(relevant_lines):
for index, line in enumerate(relevant_lines):
if '--- Captured stderr call ----' in line:
return relevant_lines[:index]
return relevant_lines
def process_error_message(error_message):
lines = error_message.split('\n')
@@ -263,6 +270,8 @@ def process_error_message(error_message):
if last_matching_line_index is not None:
relevant_lines = lines[last_matching_line_index:]
relevant_lines = remove_after_stderr(relevant_lines)
response = '\n'.join(relevant_lines[-25:]).strip()
# the following code tests the case that the docker file is corrupted and can not be parsed