MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / sse_try_send

Function sse_try_send

server/src/server/http_server.cpp:947–972  ·  view source on GitHub ↗

Send data to an SSE client fd with a short (1s) timeout to avoid stalling the inference worker. Returns false if the send fails or times out.

Source from the content-addressed store, hash-verified

945 if (arguments.is_string()) {
946 try {
947 return json::parse(arguments.get<std::string>());
948 } catch (const std::exception &) {
949 return json::object();
950 }
951 }
952 return json::object();
953}
954
955std::string render_tool_call_xml(const std::string & name, const json & arguments) {
956 std::string out = "<function=" + name + ">\n";
957 if (arguments.is_object()) {
958 for (const auto & [key, value] : arguments.items()) {
959 out += "<parameter=" + key + ">\n";
960 out += value.is_string() ? value.get<std::string>() : value.dump();
961 out += "\n</parameter>\n";
962 }
963 }
964 out += "</function>\n";
965 return out;
966}
967
968std::vector<ChatMessage> normalize_chat_messages(
969 const json & messages,
970 ApiFormat format,
971 ToolMemory & tool_memory) {
972 std::vector<ChatMessage> chat_msgs;
973 std::vector<std::string> system_parts;
974 std::vector<std::string> response_call_ids;
975 std::string response_call_fallback;

Callers 2

broadcast_statusMethod · 0.85
broadcast_tokenMethod · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected