初始化
This commit is contained in:
18
server/ws_messages.py
Normal file
18
server/ws_messages.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import json
|
||||
|
||||
from fastapi import WebSocket
|
||||
|
||||
|
||||
async def send_text_message(websocket: WebSocket, content: str) -> None:
|
||||
await websocket.send_text(json.dumps({"type": "text", "content": content}))
|
||||
|
||||
|
||||
async def send_audio_message(websocket: WebSocket, audio_data_url: str) -> None:
|
||||
await websocket.send_text(
|
||||
json.dumps(
|
||||
{
|
||||
"type": "audio",
|
||||
"content": audio_data_url,
|
||||
}
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user