Fix and optimize boreness.
This commit is contained in:
parent
53ed068519
commit
36190745c9
@ -73,9 +73,10 @@ class FjerkroaBot(commands.Bot):
|
|||||||
boreness_interval = float(self.config.get('boreness-interval', 12.0))
|
boreness_interval = float(self.config.get('boreness-interval', 12.0))
|
||||||
elapsed_time = (time.monotonic() - self.last_activity_time) / 3600.0
|
elapsed_time = (time.monotonic() - self.last_activity_time) / 3600.0
|
||||||
probability = 1 / (1 + math.exp(-1 * (elapsed_time - (boreness_interval / 2.0)) + math.log(1 / 0.2 - 1)))
|
probability = 1 / (1 + math.exp(-1 * (elapsed_time - (boreness_interval / 2.0)) + math.log(1 / 0.2 - 1)))
|
||||||
prev_messages = await self.chat_channel.history(limit=2).flatten()
|
if random.random() < probability:
|
||||||
|
prev_messages = [msg async for msg in self.chat_channel.history(limit=2)]
|
||||||
last_author = prev_messages[1].author.id if len(prev_messages) > 1 else None
|
last_author = prev_messages[1].author.id if len(prev_messages) > 1 else None
|
||||||
if random.random() < probability and last_author and last_author != self.user.id:
|
if last_author and last_author != self.user.id:
|
||||||
logging.info(f'Borred with {probability} probability after {elapsed_time}')
|
logging.info(f'Borred with {probability} probability after {elapsed_time}')
|
||||||
boreness_prompt = self.config.get('boreness-prompt', 'Pretend that you just now thought of something, be creative.')
|
boreness_prompt = self.config.get('boreness-prompt', 'Pretend that you just now thought of something, be creative.')
|
||||||
message = AIMessage('system', boreness_prompt, self.config.get('chat-channel', 'chat'), True, False)
|
message = AIMessage('system', boreness_prompt, self.config.get('chat-channel', 'chat'), True, False)
|
||||||
|
|||||||
BIN
openai_chat.dat
BIN
openai_chat.dat
Binary file not shown.
Loading…
Reference in New Issue
Block a user