diff --git a/README.md b/README.md index 7b8497061..24df917f9 100644 --- a/README.md +++ b/README.md @@ -44,16 +44,6 @@ --- -
- -GPT Pilot is the core technology for the [Pythagora VS Code extension](https://bit.ly/3IeZxp6) that aims to provide **the first real AI developer companion**. Not just an autocomplete or a helper for PR messages but rather a real AI developer that can write full features, debug them, talk to you about issues, ask for review, etc. - ---- - 📫 If you would like to get updates on future releases or just get in touch, join our [Discord server](https://discord.gg/HaqXugmxr9) or you [can add your email here](http://eepurl.com/iD6Mpo). 📬 --- @@ -97,9 +87,6 @@ If you are interested in our learnings during this project, you can check [our l - **Python 3.9+** # 🚦How to start using gpt-pilot? -👉 If you are using VS Code as your IDE, the easiest way to start is by downloading [GPT Pilot VS Code extension](https://bit.ly/3IeZxp6). 👈 - -Otherwise, you can use the CLI tool. ### If you're new to GPT Pilot: diff --git a/core/llm/parser.py b/core/llm/parser.py index 8cd026366..a41f88e0d 100644 --- a/core/llm/parser.py +++ b/core/llm/parser.py @@ -69,17 +69,16 @@ def __call__(self, text: str) -> str: return blocks[0] -class OptionalCodeBlockParser: +class OptionalCodeBlockParser(MultiCodeBlockParser): def __call__(self, text: str) -> str: - text = text.strip() - if text.startswith("```") and text.endswith("\n```"): - # Remove the first and last line. Note the first line may include syntax - # highlighting, so we can't just remove the first 3 characters. - text = "\n".join(text.splitlines()[1:-1]).strip() - elif "\n" not in text and text.startswith("`") and text.endswith("`"): - # Single-line code blocks are wrapped in single backticks - text = text[1:-1] - return text + blocks = super().__call__(text) + # FIXME: if there are more than 1 code block, this means the output actually contains ```, + # so re-parse this with that in mind + if len(blocks) > 1: + raise ValueError(f"Expected a single code block, got {len(blocks)}") + if len(blocks) == 0: + return text.strip() + return blocks[0] class JSONParser: