diff --git a/packages/services/voice-service/requirements.txt b/packages/services/voice-service/requirements.txt index c2eba85..6b099cd 100644 --- a/packages/services/voice-service/requirements.txt +++ b/packages/services/voice-service/requirements.txt @@ -19,4 +19,4 @@ ordered-set pypinyin cn2an jieba -livekit>=1.0.0 +livekit-api>=1.0.0 diff --git a/packages/services/voice-service/src/api/livekit_token.py b/packages/services/voice-service/src/api/livekit_token.py index 1e6273c..4951cbb 100644 --- a/packages/services/voice-service/src/api/livekit_token.py +++ b/packages/services/voice-service/src/api/livekit_token.py @@ -12,7 +12,7 @@ import uuid from fastapi import APIRouter, Request -from livekit.api import AccessToken, VideoGrants, RoomAgentDispatch, RoomConfiguration +from livekit import api as livekit_api from ..config.settings import settings @@ -32,11 +32,11 @@ async def create_livekit_token(request: Request): participant_identity = f"user-{uuid.uuid4().hex[:8]}" token = ( - AccessToken(settings.livekit_api_key, settings.livekit_api_secret) + livekit_api.AccessToken(settings.livekit_api_key, settings.livekit_api_secret) .with_identity(participant_identity) .with_name("User") .with_grants( - VideoGrants( + livekit_api.VideoGrants( room_join=True, room=room_name, can_publish=True, @@ -45,9 +45,9 @@ async def create_livekit_token(request: Request): ) ) .with_room_config( - RoomConfiguration( + livekit_api.RoomConfiguration( agents=[ - RoomAgentDispatch( + livekit_api.RoomAgentDispatch( agent_name="voice-agent", metadata=json.dumps({"auth_header": auth_header}), )