1// Console functions
2
3#pragma once
4
5#include "common.h"
6
7#include <string>
8
9enum display_type {
10 DISPLAY_TYPE_RESET = 0,
11 DISPLAY_TYPE_INFO,
12 DISPLAY_TYPE_PROMPT,
13 DISPLAY_TYPE_REASONING,
14 DISPLAY_TYPE_USER_INPUT,
15 DISPLAY_TYPE_ERROR
16};
17
18namespace console {
19 void init(bool use_simple_io, bool use_advanced_display);
20 void cleanup();
21 void set_display(display_type display);
22 bool readline(std::string & line, bool multiline_input);
23
24 namespace spinner {
25 void start();
26 void stop();
27 }
28
29 // note: the logging API below output directly to stdout
30 // it can negatively impact performance if used on inference thread
31 // only use in in a dedicated CLI thread
32 // for logging in inference thread, use log.h instead
33
34 LLAMA_COMMON_ATTRIBUTE_FORMAT(1, 2)
35 void log(const char * fmt, ...);
36
37 LLAMA_COMMON_ATTRIBUTE_FORMAT(1, 2)
38 void error(const char * fmt, ...);
39
40 void flush();
41}