From 5a859e0cbbac80e19856bb4ff7c48375734866e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Wed, 3 May 2023 22:24:22 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AD=90=20fix:=20content=20extraction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- src/options/generate/generator.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5b04cf8..a4ffffb 100644 --- a/README.md +++ b/README.md @@ -62,10 +62,10 @@ gptdeploy generate \ --path ``` To generate your personal microservice two things are required: -- A `description` of the task you want to accomplish. +- A `description` of the task you want to accomplish. (optional) - The `model` you want to use - either `gpt-3.5` or `gpt-4`. `gpt-3.5` is ~10x cheaper, -but will not be able to generate as complex microservices. -- A `path` on the local drive where the microservice will be generated. +but will not be able to generate as complex microservices. (default: largest you have access to) +- A `path` on the local drive where the microservice will be generated. (default: ./microservice) The creation process should take between 5 and 15 minutes. During this time, GPT iteratively builds your microservice until it finds a strategy that make your test scenario pass. diff --git a/src/options/generate/generator.py b/src/options/generate/generator.py index d293079..5df2921 100644 --- a/src/options/generate/generator.py +++ b/src/options/generate/generator.py @@ -46,7 +46,7 @@ class Generator: def extract_content_from_result(self, plain_text, file_name, match_single_block=False, can_contain_code_block=True): optional_line_break = '\n' if can_contain_code_block else '' # the \n at the end makes sure that ``` within the generated code is not matched because it is not right before a line break - pattern = fr"\*?\*?{file_name}\*?\*?\n```(?:\w+\n)?([\s\S]*?){optional_line_break}```" + pattern = fr"(?:\*|\*\*| ){file_name}\*?\*?\n```(?:\w+\n)?([\s\S]*?){optional_line_break}```" matches = re.findall(pattern, plain_text, re.MULTILINE) if matches: return matches[-1].strip()