You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
573 B
Python
18 lines
573 B
Python
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 |