Compare commits

..

2 Commits

Author SHA1 Message Date
73acc92ee4 Bump version: 0.2.4 → 0.2.5 2025-06-27 16:38:35 +01:00
bfbf8d82e0 try cleanup generated prompt if any other text 2025-06-27 16:38:25 +01:00
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "0.2.4"
current_version = "0.2.5"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}"

View File

@ -3,6 +3,7 @@ import logging
import litellm
import nest_asyncio
from libs.generic import load_recent_prompts, load_config
import re
nest_asyncio.apply()
logging.basicConfig(level=logging.INFO)
@ -74,5 +75,10 @@ def create_prompt_on_openwebui(prompt: str, topic: str = "random") -> str:
# api_key=user_config["openwebui"]["api_key"],
# )
# prompt = response["choices"][0]["message"]["content"].strip('"')
match = re.search(r'"([^"]+)"', prompt)
if not match:
match = re.search(r":\s*\n*\s*(.+)", prompt)
if match:
prompt = match.group(1)
logging.debug(prompt)
return prompt.split(": ")[-1]
return prompt