actually reactive

This commit is contained in:
Green Sky 2024-01-29 23:08:54 +01:00
parent 283d3ad575
commit eba657c484
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -27,6 +27,7 @@ LlamaCppWeb::~LlamaCppWeb(void) {
}
bool LlamaCppWeb::isGood(void) {
//return true; // HACK: test old llama server
auto res = _cli.Get("/health");
if (
res.error() != httplib::Error::Success ||
@ -122,7 +123,7 @@ std::string LlamaCppWeb::completeLine(const std::string_view prompt) {
{"temperature", 0.9}, // depends 1.0 for chat models
{"top_k", 60},
{"top_p", 1.0}, // disable
{"n_predict", 1000},
{"n_predict", 400},
{"seed", _rng()},
{"stop", {"\n"}},
{"cache_prompt", static_cast<bool>(_use_server_cache)},

View File

@ -96,7 +96,7 @@ void RPBot::stateTransition(const Contact3 c, const StateIdle& from, StateNextAc
template<>
void RPBot::stateTransition(const Contact3, const StateNextActor&, StateIdle& to) {
to.timeout = std::uniform_real_distribution<>{10.f, 45.f}(_rng);
to.timeout = std::uniform_real_distribution<>{30.f, 5.f*60.f}(_rng);
}
template<>
@ -142,6 +142,8 @@ R"sys(Transcript of a group chat, where {self_name} talks to online strangers.
assert(_conf.has_string("RPBot", "system_prompt"));
registerCommands();
_rmm.subscribe(this, RegistryMessageModel_Event::message_construct);
}
float RPBot::tick(float time_delta) {
@ -279,6 +281,10 @@ bool RPBot::onEvent(const Message::Events::MessageConstruct& e) {
return false;
}
if (_cr.any_of<Contact::Components::TagSelfStrong>(contact_from)) {
return false; // ignore own messages
}
Contact3 rpbot_contact = entt::null;
// check ContactTo (public)
@ -302,6 +308,7 @@ bool RPBot::onEvent(const Message::Events::MessageConstruct& e) {
auto& timeout = _cr.get<StateIdle>(rpbot_contact).timeout;
// TODO: config with id
timeout = std::min<float>(timeout, _conf.get_double("RPBot", "max_interactive_delay").value_or(4.f));
std::cout << "RPBot: onMsg new timeout: " << timeout << "\n";
return false;
}