Fix and optimize boreness.
This commit is contained in:
parent
53ed068519
commit
36190745c9
@ -73,16 +73,17 @@ class FjerkroaBot(commands.Bot):
|
||||
boreness_interval = float(self.config.get('boreness-interval', 12.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)))
|
||||
prev_messages = await self.chat_channel.history(limit=2).flatten()
|
||||
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:
|
||||
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.')
|
||||
message = AIMessage('system', boreness_prompt, self.config.get('chat-channel', 'chat'), True, False)
|
||||
try:
|
||||
await self.respond(message, self.chat_channel)
|
||||
except Exception as err:
|
||||
logging.warning(f"Failed to activate borringness: {repr(err)}")
|
||||
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
|
||||
if last_author and last_author != self.user.id:
|
||||
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.')
|
||||
message = AIMessage('system', boreness_prompt, self.config.get('chat-channel', 'chat'), True, False)
|
||||
try:
|
||||
await self.respond(message, self.chat_channel)
|
||||
except Exception as err:
|
||||
logging.warning(f"Failed to activate borringness: {repr(err)}")
|
||||
await asyncio.sleep(7)
|
||||
|
||||
async def on_ready(self):
|
||||
|
||||
BIN
openai_chat.dat
BIN
openai_chat.dat
Binary file not shown.
Loading…
Reference in New Issue
Block a user