gpt3 format emo colors

This commit is contained in:
.[d]. 2022-06-26 11:01:23 +00:00
parent 6ec52bc520
commit 1681d7b6bd

@ -16,8 +16,8 @@ OPENAPI_KEY = os.environ['OPENAPI_KEY']
###########################################################################################
DREY="\x02\x0315"
GREY="\x02\x0314"
DRED="\x02\x0304"
LRED="\x02\x0305"
DRED="\x02\x0302"
LRED="\x02\x0312"
###########################################################################################
class OPENAI_MESSAGE_HISTORY():
#######################################################################################
@ -206,7 +206,7 @@ class Plugin:
self.top_p=self.random_float(10)
self.frequency_penalty=self.random_float(10000)
self.presence_penalty=self.random_float(20)
self.bot.privmsg(target, f"{GREY}<<< {DRED}randomizing personality properties {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}randomizing personality properties {GREY}>>>"))
self.print_response_properties(target)
#######################################################################################
def default_load(self):
@ -222,7 +222,7 @@ class Plugin:
"""OpenAi Read Current Personality
%%airead
"""
self.bot.privmsg(target, f"{GREY}<<< {DRED}reading current personality profile {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}reading current personality profile {GREY}>>>"))
if self.start_chat_log==None:
self.bot.privmsg(target,"<NULL>")
else:
@ -236,7 +236,7 @@ class Plugin:
"""OpenAi Show Current Personality Properties and Values.
%%aishow
"""
self.bot.privmsg(target, f"{GREY}<<< {DRED}showing current personality properties {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}showing current personality properties {GREY}>>>"))
self.print_response_properties(target)
#######################################################################################
@command(permission='view')
@ -244,7 +244,7 @@ class Plugin:
"""OpenAi Show Last Term.
%%aiterm
"""
self.bot.privmsg(target, f'{GREY}<<< {DRED}showing last term query {GREY}>>>')
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}showing last term query {GREY}>>>'))
for _ in self.lastterm.splitlines():
msg = re.findall(r'.{1,400}(?:\s+|$)', _)
for __ in msg:
@ -255,7 +255,7 @@ class Plugin:
"""OpenAi Show Last Server Response.
%%airesponse
"""
self.bot.privmsg(target, f'{GREY}<<< {DRED}showing last openai server response {GREY}>>>')
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}showing last openai server response {GREY}>>>'))
msg=[]
FINISH_REASON=self.lastresponse['choices'][0]['finish_reason']
INDEX=self.lastresponse['choices'][0]['index']
@ -295,7 +295,7 @@ class Plugin:
"""
PATH='%s/../personalities' % dir_path
FILES=glob(f'{PATH}/*.db')
self.bot.privmsg(target, f"{GREY}<<< {DRED}listing personality databases {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}listing personality databases {GREY}>>>"))
for i,_ in enumerate(FILES):
FILE=_.split('/')[-1].replace('.db','')
self.bot.privmsg(target, f'{DRED}{i}{GREY}: {LRED}{FILE}')
@ -309,7 +309,7 @@ class Plugin:
try:
i=int(msg)
except:
self.bot.privmsg(target, f'{GREY}<<< {DRED}error{GREY}: {LRED}not an integer, use only numbers of the personality databases {GREY}>>>')
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}error{GREY}: {LRED}not an integer, use only numbers of the personality databases {GREY}>>>'))
return
PATH='%s/../personalities' % dir_path
FILES=glob(f'{PATH}/*.db')
@ -321,9 +321,9 @@ class Plugin:
if self.start_chat_log.find('\n')==0:
self.start_chat_log=self.start_chat_log[1:]
FILE=FILES[i].split('/')[-1].replace('.db', '')
self.bot.privmsg(target, f'{GREY}<<< {DRED}loaded {FILE} personality database {GREY}>>>')
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}loaded {FILE} personality database {GREY}>>>'))
except:
self.bot.privmsg(target, f'{GREY}<<< {DRED}error{GREY}: {LRED}could not load this personality database, maybe invalid index number {GREY}>>>')
self.bot.privmsg(target, self.bot.emo(f'{GREY}<<< {DRED}error{GREY}: {LRED}could not load this personality database, maybe invalid index number {GREY}>>>'))
return
#######################################################################################
@command(permission='view')
@ -338,12 +338,12 @@ class Plugin:
PATH='%s/../personalities' % dir_path
FILE=f'{PATH}/{msg}.db'
if os.path.exists(FILE):
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}personality database already exists, choose a different filename {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}personality database already exists, choose a different filename {GREY}>>>"))
return
f=open(FILE, "a")
f.write(f'{self.start_chat_log}\n')
f.close()
self.bot.privmsg(target, f"{GREY}<<< {DRED}created {msg} personality database {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}created {msg} personality database {GREY}>>>"))
#######################################################################################
@command(permission='view')
def aitrain(self, mask, target, args):
@ -358,7 +358,7 @@ class Plugin:
f.write(f'{term}\n')
f.close()
self.start_chat_log=f'{self.start_chat_log}\n{term}'
self.bot.privmsg(target, f"{GREY}<<< {DRED}trained {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}trained {GREY}>>>"))
#######################################################################################
@command(permission='view')
def aidefault(self, mask, target, args):
@ -371,7 +371,7 @@ class Plugin:
self.top_p=1.0
self.frequency_penalty=0.0
self.presence_penalty=0.0
self.bot.privmsg(target, f"{GREY}<<< {DRED}setting personality and properties to defaults {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}setting personality and properties to defaults {GREY}>>>"))
self.print_response_properties(target)
#######################################################################################
@command(permission='view')
@ -389,7 +389,7 @@ class Plugin:
prop=msg.split()[0].lower()
val=msg.split()[1].lower()
except:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}not enough parameters {GREY}- {DRED}property choices{GREY}: {LRED}{PROPERTIES} {GREY}- {DRED}model choices{GREY}: {LRED}{MODELS} {GREY}- {DRED}usage examples{GREY}: {LRED}?aiset model text-davinci-002, ?aiset max_tokens 2000, ?aiset model text-davinci-002, ?aiset temperature 0.7, ?aiset top_p 1.0, ?aiset frequency_penalty 0.0, ?aiset presence_penalty 0.0 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}not enough parameters {GREY}- {DRED}property choices{GREY}: {LRED}{PROPERTIES} {GREY}- {DRED}model choices{GREY}: {LRED}{MODELS} {GREY}- {DRED}usage examples{GREY}: {LRED}?aiset model text-davinci-002, ?aiset max_tokens 2000, ?aiset model text-davinci-002, ?aiset temperature 0.7, ?aiset top_p 1.0, ?aiset frequency_penalty 0.0, ?aiset presence_penalty 0.0 {GREY}>>>"))
return
if prop in PROPERTIES:
if prop == "model":
@ -401,61 +401,61 @@ class Plugin:
else:
self.max_tokens = 1000
else:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>"))
except:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property model value should be a string {GREY}- {DRED}choice of models{GREY}: {LRED}{MODELS} {GREY}- {DRED}example{GREY}: {LRED}?aiset model text-davinci-002 {GREY}>>>"))
return
elif prop == "temperature":
try:
if float(val) <= 2 and float(val) >= 0:
self.temperature=float(val)
except:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}property temperature value should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset temperature 0.7 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property temperature value should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset temperature 0.7 {GREY}>>>"))
return
elif prop == "max_tokens":
try:
if int(val) <= 2000 and int(val) >= 100:
self.max_tokens=int(val)
except:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}property max_tokens value should be an integer not greater than 2000 {GREY}- {DRED}example{GREY}: {LRED}?aiset max_tokens 2000 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property max_tokens value should be an integer not greater than 2000 {GREY}- {DRED}example{GREY}: {LRED}?aiset max_tokens 2000 {GREY}>>>"))
return
elif prop == "top_p":
try:
if float(val) <= 1.0 and float(val) >= 0.0:
self.top_p=float(val)
else:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>"))
return
except:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: property model should be a float no greater than 1.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset top_p 0.7 {GREY}>>>"))
return
elif prop == "frequency_penalty":
try:
if float(val):
self.frequency_penalty=float(val)
except:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}property frequency_penalty should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset frequency_penalty 0.0 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property frequency_penalty should be a float {GREY}- {DRED}example{GREY}: {LRED}?aiset frequency_penalty 0.0 {GREY}>>>"))
return
elif prop == "presence_penalty":
try:
if float(val) <= 2.0 and float(val) >= 0.0:
self.presence_penalty=float(val)
else:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>"))
return
except:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}property presence_penalty should be a float no greater than 2.0 {GREY}- {DRED}example{GREY}: {LRED}?aiset presence_penalty 0.0 {GREY}>>>"))
return
else:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>"))
self.print_response_properties(target)
return
else:
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}used an invalid property identifier {GREY}- {DRED}property identifiers are {LRED}{PROPERTIES} {GREY}>>>")
self.bot.privmsg(target, f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}used an invalid property identifier {GREY}- {DRED}property identifiers are {LRED}{PROPERTIES} {GREY}>>>"))
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}error{GREY}: {LRED}no properties were set, they remain the same {GREY}>>>"))
self.print_response_properties(target)
return
self.bot.privmsg(target, f"{GREY}<<< {DRED}{prop} property set to the value {val} {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}{prop} property set to the value {val} {GREY}>>>"))
self.print_response_properties(target)
#######################################################################################
@command(permission='view')
@ -468,7 +468,7 @@ class Plugin:
f.write("")
f.close()
self.start_chat_log = ""
self.bot.privmsg(target, f"{GREY}<<< {DRED}cleared {GREY}>>>")
self.bot.privmsg(target, self.bot.emo(f"{GREY}<<< {DRED}cleared {GREY}>>>"))
#######################################################################################
###########################################################################################
###########################################################################################
###########################################################################################