MCPcopy Create free account
hub / github.com/antirez/ds4 / kv_cache_try_load_text

Function kv_cache_try_load_text

ds4_server.c:8815–8833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8813 st->mode = ANTH_STREAM_SUPPRESS;
8814 return true;
8815 }
8816 } else {
8817 return true;
8818 }
8819 }
8820
8821 if (st->mode == ANTH_STREAM_TEXT) {
8822 if (st->guard_second_reasoning) {
8823 const char *close = strstr(raw + st->emit_pos, "</think>");
8824 const char *tool = r->has_tools ?
8825 find_any_tool_start(raw + st->emit_pos) : NULL;
8826 if (close && (!tool || close < tool)) {
8827 const size_t limit = (size_t)(close - raw);
8828 if (limit > st->emit_pos) {
8829 if (!anthropic_sse_open_block(fd, st, ANTH_BLOCK_THINKING)) return false;
8830 if (!anthropic_sse_delta_live(fd, st, ANTH_BLOCK_THINKING,
8831 raw + st->emit_pos,
8832 limit - st->emit_pos)) return false;
8833 st->sent_thinking = true;
8834 }
8835 if (!anthropic_sse_close_block_live(fd, id, st)) return false;
8836 st->emit_pos = limit + strlen("</think>");

Callers 2

kv_cache_try_loadFunction · 0.85

Calls 4

kv_cache_tool_map_hooksFunction · 0.85
xstrdupFunction · 0.70

Tested by

no test coverage detected