gpt3 format emo colors
This commit is contained in:
parent
6ec52bc520
commit
1681d7b6bd
@ -16,8 +16,8 @@ OPENAPI_KEY = os.environ['OPENAPI_KEY']
|
|||||||
###########################################################################################
|
###########################################################################################
|
||||||
DREY="\x02\x0315"
|
DREY="\x02\x0315"
|
||||||
GREY="\x02\x0314"
|
GREY="\x02\x0314"
|
||||||
DRED="\x02\x0304"
|
DRED="\x02\x0302"
|
||||||
LRED="\x02\x0305"
|
LRED="\x02\x0312"
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
class OPENAI_MESSAGE_HISTORY():
|
class OPENAI_MESSAGE_HISTORY():
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
@ -206,7 +206,7 @@ class Plugin:
|
|||||||
self.top_p=self.random_float(10)
|
self.top_p=self.random_float(10)
|
||||||
self.frequency_penalty=self.random_float(10000)
|
self.frequency_penalty=self.random_float(10000)
|
||||||
self.presence_penalty=self.random_float(20)
|
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)
|
self.print_response_properties(target)
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
def default_load(self):
|
def default_load(self):
|
||||||
@ -222,7 +222,7 @@ class Plugin:
|
|||||||
"""OpenAi Read Current Personality
|
"""OpenAi Read Current Personality
|
||||||
%%airead
|
%%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:
|
if self.start_chat_log==None:
|
||||||
self.bot.privmsg(target,"<NULL>")
|
self.bot.privmsg(target,"<NULL>")
|
||||||
else:
|
else:
|
||||||
@ -236,7 +236,7 @@ class Plugin:
|
|||||||
"""OpenAi Show Current Personality Properties and Values.
|
"""OpenAi Show Current Personality Properties and Values.
|
||||||
%%aishow
|
%%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)
|
self.print_response_properties(target)
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
@command(permission='view')
|
@command(permission='view')
|
||||||
@ -244,7 +244,7 @@ class Plugin:
|
|||||||
"""OpenAi Show Last Term.
|
"""OpenAi Show Last Term.
|
||||||
%%aiterm
|
%%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():
|
for _ in self.lastterm.splitlines():
|
||||||
msg = re.findall(r'.{1,400}(?:\s+|$)', _)
|
msg = re.findall(r'.{1,400}(?:\s+|$)', _)
|
||||||
for __ in msg:
|
for __ in msg:
|
||||||
@ -255,7 +255,7 @@ class Plugin:
|
|||||||
"""OpenAi Show Last Server Response.
|
"""OpenAi Show Last Server Response.
|
||||||
%%airesponse
|
%%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=[]
|
msg=[]
|
||||||
FINISH_REASON=self.lastresponse['choices'][0]['finish_reason']
|
FINISH_REASON=self.lastresponse['choices'][0]['finish_reason']
|
||||||
INDEX=self.lastresponse['choices'][0]['index']
|
INDEX=self.lastresponse['choices'][0]['index']
|
||||||
@ -295,7 +295,7 @@ class Plugin:
|
|||||||
"""
|
"""
|
||||||
PATH='%s/../personalities' % dir_path
|
PATH='%s/../personalities' % dir_path
|
||||||
FILES=glob(f'{PATH}/*.db')
|
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):
|
for i,_ in enumerate(FILES):
|
||||||
FILE=_.split('/')[-1].replace('.db','')
|
FILE=_.split('/')[-1].replace('.db','')
|
||||||
self.bot.privmsg(target, f'{DRED}{i}{GREY}: {LRED}{FILE}')
|
self.bot.privmsg(target, f'{DRED}{i}{GREY}: {LRED}{FILE}')
|
||||||
@ -309,7 +309,7 @@ class Plugin:
|
|||||||
try:
|
try:
|
||||||
i=int(msg)
|
i=int(msg)
|
||||||
except:
|
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
|
return
|
||||||
PATH='%s/../personalities' % dir_path
|
PATH='%s/../personalities' % dir_path
|
||||||
FILES=glob(f'{PATH}/*.db')
|
FILES=glob(f'{PATH}/*.db')
|
||||||
@ -321,9 +321,9 @@ class Plugin:
|
|||||||
if self.start_chat_log.find('\n')==0:
|
if self.start_chat_log.find('\n')==0:
|
||||||
self.start_chat_log=self.start_chat_log[1:]
|
self.start_chat_log=self.start_chat_log[1:]
|
||||||
FILE=FILES[i].split('/')[-1].replace('.db', '')
|
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:
|
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
|
return
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
@command(permission='view')
|
@command(permission='view')
|
||||||
@ -338,12 +338,12 @@ class Plugin:
|
|||||||
PATH='%s/../personalities' % dir_path
|
PATH='%s/../personalities' % dir_path
|
||||||
FILE=f'{PATH}/{msg}.db'
|
FILE=f'{PATH}/{msg}.db'
|
||||||
if os.path.exists(FILE):
|
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
|
return
|
||||||
f=open(FILE, "a")
|
f=open(FILE, "a")
|
||||||
f.write(f'{self.start_chat_log}\n')
|
f.write(f'{self.start_chat_log}\n')
|
||||||
f.close()
|
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')
|
@command(permission='view')
|
||||||
def aitrain(self, mask, target, args):
|
def aitrain(self, mask, target, args):
|
||||||
@ -358,7 +358,7 @@ class Plugin:
|
|||||||
f.write(f'{term}\n')
|
f.write(f'{term}\n')
|
||||||
f.close()
|
f.close()
|
||||||
self.start_chat_log=f'{self.start_chat_log}\n{term}'
|
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')
|
@command(permission='view')
|
||||||
def aidefault(self, mask, target, args):
|
def aidefault(self, mask, target, args):
|
||||||
@ -371,7 +371,7 @@ class Plugin:
|
|||||||
self.top_p=1.0
|
self.top_p=1.0
|
||||||
self.frequency_penalty=0.0
|
self.frequency_penalty=0.0
|
||||||
self.presence_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)
|
self.print_response_properties(target)
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
@command(permission='view')
|
@command(permission='view')
|
||||||
@ -389,7 +389,7 @@ class Plugin:
|
|||||||
prop=msg.split()[0].lower()
|
prop=msg.split()[0].lower()
|
||||||
val=msg.split()[1].lower()
|
val=msg.split()[1].lower()
|
||||||
except:
|
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
|
return
|
||||||
if prop in PROPERTIES:
|
if prop in PROPERTIES:
|
||||||
if prop == "model":
|
if prop == "model":
|
||||||
@ -401,61 +401,61 @@ class Plugin:
|
|||||||
else:
|
else:
|
||||||
self.max_tokens = 1000
|
self.max_tokens = 1000
|
||||||
else:
|
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:
|
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
|
return
|
||||||
elif prop == "temperature":
|
elif prop == "temperature":
|
||||||
try:
|
try:
|
||||||
if float(val) <= 2 and float(val) >= 0:
|
if float(val) <= 2 and float(val) >= 0:
|
||||||
self.temperature=float(val)
|
self.temperature=float(val)
|
||||||
except:
|
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
|
return
|
||||||
elif prop == "max_tokens":
|
elif prop == "max_tokens":
|
||||||
try:
|
try:
|
||||||
if int(val) <= 2000 and int(val) >= 100:
|
if int(val) <= 2000 and int(val) >= 100:
|
||||||
self.max_tokens=int(val)
|
self.max_tokens=int(val)
|
||||||
except:
|
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
|
return
|
||||||
elif prop == "top_p":
|
elif prop == "top_p":
|
||||||
try:
|
try:
|
||||||
if float(val) <= 1.0 and float(val) >= 0.0:
|
if float(val) <= 1.0 and float(val) >= 0.0:
|
||||||
self.top_p=float(val)
|
self.top_p=float(val)
|
||||||
else:
|
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
|
return
|
||||||
except:
|
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
|
return
|
||||||
elif prop == "frequency_penalty":
|
elif prop == "frequency_penalty":
|
||||||
try:
|
try:
|
||||||
if float(val):
|
if float(val):
|
||||||
self.frequency_penalty=float(val)
|
self.frequency_penalty=float(val)
|
||||||
except:
|
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
|
return
|
||||||
elif prop == "presence_penalty":
|
elif prop == "presence_penalty":
|
||||||
try:
|
try:
|
||||||
if float(val) <= 2.0 and float(val) >= 0.0:
|
if float(val) <= 2.0 and float(val) >= 0.0:
|
||||||
self.presence_penalty=float(val)
|
self.presence_penalty=float(val)
|
||||||
else:
|
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
|
return
|
||||||
except:
|
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
|
return
|
||||||
else:
|
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)
|
self.print_response_properties(target)
|
||||||
return
|
return
|
||||||
else:
|
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, 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, 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)
|
self.print_response_properties(target)
|
||||||
return
|
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)
|
self.print_response_properties(target)
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
@command(permission='view')
|
@command(permission='view')
|
||||||
@ -468,7 +468,7 @@ class Plugin:
|
|||||||
f.write("")
|
f.write("")
|
||||||
f.close()
|
f.close()
|
||||||
self.start_chat_log = ""
|
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}>>>"))
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user