MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / run

Method run

src/runner/runner.cpp:132–392  ·  view source on GitHub ↗

\brief Run the runner

Source from the content-addressed store, hash-verified

130
131/// \brief Run the runner
132void Runner::run() {
133 bool verbose = false;
134 this->system_prompt = "";
135 this->auto_chat_engine->configure_parameter("system_prompt", this->system_prompt);
136 std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8conv;
137 wstream_buf obuf(std::cout);
138 std::ostream base_ostream(&obuf);
139 header_print("FLM", "Type /? for help");
140 int empty_line_count = 0;
141 bool is_image = false;
142 bytes image;
143 while (true) {
144 std::string input = cli.get_interactive_input();
145 is_image = false;
146 if (input.empty()) {
147 empty_line_count++;
148 if (empty_line_count > 2) {
149 header_print("FLM", "Type /? for help");
150 empty_line_count = 0;
151 }
152 continue;
153 }
154
155 // Convert line (UTF-8 bytes) → wide string (Unicode codepoints)
156 std::wstring winput = utf8conv.from_bytes(input);
157
158 // Split on *any* Unicode whitespace
159 std::wistringstream wiss(winput);
160 std::wstring wtoken;
161 std::vector<std::string> input_list;
162 std::cout << std::endl;
163
164 while (wiss >> wtoken) {
165 // Convert each token back → UTF-8 bytes
166 input_list.push_back(utf8conv.to_bytes(wtoken));
167 }
168
169 // now input_list contains your UTF-8 tokens
170 if (input_list.empty()) {
171 continue;
172 }
173
174 // For commands, we only need to check the first token
175 std::string first_token = input_list[0];
176
177
178 // Check if this is a command (starts with /)
179 bool is_command = (first_token[0] == '/');
180
181 if (is_command && first_token != "/input") {
182 if (first_token == "/bye") {
183 break;
184 }
185 else if (first_token == "/clear") {
186 this->cmd_clear(input_list);
187 }
188 else if (first_token == "/status") {
189 this->cmd_status(input_list);

Callers 3

mainFunction · 0.80
startMethod · 0.80
parse_optionsFunction · 0.80

Calls 15

cmd_clearMethod · 0.95
cmd_statusMethod · 0.95
cmd_loadMethod · 0.95
cmd_saveMethod · 0.95
cmd_showMethod · 0.95
cmd_setMethod · 0.95
cmd_helpMethod · 0.95
utf8_to_wstringFunction · 0.85
push_backMethod · 0.80
get_all_modelsMethod · 0.80
is_model_downloadedMethod · 0.80
get_historyMethod · 0.80

Tested by

no test coverage detected