@@ -26,10 +26,11 @@ def __init__(self, bot):
2626 presence_penalty="Number between -2.0 and 2.0. Positive values will encourage new topics: Min=-2 Max=2 Default={pres_default}",
2727 frequency_penalty="Number between -2.0 and 2.0. Positive values will encourage new words: Min=-2 Max=2 Default={freq_default}",
2828 max_tokens="The max number of tokens to generate. Each token costs credits: Default={max_tokens_default}",
29- stop="Whether to stop after the first sentence: Default={stop_default}")
29+ stop="Whether to stop after the first sentence: Default={stop_default}",
30+ bold="Whether to bolden the original prompt: Default={bold_default}")
3031 async def customai(self, context: Context, prompt: str = "", temp: float = {temp_default},
3132 presence_penalty: float = {pres_default}, frequency_penalty: float = {freq_default}, max_tokens: int = {max_tokens_default},
32- stop: bool = {stop_default}):
33+ stop: bool = {stop_default}, bold: bool = {bold_default} ):
3334 temp = min(max(temp, 0), 1)
3435 presPen = min(max(presence_penalty, -2), 2)
3536 freqPen = min(max(frequency_penalty, -2), 2)
@@ -47,7 +48,7 @@ async def customai(self, context: Context, prompt: str = "", temp: float = {temp
4748 echo=False,
4849 stop='.' if stop else None,
4950 )
50- await context.send(f"{{'**' if { bold} else ''}}{{prompt}}{{'**' if { bold} else ''}}{{response[\' choices\' ][0][\' text\' ][:2000]}}")
51+ await context.send(f"{{'**' if bold and prompt else ''}}{{prompt}}{{'**' if bold and prompt else ''}}{{response[\' choices\' ][0][\' text\' ][:2000]}}")
5152 except Exception as error:
5253 print({error})
5354 await context.send(
@@ -63,7 +64,7 @@ async def setup(bot):
6364
6465
6566def gen_new_command (model_id : str , command_name : str , temp_default : float , pres_default : float , freq_default : float ,
66- max_tokens_default : int , stop_default : bool , openai_key : str , bold_prompt : bool ):
67+ max_tokens_default : int , stop_default : bool , openai_key : str , bold_default : bool ):
6768 if getattr (sys , 'frozen' , False ):
6869 # The code is being run as a frozen executable
6970 data_dir = pathlib .Path (appdirs .user_data_dir (appname = "discordai" ))
@@ -84,7 +85,7 @@ def gen_new_command(model_id: str, command_name: str, temp_default: float, pres_
8485 command_name = command_name , temp_default = float (temp_default ),
8586 pres_default = float (pres_default ),
8687 freq_default = float (freq_default ),
87- max_tokens_default = max_tokens_default , stop_default = stop_default , openai_key = openai_key , bold = bold_prompt ,
88+ max_tokens_default = max_tokens_default , stop_default = stop_default , openai_key = openai_key , bold_default = bold_default ,
8889 error = "f\" Failed to generate valid response for prompt: {prompt}\\ nError: {error}\" " ))
8990 print (f"Successfully created new slash command: /{ command_name } using model { model_id } " )
9091
0 commit comments