MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / update

Method update

tools/server/server-task.cpp:1384–1412  ·  view source on GitHub ↗

server_task_result_cmpl_partial

Source from the content-addressed store, hash-verified

1382// server_task_result_cmpl_partial
1383//
1384void server_task_result_cmpl_partial::update(task_result_state & state) {
1385 is_updated = true;
1386 state.update_chat_msg(content, true, oaicompat_msg_diffs);
1387
1388 // Copy current state for use in to_json_*() (reflects state BEFORE this chunk)
1389 thinking_block_started = state.thinking_block_started;
1390 text_block_started = state.text_block_started;
1391
1392 oai_resp_id = state.oai_resp_id;
1393 oai_resp_reasoning_id = state.oai_resp_reasoning_id;
1394 oai_resp_message_id = state.oai_resp_message_id;
1395 oai_resp_fc_id = state.oai_resp_fc_id;
1396
1397 // track if the accumulated message has any reasoning content
1398 anthropic_has_reasoning = !state.chat_msg.reasoning_content.empty();
1399
1400 // Pre-compute state updates based on diffs (for next chunk)
1401 for (const common_chat_msg_diff & diff : oaicompat_msg_diffs) {
1402 if (!diff.reasoning_content_delta.empty() && !state.thinking_block_started) {
1403 state.thinking_block_started = true;
1404 }
1405 if (!diff.content_delta.empty() && !state.text_block_started) {
1406 state.text_block_started = true;
1407 }
1408 if (!diff.tool_call_delta.name.empty()) {
1409 state.oai_resp_fc_id = diff.tool_call_delta.id;
1410 }
1411 }
1412}
1413
1414json server_task_result_cmpl_partial::to_json() {
1415 GGML_ASSERT(is_updated && "update() must be called before to_json()");

Callers 10

nextMethod · 0.45
slot_save_and_clearMethod · 0.45
get_available_slotMethod · 0.45
createMessageBranchMethod · 0.45
createSystemMessageMethod · 0.45
deleteConversationMethod · 0.45
updateConversationMethod · 0.45
updateMessageMethod · 0.45
test_hasherFunction · 0.45

Calls 5

update_chat_msgMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
pop_frontMethod · 0.45
n_tokensMethod · 0.45

Tested by 2

test_hasherFunction · 0.36