fix: improve changelog update prompt and response handling

This commit is contained in:
mrT23
2024-12-23 17:06:21 +02:00
parent 20c506d2e0
commit 3360a28b3e
3 changed files with 18 additions and 5 deletions

View File

@ -108,6 +108,13 @@ class PRUpdateChangelog:
response, finish_reason = await self.ai_handler.chat_completion(
model=model, system=system_prompt, user=user_prompt, temperature=get_settings().config.temperature)
# post-process the response
response = response.strip()
if response.startswith("```"):
response_lines = response.splitlines()
response_lines = response_lines[1:]
response = "\n".join(response_lines)
response = response.strip("`")
return response
def _prepare_changelog_update(self) -> Tuple[str, str]: