1
0
Fork 0
mirror of https://gitlab.com/niansa/anyproc.git synced 2025-03-06 20:49:24 +01:00

Fixed example()

This commit is contained in:
niansa 2023-04-16 23:48:20 +02:00
parent 274c56547d
commit 5480e3df7c

View file

@ -52,7 +52,7 @@ public:
: LM::Inference(weights_path, p) {}
auto& begin() {
buffer += " ";
buffer += ">>> ";
return *this;
}
@ -77,14 +77,18 @@ public:
auto run(const std::function<bool (float)> &on_append_tick = nullptr, const std::function<bool (const char *generated)>& on_generation_tick = nullptr) {
buffer += "\n";
append(buffer, on_append_tick);
static std::string f;
f += buffer;
std::cout << f << std::endl;
buffer.clear();
return LM::Inference::run("\n", on_generation_tick);
auto fres = LM::Inference::run("\n", on_generation_tick);
f += fres;
return fres;
}
void example(std::string_view response) {
buffer += "\n";
buffer += response;
if (!response.empty()) buffer += "\n";
buffer += ">>>";
}
};