| 410 | } |
| 411 | |
| 412 | static void token_printer_write_char(token_printer *p, char c) { |
| 413 | if (p->in_think) token_printer_set_grey(p); |
| 414 | fputc((unsigned char)c, p->fp); |
| 415 | p->last_output_newline = c == '\n'; |
| 416 | } |
| 417 | |
| 418 | static void token_printer_process(token_printer *p, const char *text, size_t len, bool finish) { |
| 419 | const char *think_open = "<think>"; |
| 420 | const char *think_close = "</think>"; |
| 421 | size_t total = p->pending_len + len; |
| 422 | char *buf = malloc(total ? total : 1); |
no test coverage detected