expose simple web interface on root domain
demonstrates how to use the stream option of generate.
This commit is contained in:
parent
acc111caf9
commit
627d3ba8b5
2 changed files with 295 additions and 1 deletions
|
@ -889,7 +889,14 @@ int main(int argc, char ** argv) {
|
|||
});
|
||||
|
||||
svr.Get("/", [](const Request &, Response & res) {
|
||||
res.set_content("<h1>llama.cpp server works</h1>", "text/html");
|
||||
// return content of server.html file
|
||||
|
||||
std::ifstream t("examples/server/server.html");
|
||||
std::stringstream buffer;
|
||||
buffer << t.rdbuf();
|
||||
|
||||
res.set_content(buffer.str(), "text/html");
|
||||
return false;
|
||||
});
|
||||
|
||||
svr.Post("/completion", [&llama](const Request & req, Response & res) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue