add online users to prompt
This commit is contained in:
parent
d0dfe6b121
commit
be58c0cece
@ -18,6 +18,7 @@ TODO: move rpbot to own repo
|
||||
- System prompt that is prefixed
|
||||
- can contain specific formatters:
|
||||
- `{self_name}` username for specified chat
|
||||
- `{online_users}` coma seperated list of online users
|
||||
- default: `Transcript of a group chat, where {self_name} talks to online strangers.\n{self_name} is creative and curious. {self_name} is writing with precision, but also with occasional typos.\n`
|
||||
|
||||
- `RPBot`, `min_messages`(, opt contact ID)
|
||||
|
@ -62,12 +62,20 @@ void RPBot::stateTransition(const Contact3 c, const StateIdle& from, StateNextAc
|
||||
to.prompt = _conf.get_string("RPBot", "system_prompt").value();
|
||||
}
|
||||
|
||||
std::string online_users;
|
||||
for (const auto& [_, name] : mpb.names) {
|
||||
if (!online_users.empty()) {
|
||||
online_users += ", ";
|
||||
}
|
||||
online_users += name;
|
||||
}
|
||||
|
||||
to.prompt = fmt::format(fmt::runtime(to.prompt),
|
||||
fmt::arg("self_name", to.possible_names.at(self))
|
||||
fmt::arg("self_name", to.possible_names.at(self)),
|
||||
//fmt::arg("chat_name", "test_group"),
|
||||
//fmt::arg("chat_type", "Group")
|
||||
//fmt::arg("chat_topic", "Group")
|
||||
// current online?
|
||||
fmt::arg("online_users", online_users)
|
||||
// current date?
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user