from config import Config def get_prompt(name: str, type: str, params: dict = {}): sys_params = { "bot_name": Config.get("chatcomplete.bot_name", "ChatGPT"), } prompts = Config.get("chatcomplete.prompts") if name in prompts and type in prompts[name]: prompt: str = prompts[name][type] for key in sys_params: prompt = prompt.replace("{" + key + "}", sys_params[key]) for key in params: prompt = prompt.replace("{" + key + "}", params[key]) return prompt else: return None