mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-14 07:34:58 +08:00
refactor: simplify request handler, use positive condition check for handler assignment (#18690)
Signed-off-by: googs1025 <googs1025@gmail.com>
This commit is contained in:
parent
8820821b59
commit
abd4030d94
@ -365,8 +365,8 @@ async def main(args):
|
|||||||
|
|
||||||
# Determine the type of request and run it.
|
# Determine the type of request and run it.
|
||||||
if request.url == "/v1/chat/completions":
|
if request.url == "/v1/chat/completions":
|
||||||
chat_handler_fn = (None if openai_serving_chat is None else
|
chat_handler_fn = openai_serving_chat.create_chat_completion if \
|
||||||
openai_serving_chat.create_chat_completion)
|
openai_serving_chat is not None else None
|
||||||
if chat_handler_fn is None:
|
if chat_handler_fn is None:
|
||||||
response_futures.append(
|
response_futures.append(
|
||||||
make_async_error_request_output(
|
make_async_error_request_output(
|
||||||
@ -380,8 +380,8 @@ async def main(args):
|
|||||||
run_request(chat_handler_fn, request, tracker))
|
run_request(chat_handler_fn, request, tracker))
|
||||||
tracker.submitted()
|
tracker.submitted()
|
||||||
elif request.url == "/v1/embeddings":
|
elif request.url == "/v1/embeddings":
|
||||||
embed_handler_fn = (None if openai_serving_embedding is None else
|
embed_handler_fn = openai_serving_embedding.create_embedding if \
|
||||||
openai_serving_embedding.create_embedding)
|
openai_serving_embedding is not None else None
|
||||||
if embed_handler_fn is None:
|
if embed_handler_fn is None:
|
||||||
response_futures.append(
|
response_futures.append(
|
||||||
make_async_error_request_output(
|
make_async_error_request_output(
|
||||||
@ -394,8 +394,8 @@ async def main(args):
|
|||||||
run_request(embed_handler_fn, request, tracker))
|
run_request(embed_handler_fn, request, tracker))
|
||||||
tracker.submitted()
|
tracker.submitted()
|
||||||
elif request.url == "/v1/score":
|
elif request.url == "/v1/score":
|
||||||
score_handler_fn = (None if openai_serving_scores is None else
|
score_handler_fn = openai_serving_scores.create_score if \
|
||||||
openai_serving_scores.create_score)
|
openai_serving_scores is not None else None
|
||||||
if score_handler_fn is None:
|
if score_handler_fn is None:
|
||||||
response_futures.append(
|
response_futures.append(
|
||||||
make_async_error_request_output(
|
make_async_error_request_output(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user