Merge commit '1c3c9674de4d455f1e571bed808252af54932767' into concedo_experimental

# Conflicts:
#	.github/workflows/build-apple.yml
#	.github/workflows/build-vulkan.yml
#	.github/workflows/release.yml
#	docs/ops.md
#	docs/ops/Vulkan.csv
#	examples/gen-docs/gen-docs.cpp
#	ggml/CMakeLists.txt
#	ggml/src/ggml-opencl/ggml-opencl.cpp
#	ggml/src/ggml-sycl/concat.cpp
#	ggml/src/ggml-sycl/fattn-onednn.cpp
#	ggml/src/ggml-sycl/fattn.cpp
#	models/templates/deepseek-ai-DeepSeek-V4.jinja
#	scripts/sync-ggml.last
#	scripts/sync_vendor.py
#	src/CMakeLists.txt
#	src/llama-model-loader.cpp
#	tests/CMakeLists.txt
#	tests/test-arg-parser.cpp
#	tests/test-backend-sampler.cpp
#	tests/test-chat.cpp
#	tests/test-sampling.cpp
#	tools/server/README.md
This commit is contained in:
Concedo
2026-08-07 18:16:11 +08:00
51 changed files with 2686 additions and 780 deletions
+2 -1
View File
@@ -1807,7 +1807,8 @@ private:
// initialize samplers
if (task.need_sampling()) {
try {
slot.smpl.reset(common_sampler_init(model_tgt, task.params.sampling));
slot.smpl.reset(common_sampler_init(
model_tgt, task.params.sampling, (int32_t) llama_n_ctx(ctx_tgt)));
} catch (std::exception & e) {
std::string err_msg = std::string("Failed to initialize samplers: ") + e.what();
send_error(task, err_msg, ERROR_TYPE_INVALID_REQUEST);
+51
View File
@@ -1090,6 +1090,56 @@ struct server_tool_get_datetime : server_tool {
}
};
//
// get_info: returns runtime info (OS name/version and cwd)
//
struct server_tool_get_info : server_tool {
server_tool_get_info() {
name = "get_info";
display_name = "Get Runtime Info";
permission_write = false;
}
json get_definition() const override {
return {
{"type", "function"},
{"function", {
{"name", name},
{"description", "Returns runtime info: the OS name/version and the current working directory"},
{"parameters", {
{"type", "object"},
{"properties", json::object()},
}},
}},
};
}
json invoke(json params, server_tool::stream *) const override {
auto io = make_tools_io(params);
#ifdef _WIN32
auto res = io->run({"cmd", "/c", "ver"}, 4096, 5);
#else
auto res = io->run({"uname", "-a"}, 4096, 5);
#endif
// "ver" prints a blank line before the version, so the output is stripped on both ends;
// a failed spawn or a timeout leaves a diagnostic in res.output, which is not an OS name
std::string os_info = res.exit_code == 0 && !res.timed_out ? string_strip(res.output) : "unknown";
std::string cwd = json_value(params, "cwd", std::string());
if (cwd.empty()) {
std::error_code ec;
cwd = fs::current_path(ec).string();
}
return {
{"os", os_info},
{"cwd", cwd},
};
}
};
struct server_tool_stream_result : server_task_result {
std::string chunk;
bool done = false;
@@ -1199,6 +1249,7 @@ static std::vector<std::unique_ptr<server_tool>> build_tools() {
tools.push_back(std::make_unique<server_tool_write_file>());
tools.push_back(std::make_unique<server_tool_edit_file>());
tools.push_back(std::make_unique<server_tool_get_datetime>());
tools.push_back(std::make_unique<server_tool_get_info>());
return tools;
}