parent
ff88b94778
commit
0df6ecf394
|
@ -1,10 +1,10 @@
|
||||||
class DevelopmentConfig:
|
class DevelopmentConfig:
|
||||||
SQLALCHEMY_DATABASE_URI = f"mysql+pymysql://admin02:LabA100102@127.0.0.1/takway?charset=utf8mb4" #mysql数据库连接配置
|
SQLALCHEMY_DATABASE_URI = f"mysql+pymysql://takway:takway123456@127.0.0.1/takway?charset=utf8mb4" #mysql数据库连接配置
|
||||||
REDIS_URL = "redis://:takway@127.0.0.1:6379/0" #redis数据库连接配置
|
REDIS_URL = "redis://:takway@127.0.0.1:6379/0" #redis数据库连接配置
|
||||||
LOG_LEVEL = "DEBUG" #日志级别
|
LOG_LEVEL = "DEBUG" #日志级别
|
||||||
class UVICORN:
|
class UVICORN:
|
||||||
HOST = "0.0.0.0" #uvicorn放行ip,0.0.0.0代表所有ip
|
HOST = "0.0.0.0" #uvicorn放行ip,0.0.0.0代表所有ip
|
||||||
PORT = 7878 #uvicorn运行端口
|
PORT = 8001 #uvicorn运行端口
|
||||||
WORKERS = 12 #uvicorn进程数(通常与cpu核数相同)
|
WORKERS = 12 #uvicorn进程数(通常与cpu核数相同)
|
||||||
class XF_ASR:
|
class XF_ASR:
|
||||||
APP_ID = "your_app_id" #讯飞语音识别APP_ID
|
APP_ID = "your_app_id" #讯飞语音识别APP_ID
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from tests.unit_test.user_test import user_test
|
from tests.unit_test.user_test import user_test
|
||||||
from tests.unit_test.character_test import character_test
|
from tests.unit_test.character_test import character_test
|
||||||
from tests.unit_test.chat_test import chat_test
|
from tests.unit_test.chat_test import chat_test
|
||||||
import asyncio
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
user_test()
|
user_test()
|
||||||
|
|
|
@ -2,7 +2,7 @@ import requests
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class CharacterServiceTest:
|
class CharacterServiceTest:
|
||||||
def __init__(self,socket="http://114.214.236.207:7878"):
|
def __init__(self,socket="http://127.0.0.1:8001"):
|
||||||
self.socket = socket
|
self.socket = socket
|
||||||
|
|
||||||
def test_character_create(self):
|
def test_character_create(self):
|
||||||
|
|
|
@ -10,7 +10,7 @@ import websockets
|
||||||
|
|
||||||
|
|
||||||
class ChatServiceTest:
|
class ChatServiceTest:
|
||||||
def __init__(self,socket="http://114.214.236.207:7878"):
|
def __init__(self,socket="http://127.0.0.1:8001"):
|
||||||
self.socket = socket
|
self.socket = socket
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class ChatServiceTest:
|
||||||
await websocket.send(message)
|
await websocket.send(message)
|
||||||
|
|
||||||
|
|
||||||
async with websockets.connect(f'ws://114.214.236.207:7878/chat/streaming/temporary') as websocket:
|
async with websockets.connect(f'ws://127.0.0.1:8001/chat/streaming/temporary') as websocket:
|
||||||
chunks = read_wav_file_in_chunks(2048) # 读取PCM文件并生成数据块
|
chunks = read_wav_file_in_chunks(2048) # 读取PCM文件并生成数据块
|
||||||
for chunk in chunks:
|
for chunk in chunks:
|
||||||
await send_audio_chunk(websocket, chunk)
|
await send_audio_chunk(websocket, chunk)
|
||||||
|
@ -205,7 +205,7 @@ class ChatServiceTest:
|
||||||
message = json.dumps(data)
|
message = json.dumps(data)
|
||||||
await websocket.send(message)
|
await websocket.send(message)
|
||||||
|
|
||||||
async with websockets.connect(f'ws://114.214.236.207:7878/chat/streaming/lasting') as websocket:
|
async with websockets.connect(f'ws://127.0.0.1:8001/chat/streaming/lasting') as websocket:
|
||||||
#发送第一次
|
#发送第一次
|
||||||
chunks = read_wav_file_in_chunks(2048)
|
chunks = read_wav_file_in_chunks(2048)
|
||||||
for chunk in chunks:
|
for chunk in chunks:
|
||||||
|
@ -255,7 +255,7 @@ class ChatServiceTest:
|
||||||
current_dir = os.path.dirname(current_file_path)
|
current_dir = os.path.dirname(current_file_path)
|
||||||
tests_dir = os.path.dirname(current_dir)
|
tests_dir = os.path.dirname(current_dir)
|
||||||
file_path = os.path.join(tests_dir, 'assets', 'voice_call.wav')
|
file_path = os.path.join(tests_dir, 'assets', 'voice_call.wav')
|
||||||
url = f"ws://114.214.236.207:7878/chat/voice_call"
|
url = f"ws://127.0.0.1:8001/chat/voice_call"
|
||||||
#发送格式
|
#发送格式
|
||||||
ws_data = {
|
ws_data = {
|
||||||
"audio" : "",
|
"audio" : "",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import uuid
|
||||||
|
|
||||||
|
|
||||||
class UserServiceTest:
|
class UserServiceTest:
|
||||||
def __init__(self,socket="http://114.214.236.207:7878"):
|
def __init__(self,socket="http://127.0.0.1:8001"):
|
||||||
self.socket = socket
|
self.socket = socket
|
||||||
|
|
||||||
def test_user_create(self):
|
def test_user_create(self):
|
||||||
|
|
Loading…
Reference in New Issue