@@ -20,7 +20,8 @@ using Row_t =
2020
2121void ModelListCmd::Exec (const std::string& host, int port,
2222 const std::string& filter, bool display_engine,
23- bool display_version) {
23+ bool display_version, bool display_cpu_mode,
24+ bool display_gpu_mode) {
2425 // Start server if server is not started yet
2526 if (!commands::IsServerAlive (host, port)) {
2627 CLI_LOG (" Starting server ..." );
@@ -39,6 +40,12 @@ void ModelListCmd::Exec(const std::string& host, int port,
3940 column_headers.push_back (" Version" );
4041 }
4142
43+ if (display_cpu_mode) {
44+ column_headers.push_back (" CPU Mode" );
45+ }
46+ if (display_gpu_mode) {
47+ column_headers.push_back (" GPU Mode" );
48+ }
4249 Row_t header{column_headers.begin (), column_headers.end ()};
4350 table.add_row (header);
4451 table.format ().font_color (Color::green);
@@ -77,6 +84,28 @@ void ModelListCmd::Exec(const std::string& host, int port,
7784 row.push_back (v[" version" ].asString ());
7885 }
7986
87+ if (auto & r = v[" recommendation" ]; !r.isNull ()) {
88+ if (display_cpu_mode) {
89+ if (!r[" cpu_mode" ].isNull ()) {
90+ row.push_back (" RAM: " + r[" cpu_mode" ][" ram" ].asString () + " MiB" );
91+ }
92+ }
93+
94+ if (display_gpu_mode) {
95+ if (!r[" gpu_mode" ].isNull ()) {
96+ std::string s;
97+ s += " ngl: " + r[" gpu_mode" ][0 ][" ngl" ].asString () + " - " ;
98+ s += " context: " + r[" gpu_mode" ][0 ][" context_length" ].asString () +
99+ " - " ;
100+ s += " RAM: " + r[" gpu_mode" ][0 ][" ram" ].asString () + " MiB - " ;
101+ s += " VRAM: " + r[" gpu_mode" ][0 ][" vram" ].asString () + " MiB - " ;
102+ s += " recommended ngl: " +
103+ r[" gpu_mode" ][0 ][" recommend_ngl" ].asString ();
104+ row.push_back (s);
105+ }
106+ }
107+ }
108+
80109 table.add_row ({row.begin (), row.end ()});
81110 }
82111 }
0 commit comments