refac: apps/openai/main.py and utils

This commit is contained in:
Michael Poluektov
2024-08-03 14:24:26 +01:00
parent 774defd184
commit 12c21fac22
8 changed files with 148 additions and 230 deletions

View File

@@ -6,7 +6,7 @@ from typing import Optional
def prompt_template(
template: str, user_name: str = None, user_location: str = None
template: str, user_name: Optional[str] = None, user_location: Optional[str] = None
) -> str:
# Get the current date
current_date = datetime.now()
@@ -83,7 +83,6 @@ def title_generation_template(
def search_query_generation_template(
template: str, prompt: str, user: Optional[dict] = None
) -> str:
def replacement_function(match):
full_match = match.group(0)
start_length = match.group(1)