console.h 953 B

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