Use system description, if no specific channel description is in config.
This commit is contained in:
parent
7007a0bfd5
commit
a781f737b0
@ -41,8 +41,9 @@ class AIResponder(object):
|
|||||||
|
|
||||||
def _message(self, message: AIMessage, limit: Optional[int] = None) -> List[Dict[str, Any]]:
|
def _message(self, message: AIMessage, limit: Optional[int] = None) -> List[Dict[str, Any]]:
|
||||||
messages = []
|
messages = []
|
||||||
system = self.config[self.channel].replace('{date}', time.strftime('%Y-%m-%d'))\
|
system = self.config.get(self.channel, self.config['system'])
|
||||||
.replace('{time}', time.strftime('%H:%M:%S'))
|
system = system.replace('{date}', time.strftime('%Y-%m-%d'))\
|
||||||
|
.replace('{time}', time.strftime('%H:%M:%S'))
|
||||||
messages.append({"role": "system", "content": system})
|
messages.append({"role": "system", "content": system})
|
||||||
if limit is None:
|
if limit is None:
|
||||||
history = self.history[:]
|
history = self.history[:]
|
||||||
|
|||||||
@ -45,7 +45,6 @@ class FjerkroaBot(commands.Bot):
|
|||||||
return toml.load(file)
|
return toml.load(file)
|
||||||
|
|
||||||
def on_config_file_modified(self, event):
|
def on_config_file_modified(self, event):
|
||||||
logging.info(f"file {event.src_path} modified")
|
|
||||||
if event.src_path == self.config_file:
|
if event.src_path == self.config_file:
|
||||||
self.config = self.load_config(self.config_file)
|
self.config = self.load_config(self.config_file)
|
||||||
self.airesponder.config = self.config
|
self.airesponder.config = self.config
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user