Merge branch 'main' of https://gitea.o2o.kr/castad/o2o-castad-backend into feature-dashboard
This commit is contained in:
commit
d955ac80f1
23 files changed
+1885
-1349
No files matched your search
@@ -40,11 +40,13 @@ class Prompt():
|
||||
def _reload_prompt(self):
|
||||
self.prompt_template, self.prompt_model = self._read_from_sheets()
|
||||
|
||||
def build_prompt(self, input_data: dict) -> str:
|
||||
def build_prompt(self, input_data:dict, silent:bool = False) -> str:
|
||||
verified_input = self.prompt_input_class(**input_data)
|
||||
build_template = self.prompt_template.format(**verified_input.model_dump())
|
||||
logger.debug(f"build_template: {build_template}")
|
||||
logger.debug(f"input_data: {input_data}")
|
||||
build_template = self.prompt_template
|
||||
build_template = build_template.format(**verified_input.model_dump())
|
||||
if not silent:
|
||||
logger.debug(f"build_template: {build_template}")
|
||||
logger.debug(f"input_data: {input_data}")
|
||||
return build_template
|
||||
|
||||
marketing_prompt = Prompt(
|
||||
@@ -65,6 +67,20 @@ yt_upload_prompt = Prompt(
|
||||
prompt_output_class=YTUploadPromptOutput,
|
||||
)
|
||||
|
||||
image_autotag_prompt = Prompt(
|
||||
prompt_template_path=os.path.join(prompt_settings.PROMPT_FOLDER_ROOT, prompt_settings.IMAGE_TAG_PROMPT_FILE_NAME),
|
||||
prompt_input_class = ImageTagPromptInput,
|
||||
prompt_output_class = ImageTagPromptOutput,
|
||||
prompt_model = prompt_settings.IMAGE_TAG_PROMPT_MODEL
|
||||
)
|
||||
|
||||
image_autotag_prompt = Prompt(
|
||||
prompt_template_path=os.path.join(prompt_settings.PROMPT_FOLDER_ROOT, prompt_settings.IMAGE_TAG_PROMPT_FILE_NAME),
|
||||
prompt_input_class = ImageTagPromptInput,
|
||||
prompt_output_class = ImageTagPromptOutput,
|
||||
prompt_model = prompt_settings.IMAGE_TAG_PROMPT_MODEL
|
||||
)
|
||||
|
||||
@lru_cache()
|
||||
def create_dynamic_subtitle_prompt(length: int) -> Prompt:
|
||||
return Prompt(
|
||||
@@ -77,4 +93,5 @@ def create_dynamic_subtitle_prompt(length: int) -> Prompt:
|
||||
def reload_all_prompt():
|
||||
marketing_prompt._reload_prompt()
|
||||
lyric_prompt._reload_prompt()
|
||||
yt_upload_prompt._reload_prompt()
|
||||
yt_upload_prompt._reload_prompt()
|
||||
image_autotag_prompt._reload_prompt()
|
||||
Reference in new issue
Block a user