mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Move llama.cpp chat initialization off the event loop (#195244)
This commit is contained in:
@@ -64,9 +64,13 @@ async def async_create_client(
|
||||
base_url=config_entry_data[CONF_BASE_URL],
|
||||
http_client=get_async_client(hass),
|
||||
)
|
||||
# Cache current platform data which gets added to each request
|
||||
# (caching done by library)
|
||||
_ = await hass.async_add_executor_job(client.platform_headers)
|
||||
|
||||
def warm_up_client() -> None:
|
||||
"""Cache platform headers and resolve the SDK's lazy chat resources."""
|
||||
client.platform_headers()
|
||||
_ = client.chat.completions
|
||||
|
||||
await hass.async_add_executor_job(warm_up_client)
|
||||
return client
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user