Skip to content

Commit a67c81d

Browse files
author
anyshu
committed
删除不需要的
1 parent 893d421 commit a67c81d

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

tools/server/server-diffusion.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ struct callback_data {
722722
int32_t n_input;
723723
void * slot; // For streaming updates (server_slot*)
724724
void * ctx_server; // For sending partial responses (server_context*)
725-
std::string last_sent_text; // Track last sent text for delta calculation
726725
llama_token * last_tokens; // Track last tokens for partial text decoding
727726
};
728727

@@ -4115,17 +4114,6 @@ struct server_context {
41154114
// send the complete text as a single chunk before the final response
41164115
// In streaming mode with callbacks, the text was already sent incrementally
41174116
if (slot.params.stream) {
4118-
// // Check if we need to send any remaining text that wasn't sent by callback
4119-
// if (cb_data.last_sent_text != output_text && !output_text.empty()) {
4120-
// std::string remaining_text = output_text.substr(cb_data.last_sent_text.length());
4121-
// if (!remaining_text.empty()) {
4122-
// completion_token_output result;
4123-
// result.tok = -1;
4124-
// result.text_to_send = remaining_text;
4125-
// result.prob = 1.0f;
4126-
// send_partial_response(slot, result, false);
4127-
// }
4128-
// }
41294117
slot.generated_text = ""; // clear to avoid resending
41304118
send_final_response(slot);
41314119
} else if (!output_text.empty()) {
@@ -4137,7 +4125,6 @@ struct server_context {
41374125
send_partial_response(slot, result, false);
41384126
send_final_response(slot);
41394127
}
4140-
41414128

41424129
} else {
41434130
send_error(slot, "Diffusion generation failed");
@@ -4816,11 +4803,6 @@ static bool diffusion_step_callback(int32_t step,
48164803
// Always send on first step, last step, or at regular intervals
48174804
bool should_send = (step == 0) ||
48184805
(step == total_steps - 1);
4819-
4820-
// // Also send if text has changed significantly (more tokens decoded)
4821-
// if (!should_send && current_text.length() > data->last_sent_text.length() + 10) {
4822-
// should_send = true;
4823-
// }
48244806

48254807
//for chat/completions
48264808
if (true) {
@@ -4851,7 +4833,7 @@ static bool diffusion_step_callback(int32_t step,
48514833
has_changes = true;
48524834

48534835
SRV_INF("Token changes at step %d: %zu positions changed\n", step, content_array.size());
4854-
SRV_INF("Delta JSON: %s\n", delta_json.dump().c_str());
4836+
SRV_DBG("Delta JSON: %s\n", delta_json.dump().c_str());
48554837
}
48564838
}
48574839

@@ -4866,9 +4848,6 @@ static bool diffusion_step_callback(int32_t step,
48664848

48674849
// Use is_progress=false to send actual content instead of progress info
48684850
ctx_server->send_partial_response(*slot, progress_token, false);
4869-
4870-
// Update last sent text
4871-
data->last_sent_text = current_text;
48724851
}
48734852
}
48744853
}

0 commit comments

Comments
 (0)