Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions xllm/api_service/chat_service_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,10 @@ void ChatServiceImpl::process_async_impl(std::shared_ptr<ChatCall> call) {
CHECK(stream_parser != nullptr) << "create StreamOutputParser failed!";
}

auto saved_tools = request_params.tools;
auto saved_streaming = request_params.streaming;
auto saved_request_id = request_params.request_id;

master_->handle_request(
std::move(messages),
std::move(prompt_tokens),
Expand All @@ -633,12 +637,12 @@ void ChatServiceImpl::process_async_impl(std::shared_ptr<ChatCall> call) {
[call,
model,
master = master_,
stream = request_params.streaming,
stream = std::move(saved_streaming),
include_usage = include_usage,
first_message_sent = std::unordered_set<size_t>(),
request_id = request_params.request_id,
request_id = std::move(saved_request_id),
created_time = absl::ToUnixSeconds(absl::Now()),
json_tools = request_params.tools,
json_tools = std::move(saved_tools),
tool_call_parser_format = tool_call_parser_format_,
reasoning_parser_format = reasoning_parser_format_,
is_force_reasoning = is_force_reasoning_,
Expand Down Expand Up @@ -741,6 +745,9 @@ void MMChatServiceImpl::process_async_impl(std::shared_ptr<MMChatCall> call) {
include_usage = rpc_request.stream_options().include_usage();
}

auto saved_streaming = request_params.streaming;
auto saved_request_id = request_params.request_id;

// schedule the request
master_->handle_request(
std::move(messages),
Expand All @@ -749,10 +756,10 @@ void MMChatServiceImpl::process_async_impl(std::shared_ptr<MMChatCall> call) {
[call,
model,
master = master_,
stream = request_params.streaming,
stream = std::move(saved_streaming),
include_usage = include_usage,
first_message_sent = std::unordered_set<size_t>(),
request_id = request_params.request_id,
request_id = std::move(saved_request_id),
created_time = absl::ToUnixSeconds(absl::Now())](
const RequestOutput& req_output) mutable -> bool {
if (req_output.status.has_value()) {
Expand Down
6 changes: 4 additions & 2 deletions xllm/api_service/completion_service_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ void CompletionServiceImpl::process_async_impl(
request_params.decode_address = rpc_request.routing().decode_name();
}

auto saved_streaming = request_params.streaming;
auto saved_request_id = request_params.request_id;
// schedule the request
master_->handle_request(
std::move(rpc_request.prompt()),
Expand All @@ -205,9 +207,9 @@ void CompletionServiceImpl::process_async_impl(
[call,
model,
master = master_,
stream = request_params.streaming,
stream = std::move(saved_streaming),
include_usage = include_usage,
request_id = request_params.request_id,
request_id = std::move(saved_request_id),
created_time = absl::ToUnixSeconds(absl::Now())](
const RequestOutput& req_output) -> bool {
if (req_output.status.has_value()) {
Expand Down
3 changes: 2 additions & 1 deletion xllm/api_service/embedding_service_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void EmbeddingServiceImpl::process_async_impl(
// TODO only support input_str for now
auto& input = rpc_request.input();

auto saved_request_id = request_params.request_id;
// schedule the request
master_->handle_request(
std::move(input),
Expand All @@ -102,7 +103,7 @@ void EmbeddingServiceImpl::process_async_impl(
call.get(),
[call,
model,
request_id = request_params.request_id,
request_id = std::move(saved_request_id),
created_time = absl::ToUnixSeconds(absl::Now())](
const RequestOutput& req_output) -> bool {
if (req_output.status.has_value()) {
Expand Down
3 changes: 2 additions & 1 deletion xllm/api_service/image_generation_service_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ void ImageGenerationServiceImpl::process_async_impl(
DiTRequestParams request_params(
rpc_request, call->get_x_request_id(), call->get_x_request_time());

auto saved_request_id = request_params.request_id;
// schedule the request
master_->handle_request(
std::move(request_params),
call.get(),
[call,
model,
request_id = request_params.request_id,
request_id = std::move(saved_request_id),
created_time = absl::ToUnixSeconds(absl::Now())](
const DiTRequestOutput& req_output) -> bool {
if (req_output.status.has_value()) {
Expand Down
Loading