Reduce timeouts, introduce ignore-channels, fix the fix functions.
This commit is contained in:
parent
a503ee405c
commit
e6d13afcca
@ -137,7 +137,7 @@ class AIResponder(object):
|
||||
return answer
|
||||
messages = [{"role": "system", "content": self.config["fix-description"]},
|
||||
{"role": "user", "content": answer}]
|
||||
for _ in range(4):
|
||||
for _ in range(3):
|
||||
try:
|
||||
result = await openai.ChatCompletion.acreate(model=self.config["fix-model"],
|
||||
messages=messages,
|
||||
@ -147,7 +147,7 @@ class AIResponder(object):
|
||||
start, end = response.find("```"), response.rfind("```")
|
||||
if start == -1 or end == -1 or (start + 3) >= end:
|
||||
return answer
|
||||
response = response[start + 3, end]
|
||||
response = response[start + 3:end]
|
||||
logging.info(f"fixed answer:\n{pformat(response)}")
|
||||
return response
|
||||
except Exception as err:
|
||||
@ -167,7 +167,7 @@ class AIResponder(object):
|
||||
limit = self.config["history-limit"]
|
||||
if self.short_path(message, limit):
|
||||
return AIResponse(None, False, None, None, False)
|
||||
for _ in range(14):
|
||||
for _ in range(5):
|
||||
messages = self._message(message, limit)
|
||||
logging.info(f"try to send this messages:\n{pformat(messages)}")
|
||||
answer, limit = await self._acreate(messages, limit)
|
||||
|
||||
@ -85,7 +85,10 @@ class FjerkroaBot(commands.Bot):
|
||||
channel_name = str(channel.name)
|
||||
except Exception:
|
||||
channel_name = str(channel.id)
|
||||
logging.info(f"handle message {str(message)} for channel {channel_name}")
|
||||
if channel_name in self.config.get('ignore-channels', []):
|
||||
logging.info(f"ignore message {repr(message)} for channel {channel_name}")
|
||||
return
|
||||
logging.info(f"handle message {repr(message)} for channel {channel_name}")
|
||||
if channel_name in self.aichannels:
|
||||
airesponder = self.aichannels[channel_name]
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user