Felipe97/llama-cpp-compiled
01.1k
1// Console functions2 3#pragma once4 5#include "common.h"6 7#include <functional>8#include <string>9#include <vector>10 11enum display_type {12 DISPLAY_TYPE_RESET = 0,13 DISPLAY_TYPE_INFO,14 DISPLAY_TYPE_PROMPT,15 DISPLAY_TYPE_REASONING,16 DISPLAY_TYPE_USER_INPUT,17 DISPLAY_TYPE_ERROR18};19 20namespace console {21 void init(bool use_simple_io, bool use_advanced_display);22 void cleanup();23 void set_display(display_type display);24 bool readline(std::string & line, bool multiline_input);25 26 using completion_callback = std::function<std::vector<std::pair<std::string, size_t>>(std::string_view, size_t)>;27 void set_completion_callback(completion_callback cb);28 29 namespace spinner {30 void start();31 void stop();32 }33 34 // note: the logging API below output directly to stdout35 // it can negatively impact performance if used on inference thread36 // only use in in a dedicated CLI thread37 // for logging in inference thread, use log.h instead38 39 LLAMA_COMMON_ATTRIBUTE_FORMAT(1, 2)40 void log(const char * fmt, ...);41 42 LLAMA_COMMON_ATTRIBUTE_FORMAT(1, 2)43 void error(const char * fmt, ...);44 45 void flush();46}47 