Refactor workflow routing and greeting management in Brain classes
- Update WorkflowBrain to handle greeting playback more effectively, ensuring that the initial greeting completes before transitioning to the first node. - Introduce new methods for managing greeting states and conditions, enhancing the interaction flow for user turns. - Refactor WorkflowLLMRouter to improve routing logic and ensure proper handling of conditional paths. - Enhance tests to verify the correct behavior of greeting management and routing under various scenarios, including waiting for audio playback to finish. - Update frontend components to reflect changes in edge handling and improve user experience in workflow configurations.
This commit is contained in:
@@ -101,8 +101,16 @@ class BaseBrain:
|
||||
async def setup(self, cfg: AssistantConfig, runtime: BrainRuntime) -> None:
|
||||
"""Register tools and initialize per-call orchestration."""
|
||||
|
||||
async def on_connected(self) -> None:
|
||||
"""Handle a connected client after the common greeting is queued."""
|
||||
async def on_connected(self, *, greeting_pending: bool = False) -> None:
|
||||
"""Handle a connected client before an optional greeting is played.
|
||||
|
||||
``greeting_pending`` lets an orchestration brain prepare its initial
|
||||
state without starting node-entry speech while the shared greeting is
|
||||
still playing.
|
||||
"""
|
||||
|
||||
async def on_greeting_finished(self) -> None:
|
||||
"""Continue startup after the shared greeting has actually played."""
|
||||
|
||||
def prepare_greeting_context(
|
||||
self,
|
||||
@@ -166,7 +174,9 @@ class Brain(Protocol):
|
||||
|
||||
async def setup(self, cfg: AssistantConfig, runtime: BrainRuntime) -> None: ...
|
||||
|
||||
async def on_connected(self) -> None: ...
|
||||
async def on_connected(self, *, greeting_pending: bool = False) -> None: ...
|
||||
|
||||
async def on_greeting_finished(self) -> None: ...
|
||||
|
||||
def prepare_greeting_context(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user