Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit e2c9370

Browse files
committed
fix formatting
1 parent e30fc27 commit e2c9370

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+418
-448
lines changed

engine/cli/commands/cortex_upd_cmd.cc

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ std::chrono::seconds GetTimeSinceEpochMillisec() {
2828
return duration_cast<seconds>(system_clock::now().time_since_epoch());
2929
}
3030

31-
[[maybe_unused]] std::unique_ptr<system_info_utils::SystemInfo> GetSystemInfoWithUniversal() {
31+
[[maybe_unused]] std::unique_ptr<system_info_utils::SystemInfo>
32+
GetSystemInfoWithUniversal() {
3233
auto system_info = system_info_utils::GetSystemInfo();
3334
if (system_info->os == "mac") {
3435
CTL_INF("Change arch from " << system_info->arch << " to universal");
@@ -37,8 +38,8 @@ std::chrono::seconds GetTimeSinceEpochMillisec() {
3738
return system_info;
3839
}
3940

40-
[[maybe_unused]] std::string GetNightlyInstallerName(const std::string& v,
41-
const std::string& os_arch) {
41+
[[maybe_unused]] std::string GetNightlyInstallerName(
42+
const std::string& v, const std::string& os_arch) {
4243
const std::string kCortex = "cortex";
4344
// Remove 'v' in file name
4445
std::string version = v == "latest" ? "" : (v.substr(1) + "-");
@@ -134,7 +135,7 @@ bool InstallNewVersion(const std::filesystem::path& dst,
134135

135136
std::optional<std::string> CheckNewUpdate(
136137
std::optional<std::chrono::milliseconds> timeout) {
137-
(void) timeout;
138+
(void)timeout;
138139
// Get info from .cortexrc
139140
auto should_check_update = false;
140141
auto config = file_manager_utils::GetCortexConfig();
@@ -418,12 +419,13 @@ std::optional<std::string> CortexUpdCmd::HandleGithubRelease(
418419
/* .id = */ "cortex",
419420
/* .status = */ DownloadTask::Status::Pending,
420421
/* .type = */ DownloadType::Cortex,
421-
/* .items = */ {DownloadItem{
422+
/* .items = */
423+
{DownloadItem{
422424
/* .id = */ "cortex",
423425
/* .downloadUrl = */ download_url,
424426
/* .localPath = */ local_path,
425427
/* .checksum = */ std::nullopt,
426-
/* .bytes = */ std::nullopt,
428+
/* .bytes = */ std::nullopt,
427429
/* .downloadedBytes = */ std::nullopt,
428430
}},
429431
}};
@@ -487,7 +489,8 @@ bool CortexUpdCmd::GetNightly(const std::string& v) {
487489
DownloadTask{/* .id = */ "cortex",
488490
/* .status = */ DownloadTask::Status::Pending,
489491
/* .type = */ DownloadType::Cortex,
490-
/* .items = */ {DownloadItem{
492+
/* .items = */
493+
{DownloadItem{
491494
/* .id = */ "cortex",
492495
/* .downloadUrl = */ url_parser::FromUrl(url_obj),
493496
/* .localPath = */ localPath,
@@ -558,7 +561,8 @@ bool CortexUpdCmd::GetLinuxInstallScript(const std::string& v,
558561
DownloadTask{/* .id = */ "cortex",
559562
/* .status = */ DownloadTask::Status::Pending,
560563
/* .type = */ DownloadType::Cortex,
561-
/* .items = */ {DownloadItem{
564+
/* .items = */
565+
{DownloadItem{
562566
/* .id = */ "cortex",
563567
/* .downloadUrl = */ url_parser::FromUrl(url_obj),
564568
/* .localPath = */ localPath,

engine/cli/commands/engine_get_cmd.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ void EngineGetCmd::Exec(const std::string& host, int port,
2828
tabulate::Table table;
2929
table.add_row({"#", "Name", "Version", "Variant", "Status"});
3030

31-
auto url = url_parser::Url{
32-
/* .protocol = */ "http",
33-
/* .host = */ host + ":" + std::to_string(port),
34-
/* .pathParams = */ {"v1", "engines", engine_name},
35-
/* .queries = */ {}
36-
};
31+
auto url = url_parser::Url{/* .protocol = */ "http",
32+
/* .host = */ host + ":" + std::to_string(port),
33+
/* .pathParams = */ {"v1", "engines", engine_name},
34+
/* .queries = */ {}};
3735
auto result = curl_utils::SimpleGetJson(url.ToFullPath());
3836
if (result.has_error()) {
3937
// TODO: refactor this
@@ -54,7 +52,7 @@ void EngineGetCmd::Exec(const std::string& host, int port,
5452
/* .name = */ variant["name"].asString(),
5553
/* .version = */ variant["version"].asString(),
5654
/* .engine = */ engine_name,
57-
/* .type = */ "",
55+
/* .type = */ "",
5856
});
5957
}
6058

engine/cli/commands/engine_install_cmd.cc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ bool EngineInstallCmd::Exec(const std::string& engine,
7474
/* .protocol = */ "http",
7575
/* .host = */ host_ + ":" + std::to_string(port_),
7676
/* .pathParams = */
77-
{
78-
"v1",
79-
"engines",
80-
engine,
81-
"releases",
82-
selected_release.value(),
83-
},
77+
{
78+
"v1",
79+
"engines",
80+
engine,
81+
"releases",
82+
selected_release.value(),
83+
},
8484
/* queries = */ {},
8585
};
8686
auto variant_result = curl_utils::SimpleGetJson(variant_url.ToFullPath());
@@ -122,12 +122,12 @@ bool EngineInstallCmd::Exec(const std::string& engine,
122122
/* .protocol = */ "http",
123123
/* .host = */ host_ + ":" + std::to_string(port_),
124124
/* .pathParams = */
125-
{
126-
"v1",
127-
"engines",
128-
engine,
129-
"install",
130-
},
125+
{
126+
"v1",
127+
"engines",
128+
engine,
129+
"install",
130+
},
131131
/* queries = */ {},
132132
};
133133
Json::Value body;
@@ -166,12 +166,12 @@ bool EngineInstallCmd::Exec(const std::string& engine,
166166
/* .protocol = */ "http",
167167
/* .host = */ host_ + ":" + std::to_string(port_),
168168
/* .pathParams = */
169-
{
170-
"v1",
171-
"engines",
172-
engine,
173-
"install",
174-
},
169+
{
170+
"v1",
171+
"engines",
172+
engine,
173+
"install",
174+
},
175175
/* .queries = */ {},
176176
};
177177

engine/cli/commands/engine_list_cmd.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bool EngineListCmd::Exec(const std::string& host, int port) {
4949
/* .name = */ variant["name"].asString(),
5050
/* .version = */ variant["version"].asString(),
5151
/* .engine = */ engine,
52-
/* .type = */ "",
52+
/* .type = */ "",
5353
});
5454
}
5555
}

engine/cli/commands/model_status_cmd.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ bool ModelStatusCmd::IsLoaded(const std::string& host, int port,
2020
/* .protocol = */ "http",
2121
/* .host = */ host + ":" + std::to_string(port),
2222
/* .pathParams = */ {"v1", "models", "status", model_handle},
23-
/* .queries= */ {},
23+
/* .queries= */ {},
2424
};
2525

2626
auto res = curl_utils::SimpleGetJson(url.ToFullPath());

engine/cli/commands/server_start_cmd.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ void ServerStartCmd::UpdateConfig(CortexConfig& data, const std::string& key,
188188
}},
189189
{"port",
190190
[](CortexConfig& data, const std::string& k, const std::string& v) {
191-
data.apiServerPort = v; (void) k;
191+
data.apiServerPort = v;
192+
(void)k;
192193
}},
193194
{"hf-token",
194195
[](CortexConfig& data, const std::string&, const std::string& v) {
@@ -283,7 +284,7 @@ void ServerStartCmd::UpdateVectorField(
283284
tokens.push_back(token);
284285
}
285286
setter(tokens);
286-
(void) key;
287+
(void)key;
287288
}
288289

289290
void ServerStartCmd::UpdateNumericField(const std::string& key,
@@ -302,7 +303,7 @@ void ServerStartCmd::UpdateBooleanField(const std::string& key,
302303
std::function<void(bool)> setter) {
303304
bool bool_value = (value == "true" || value == "1");
304305
setter(bool_value);
305-
(void) key;
306+
(void)key;
306307
}
307308

308309
}; // namespace commands

engine/cli/utils/easywsclient.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ socket_t hostname_connect(const std::string& hostname, int port) {
112112

113113
class _DummyWebSocket : public easywsclient::WebSocket {
114114
public:
115-
void poll(int timeout) {(void) timeout;}
116-
void send(const std::string& message) {(void) message;}
117-
void sendBinary(const std::string& message) {(void) message;}
118-
void sendBinary(const std::vector<uint8_t>& message) {(void) message;}
115+
void poll(int timeout) { (void)timeout; }
116+
void send(const std::string& message) { (void)message; }
117+
void sendBinary(const std::string& message) { (void)message; }
118+
void sendBinary(const std::vector<uint8_t>& message) { (void)message; }
119119
void sendPing() {}
120120
void close() {}
121121
readyStateValues getReadyState() const { return CLOSED; }
122-
void _dispatch(Callback_Imp& callable) {(void) callable;}
123-
void _dispatchBinary(BytesCallback_Imp& callable) {(void) callable;}
122+
void _dispatch(Callback_Imp& callable) { (void)callable; }
123+
void _dispatchBinary(BytesCallback_Imp& callable) { (void)callable; }
124124
};
125125

126126
class _RealWebSocket : public easywsclient::WebSocket {
@@ -591,4 +591,4 @@ WebSocket::pointer WebSocket::from_url_no_mask(const std::string& url,
591591
return ::from_url(url, false, origin);
592592
}
593593

594-
} // namespace easywsclient
594+
} // namespace easywsclient

engine/common/api_server_configuration.h

Lines changed: 33 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -34,75 +34,52 @@ static const std::unordered_map<std::string, ApiConfigurationMetadata>
3434
CONFIGURATIONS = {
3535
{"cors",
3636
ApiConfigurationMetadata{
37-
"cors",
38-
"Cross-Origin Resource Sharing configuration.",
39-
"CORS",
40-
"[on|off]",
41-
"on"}},
37+
"cors", "Cross-Origin Resource Sharing configuration.", "CORS",
38+
"[on|off]", "on"}},
4239
{"allowed_origins",
4340
ApiConfigurationMetadata{
4441
"allowed_origins",
4542
"Allowed origins for CORS. Comma separated. E.g. "
46-
"http://localhost,https://cortex.so",
47-
"CORS",
48-
"comma separated",
49-
"*",
50-
true}},
51-
{"proxy_url", ApiConfigurationMetadata{"proxy_url",
52-
"Proxy URL",
53-
"Proxy",
54-
"string",
55-
""}},
56-
{"proxy_username", ApiConfigurationMetadata{"proxy_username",
57-
"Proxy Username",
58-
"Proxy",
59-
"string",
60-
""}},
61-
{"proxy_password", ApiConfigurationMetadata{"proxy_password",
62-
"Proxy Password",
63-
"Proxy",
64-
"string",
65-
""}},
43+
"http://localhost,https://cortex.so",
44+
"CORS", "comma separated", "*", true}},
45+
{"proxy_url", ApiConfigurationMetadata{"proxy_url", "Proxy URL",
46+
"Proxy", "string", ""}},
47+
{"proxy_username",
48+
ApiConfigurationMetadata{"proxy_username", "Proxy Username", "Proxy",
49+
"string", ""}},
50+
{"proxy_password",
51+
ApiConfigurationMetadata{"proxy_password", "Proxy Password", "Proxy",
52+
"string", ""}},
6653
{"verify_proxy_ssl",
67-
ApiConfigurationMetadata{"verify_proxy_ssl",
68-
"Verify SSL for proxy",
69-
"Proxy",
70-
"[on|off]",
71-
"on"}},
54+
ApiConfigurationMetadata{"verify_proxy_ssl", "Verify SSL for proxy",
55+
"Proxy", "[on|off]", "on"}},
7256
{"verify_proxy_host_ssl",
7357
ApiConfigurationMetadata{"verify_proxy_host_ssl",
74-
"Verify SSL for proxy",
75-
"Proxy",
76-
"[on|off]",
58+
"Verify SSL for proxy", "Proxy", "[on|off]",
7759
"on"}},
78-
{"no_proxy", ApiConfigurationMetadata{"no_proxy",
79-
"No proxy for hosts",
80-
"Proxy",
81-
"string",
82-
""}},
83-
{"verify_peer_ssl", ApiConfigurationMetadata{"verify_peer_ssl",
84-
"Verify peer SSL",
85-
"Proxy",
86-
"[on|off]",
87-
"on"}},
88-
{"verify_host_ssl", ApiConfigurationMetadata{"verify_host_ssl",
89-
"Verify host SSL",
90-
"Proxy",
91-
"[on|off]",
92-
"on"}},
60+
{"no_proxy", ApiConfigurationMetadata{"no_proxy", "No proxy for hosts",
61+
"Proxy", "string", ""}},
62+
{"verify_peer_ssl",
63+
ApiConfigurationMetadata{"verify_peer_ssl", "Verify peer SSL", "Proxy",
64+
"[on|off]", "on"}},
65+
{"verify_host_ssl",
66+
ApiConfigurationMetadata{"verify_host_ssl", "Verify host SSL", "Proxy",
67+
"[on|off]", "on"}},
9368
{"huggingface_token",
94-
ApiConfigurationMetadata{/* .name = */ "huggingface_token",
95-
/* .desc = */ "HuggingFace token to pull models",
69+
ApiConfigurationMetadata{
70+
/* .name = */ "huggingface_token",
71+
/* .desc = */ "HuggingFace token to pull models",
72+
/* .group = */ "Token",
73+
/* .accept_value = */ "string",
74+
/* .default_value = */ "",
75+
/* .allow_empty = */ true}},
76+
{"github_token",
77+
ApiConfigurationMetadata{/* .name = */ "github_token",
78+
/* .desc = */ "Github token",
9679
/* .group = */ "Token",
9780
/* .accept_value = */ "string",
9881
/* .default_value = */ "",
9982
/* .allow_empty = */ true}},
100-
{"github_token", ApiConfigurationMetadata{/* .name = */ "github_token",
101-
/* .desc = */ "Github token",
102-
/* .group = */ "Token",
103-
/* .accept_value = */ "string",
104-
/* .default_value = */ "",
105-
/* .allow_empty = */ true}},
10683
};
10784

10885
class ApiServerConfiguration {

engine/common/hardware_common.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ inline CPU FromJson(const Json::Value& root) {
5454
for (auto const& i : root["instructions"]) {
5555
insts.emplace_back(i.asString());
5656
}
57-
return {cores,
58-
arch,
59-
model,
60-
usage,
61-
insts};
57+
return {cores, arch, model, usage, insts};
6258
}
6359
} // namespace cpu
6460

@@ -180,8 +176,7 @@ inline Json::Value ToJson(const PowerInfo& pi) {
180176

181177
namespace power {
182178
inline PowerInfo FromJson(const Json::Value& root) {
183-
return {root["charging_status"].asString(),
184-
root["battery_life"].asInt(),
179+
return {root["charging_status"].asString(), root["battery_life"].asInt(),
185180
root["is_power_saving"].asBool()};
186181
}
187182
} // namespace power
@@ -207,8 +202,7 @@ inline Json::Value ToJson(const Memory& m) {
207202

208203
namespace memory {
209204
inline Memory FromJson(const Json::Value& root) {
210-
return {root["total"].asInt64(),
211-
root["available"].asInt64(),
205+
return {root["total"].asInt64(), root["available"].asInt64(),
212206
root["type"].asString()};
213207
}
214208
} // namespace memory
@@ -229,9 +223,8 @@ inline Json::Value ToJson(const StorageInfo& si) {
229223

230224
namespace storage {
231225
inline StorageInfo FromJson(const Json::Value& root) {
232-
return {root["type"].asString(),
233-
root["total"].asInt64(),
226+
return {root["type"].asString(), root["total"].asInt64(),
234227
root["available"].asInt64()};
235228
}
236229
} // namespace storage
237-
} // namespace cortex::hw
230+
} // namespace cortex::hw

engine/config/gguf_parser.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void GGUFHandler::ModelConfigFromMetadata() {
560560
}
561561

562562
try {
563-
if (tokens.size() > (unsigned) eos_token) {
563+
if (tokens.size() > (unsigned)eos_token) {
564564
eos_string = tokens[eos_token];
565565
stop.push_back(std::move(eos_string));
566566
} else {
@@ -582,7 +582,7 @@ void GGUFHandler::ModelConfigFromMetadata() {
582582
model_config_.max_tokens = max_tokens;
583583
model_config_.ctx_len = max_tokens;
584584
model_config_.ngl = ngl;
585-
(void) bos_token;
585+
(void)bos_token;
586586
}
587587

588588
const ModelConfig& GGUFHandler::GetModelConfig() const {

0 commit comments

Comments
 (0)