mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-07-09 17:08:29 +00:00
preload improvement
This commit is contained in:
parent
b823cc17da
commit
5600687618
3 changed files with 15 additions and 8 deletions
|
|
@ -145,6 +145,10 @@ def initialize_job_loop():
|
|||
from python.helpers.job_loop import run_loop
|
||||
return defer.DeferredTask("JobLoop").start_task(run_loop)
|
||||
|
||||
def initialize_preload():
|
||||
import preload
|
||||
return defer.DeferredTask().start_task(preload.preload)
|
||||
|
||||
|
||||
def _args_override(config):
|
||||
# update config with runtime args
|
||||
|
|
|
|||
17
preload.py
17
preload.py
|
|
@ -4,9 +4,6 @@ from python.helpers.print_style import PrintStyle
|
|||
from python.helpers import kokoro_tts
|
||||
import models
|
||||
|
||||
PrintStyle().print("Running preload...")
|
||||
runtime.initialize()
|
||||
|
||||
|
||||
async def preload():
|
||||
try:
|
||||
|
|
@ -34,10 +31,11 @@ async def preload():
|
|||
|
||||
# preload kokoro tts model if enabled
|
||||
async def preload_kokoro():
|
||||
try:
|
||||
return await kokoro_tts.preload()
|
||||
except Exception as e:
|
||||
PrintStyle().error(f"Error in preload_kokoro: {e}")
|
||||
if set["tts_kokoro"]:
|
||||
try:
|
||||
return await kokoro_tts.preload()
|
||||
except Exception as e:
|
||||
PrintStyle().error(f"Error in preload_kokoro: {e}")
|
||||
|
||||
# async tasks to preload
|
||||
tasks = [
|
||||
|
|
@ -53,4 +51,7 @@ async def preload():
|
|||
|
||||
|
||||
# preload transcription model
|
||||
asyncio.run(preload())
|
||||
if __name__ == "__main__":
|
||||
PrintStyle().print("Running preload...")
|
||||
runtime.initialize()
|
||||
asyncio.run(preload())
|
||||
|
|
|
|||
|
|
@ -249,6 +249,8 @@ def init_a0():
|
|||
initialize.initialize_mcp()
|
||||
# start job loop
|
||||
initialize.initialize_job_loop()
|
||||
# preload
|
||||
initialize.initialize_preload()
|
||||
|
||||
# only wait for init chats, otherwise they would seem to dissapear for a while on restart
|
||||
init_chats.result_sync()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue