mirror of https://github.com/aliasrobotics/cai.git
Fix circular dependency in voice streamed example by renaming agents.py to my_workflow.py Fix circular dependency in voice streamed example by renaming agents #291
This commit is contained in:
commit
428b76c695
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import numpy as np
|
||||
import sounddevice as sd
|
||||
|
|
@ -13,7 +14,18 @@ from typing_extensions import override
|
|||
|
||||
from agents.voice import StreamedAudioInput, VoicePipeline
|
||||
|
||||
from .agents import MyWorkflow
|
||||
# Import MyWorkflow class - handle both module and package use cases
|
||||
if TYPE_CHECKING:
|
||||
# For type checking, use the relative import
|
||||
from .my_workflow import MyWorkflow
|
||||
else:
|
||||
# At runtime, try both import styles
|
||||
try:
|
||||
# Try relative import first (when used as a package)
|
||||
from .my_workflow import MyWorkflow
|
||||
except ImportError:
|
||||
# Fall back to direct import (when run as a script)
|
||||
from my_workflow import MyWorkflow
|
||||
|
||||
CHUNK_LENGTH_S = 0.05 # 100ms
|
||||
SAMPLE_RATE = 24000
|
||||
|
|
|
|||
Loading…
Reference in New Issue