server: support /models/sse on single-model mode (#32398)
* server: support /models/sse on single-model mode * nits * nits
This commit is contained in:
1 parent
8d60873dfb
commit
0b51bb2fed
12 files changed
+273
-113
No files matched your search
@@ -1,3 +1,4 @@
|
||||
#include "arg.h"
|
||||
#include "common.h"
|
||||
#include "download.h"
|
||||
#include "log.h"
|
||||
@@ -2386,6 +2387,22 @@ server_role::~server_role() {
|
||||
}
|
||||
}
|
||||
|
||||
std::string server_get_model_name(const common_params & params) {
|
||||
if (!params.model_alias.empty()) {
|
||||
// backward compat: use first alias as model name
|
||||
return *params.model_alias.begin();
|
||||
}
|
||||
if (!params.model.get_name().empty()) {
|
||||
return params.model.get_name();
|
||||
}
|
||||
if (!params.model.url.empty()) {
|
||||
// -mu before the download: the path the model will be stored at
|
||||
return common_get_default_local_path(params.model.url);
|
||||
}
|
||||
// fallback: derive model name from file name
|
||||
return std::filesystem::path(params.model.path).filename().string();
|
||||
}
|
||||
|
||||
bool server_role::is_managed_by_router() {
|
||||
return std::getenv(SERVER_ENV_ROUTER_PORT) != nullptr;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user