mirror of
https://gitlab.com/niansa/discord_llama.git
synced 2025-03-06 20:48:25 +01:00
Give up after timeout
This commit is contained in:
parent
85753f8f00
commit
c6228a280a
1 changed files with 10 additions and 13 deletions
23
main.cpp
23
main.cpp
|
@ -186,19 +186,16 @@ class Bot {
|
|||
// Run model
|
||||
std::scoped_lock L(llm_lock);
|
||||
std::string output;
|
||||
Timer typingIndicatorTimer;
|
||||
bool timed_out;
|
||||
do {
|
||||
Timer timeout;
|
||||
timed_out = false;
|
||||
output = LLM().run(prompt, "\n", [&] () {
|
||||
if (timeout.get<std::chrono::minutes>() > 4) {
|
||||
timed_out = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
} while (timed_out);
|
||||
Timer timeout;
|
||||
bool timed_out = false;
|
||||
output = LLM().run(prompt, "\n", [&] () {
|
||||
if (timeout.get<std::chrono::minutes>() > 4) {
|
||||
timed_out = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (timed_out) output = "Fehler: Zeitüberschreitung";
|
||||
// Send resulting message
|
||||
msg.content = output;
|
||||
bot.message_edit(msg);
|
||||
|
|
Loading…
Add table
Reference in a new issue