Skip to content

Commit

Permalink
Modify path matching to suffix matching and fix sendError bug
Browse files Browse the repository at this point in the history
  • Loading branch information
YJQ1101 committed Aug 28, 2024
1 parent 77ae6be commit a4eace8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ void InferenceContext::sendEmbedding(server_slot & slot, const llama_batch & bat
void InferenceContext::sendError(const int& id_task, const std::string & error, const enum error_type type = ERROR_TYPE_SERVER) {
if (callback_body_.find(id_task) != callback_body_.end()) {
LookupBodyCallback& cb = callback_body_[id_task];
cb(ModelInferenceResult{true, false, error,type});
cb(ModelInferenceResult{false, false, error,type});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ Http::FilterHeadersStatus LLMInferenceFilter::decodeHeaders(Http::RequestHeaderM

// check header
const absl::string_view headersPath = headers.getPathValue();
if (headersPath == "/v1/chat/completions") {
if (absl::EndsWith(headersPath, "/v1/chat/completions")) {
task_type_ = InferencetasktypeTypeCompletion;
} else if (headersPath == "/v1/embeddings") {
} else if (absl::EndsWith(headersPath, "/v1/embeddings")) {
task_type_ = InferencetasktypeTypeEmbeedings;
} else {
return Http::FilterHeadersStatus::Continue;
Expand Down

0 comments on commit a4eace8

Please sign in to comment.