|
23 | 23 | from pipecat.transports.base_transport import BaseTransport, TransportParams |
24 | 24 | from pipecat.transports.smallwebrtc.connection import SmallWebRTCConnection |
25 | 25 | from pipecat.transports.smallwebrtc.transport import SmallWebRTCTransport |
26 | | -from pipecatcloud import PipecatSessionArguments, SmallWebRTCSessionManager |
27 | | -from pipecatcloud.agent import SmallWebRTCSessionArguments |
28 | 26 |
|
29 | 27 | load_dotenv(override=True) |
30 | 28 |
|
31 | | -# Create a global session manager instance |
32 | | -session_manager = SmallWebRTCSessionManager(timeout_seconds=120) |
33 | | - |
34 | 29 |
|
35 | 30 | async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): |
36 | 31 | """Run your bot with the provided transport. |
@@ -117,20 +112,7 @@ async def on_client_disconnected(transport, participant): |
117 | 112 |
|
118 | 113 | async def bot(runner_args: RunnerArguments): |
119 | 114 | """Main bot entry point compatible with Pipecat Cloud.""" |
120 | | - |
121 | | - if isinstance(runner_args, PipecatSessionArguments): |
122 | | - logger.info("Starting the bot, but still waiting for the webrtc_connection to be set") |
123 | | - try: |
124 | | - await session_manager.wait_for_webrtc() |
125 | | - except TimeoutError as e: |
126 | | - logger.error(f"Timeout waiting for WebRTC connection: {e}") |
127 | | - raise |
128 | | - return |
129 | | - |
130 | | - elif isinstance(runner_args, SmallWebRTCSessionArguments): |
131 | | - logger.info("Received the webrtc_connection from Pipecat Cloud, will start the pipeline") |
132 | | - session_manager.cancel_timeout() |
133 | | - |
| 115 | + logger.info(f"Starting the bot, received body: {runner_args.body}") |
134 | 116 | webrtc_connection: SmallWebRTCConnection = runner_args.webrtc_connection |
135 | 117 | try: |
136 | 118 | if os.environ.get("ENV") != "local": |
@@ -159,9 +141,6 @@ async def bot(runner_args: RunnerArguments): |
159 | 141 | except Exception as e: |
160 | 142 | logger.exception(f"Error in bot process: {str(e)}") |
161 | 143 | raise |
162 | | - finally: |
163 | | - logger.info("Cleaning up SmallWebRTC resources") |
164 | | - session_manager.complete_session() |
165 | 144 |
|
166 | 145 |
|
167 | 146 | if __name__ == "__main__": |
|
0 commit comments