fix: conditional to_thread for the image_transform to relieve threadpool pressure
This commit is contained in:
parent
81013ec3b1
commit
2c87472483
1 changed files with 4 additions and 2 deletions
|
|
@ -1059,6 +1059,7 @@ async def _make_chat_request(model: str, messages: list, tools=None, stream: boo
|
|||
if ":latest" in model:
|
||||
model = model.split(":latest")[0]
|
||||
if messages:
|
||||
if any("images" in m for m in messages):
|
||||
messages = await asyncio.to_thread(transform_images_to_data_urls, messages)
|
||||
messages = transform_tool_calls_to_openai(messages)
|
||||
messages = _strip_assistant_prefill(messages)
|
||||
|
|
@ -1965,6 +1966,7 @@ async def chat_proxy(request: Request):
|
|||
model = model.split(":latest")
|
||||
model = model[0]
|
||||
if messages:
|
||||
if any("images" in m for m in messages):
|
||||
messages = await asyncio.to_thread(transform_images_to_data_urls, messages)
|
||||
messages = transform_tool_calls_to_openai(messages)
|
||||
messages = _strip_assistant_prefill(messages)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue