2023-08-22 15:23:27 +03:00
|
|
|
from typing import Optional
|
|
|
|
from uuid import UUID
|
|
|
|
|
|
|
|
from llm.utils.get_prompt_to_use_id import get_prompt_to_use_id
|
2023-11-23 16:13:21 +03:00
|
|
|
from modules.prompt.entity.prompt import Prompt
|
|
|
|
from modules.prompt.service import PromptService
|
|
|
|
|
|
|
|
promptService = PromptService()
|
2023-08-22 15:23:27 +03:00
|
|
|
|
|
|
|
|
|
|
|
def get_prompt_to_use(
|
|
|
|
brain_id: Optional[UUID], prompt_id: Optional[UUID]
|
|
|
|
) -> Optional[Prompt]:
|
|
|
|
prompt_to_use_id = get_prompt_to_use_id(brain_id, prompt_id)
|
|
|
|
if prompt_to_use_id is None:
|
|
|
|
return None
|
|
|
|
|
2023-11-23 16:13:21 +03:00
|
|
|
return promptService.get_prompt_by_id(prompt_to_use_id)
|