33from pytgpt .base import Provider
44from pytgpt .utils import Conversation
55from pytgpt .utils import Optimizers
6+ from pytgpt .utils import AwesomePrompts
67
78default_model = "text-davinci-002-render-sha"
89
@@ -16,6 +17,8 @@ def __init__(
1617 timeout : int = 30 ,
1718 filepath : str = None ,
1819 update_file : str = True ,
20+ intro : str = None ,
21+ act : str = None ,
1922 ):
2023 """Initializes WEBCHATGPT
2124
@@ -26,10 +29,9 @@ def __init__(
2629 timeout (int, optional): Http request timeout. Defaults to 30.
2730 filepath (str, optional): Path to save the chat history. Defaults to None.
2831 update_file (str, optional): Flag for controlling chat history updates. Defaults to True.
32+ intro (str, optional): Conversation introductory prompt. Defaults to None.
33+ act (str|int, optional): Awesome prompt key or index. (Used as intro). Defaults to None.
2934 """
30- self .conversation = Conversation (
31- status = False , filepath = filepath , update_file = update_file
32- )
3335 self .session = ChatGPT (cookie_path = cookie_file , model = model , timeout = timeout )
3436 self .session .session .proxies = proxy
3537 self .last_response = {}
@@ -38,6 +40,16 @@ def __init__(
3840 for method in dir (Optimizers )
3941 if callable (getattr (Optimizers , method )) and not method .startswith ("__" )
4042 )
43+ Conversation .intro = (
44+ AwesomePrompts ().get_act (
45+ act , raise_not_found = True , default = None , case_insensitive = True
46+ )
47+ if act
48+ else intro or Conversation .intro
49+ )
50+ self .conversation = Conversation (
51+ status = False , filepath = filepath , update_file = update_file
52+ )
4153
4254 def ask (
4355 self ,
0 commit comments