update: 在tts_info中加入了speed字段
This commit is contained in:
1 parent
387c277c28
commit
b3e0f26937
2 files changed
+16
-15
No files matched your search
@@ -10,7 +10,7 @@ import websockets
|
||||
|
||||
|
||||
class ChatServiceTest:
|
||||
def __init__(self,socket="http://127.0.0.1:8001"):
|
||||
def __init__(self,socket="http://127.0.0.1:7878"):
|
||||
self.socket = socket
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class ChatServiceTest:
|
||||
"user_id": self.user_id,
|
||||
"messages": "[{\"role\": \"system\", \"content\": \"我们正在角色扮演对话游戏中,你需要始终保持角色扮演并待在角色设定的情景中,你扮演的角色信息如下:\\n角色名称: 海绵宝宝。\\n角色背景: 厨师,做汉堡\\n角色所处环境: 海绵宝宝住在深海的大菠萝里面\\n角色的常用问候语: 你好啊,海绵宝宝。\\n\\n你需要用简单、通俗易懂的口语化方式进行对话,在没有经过允许的情况下,你需要保持上述角色,不得擅自跳出角色设定。\\n\"}]",
|
||||
"user_info": "{\"character\": \"\", \"events\": [] }",
|
||||
"tts_info": "{\"language\": 0, \"speaker_id\": 97, \"noise_scale\": 0.1, \"noise_scale_w\": 0.668, \"length_scale\": 1.2}",
|
||||
"tts_info": "{\"language\": 0, \"speaker_id\": 97, \"noise_scale\": 0.1, \"noise_scale_w\": 0.668, \"length_scale\": 1.2, \"speed\":1.0}",
|
||||
"llm_info": "{\"model\": \"abab5.5-chat\", \"temperature\": 1, \"top_p\": 0.9}",
|
||||
"token": 0}
|
||||
)
|
||||
@@ -166,7 +166,7 @@ class ChatServiceTest:
|
||||
await websocket.send(message)
|
||||
|
||||
|
||||
async with websockets.connect(f'ws://127.0.0.1:8001/chat/streaming/temporary') as websocket:
|
||||
async with websockets.connect(f'ws://127.0.0.1:7878/chat/streaming/temporary') as websocket:
|
||||
chunks = read_wav_file_in_chunks(2048) # 读取PCM文件并生成数据块
|
||||
for chunk in chunks:
|
||||
await send_audio_chunk(websocket, chunk)
|
||||
@@ -222,7 +222,7 @@ class ChatServiceTest:
|
||||
message = json.dumps(data)
|
||||
await websocket.send(message)
|
||||
|
||||
async with websockets.connect(f'ws://127.0.0.1:8001/chat/streaming/lasting') as websocket:
|
||||
async with websockets.connect(f'ws://127.0.0.1:7878/chat/streaming/lasting') as websocket:
|
||||
#发送第一次
|
||||
chunks = read_wav_file_in_chunks(2048)
|
||||
for chunk in chunks:
|
||||
@@ -272,7 +272,7 @@ class ChatServiceTest:
|
||||
current_dir = os.path.dirname(current_file_path)
|
||||
tests_dir = os.path.dirname(current_dir)
|
||||
file_path = os.path.join(tests_dir, 'assets', 'voice_call.wav')
|
||||
url = f"ws://127.0.0.1:8001/chat/voice_call"
|
||||
url = f"ws://127.0.0.1:7878/chat/voice_call"
|
||||
#发送格式
|
||||
ws_data = {
|
||||
"audio" : "",
|
||||
@@ -341,8 +341,8 @@ def chat_test():
|
||||
chat_service_test.test_session_content_query()
|
||||
chat_service_test.test_session_update()
|
||||
asyncio.run(chat_service_test.test_chat_temporary())
|
||||
# asyncio.run(chat_service_test.test_chat_lasting())
|
||||
# asyncio.run(chat_service_test.test_voice_call())
|
||||
asyncio.run(chat_service_test.test_chat_lasting())
|
||||
asyncio.run(chat_service_test.test_voice_call())
|
||||
chat_service_test.test_chat_delete()
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user