update: 更新了默认的配置参数

update: 更新了测试代码中的默认ip与端口
This commit is contained in:
killua 2024-05-16 21:18:18 +08:00
parent ff88b94778
commit 0df6ecf394
5 changed files with 8 additions and 9 deletions

View File

@ -1,10 +1,10 @@
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数据库连接配置
LOG_LEVEL = "DEBUG" #日志级别
class UVICORN:
HOST = "0.0.0.0" #uvicorn放行ip0.0.0.0代表所有ip
PORT = 7878 #uvicorn运行端口
PORT = 8001 #uvicorn运行端口
WORKERS = 12 #uvicorn进程数(通常与cpu核数相同)
class XF_ASR:
APP_ID = "your_app_id" #讯飞语音识别APP_ID

View File

@ -1,7 +1,6 @@
from tests.unit_test.user_test import user_test
from tests.unit_test.character_test import character_test
from tests.unit_test.chat_test import chat_test
import asyncio
if __name__ == '__main__':
user_test()

View File

@ -2,7 +2,7 @@ import requests
import json
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
def test_character_create(self):

View File

@ -10,7 +10,7 @@ import websockets
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
@ -149,7 +149,7 @@ class ChatServiceTest:
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文件并生成数据块
for chunk in chunks:
await send_audio_chunk(websocket, chunk)
@ -205,7 +205,7 @@ class ChatServiceTest:
message = json.dumps(data)
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)
for chunk in chunks:
@ -255,7 +255,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://114.214.236.207:7878/chat/voice_call"
url = f"ws://127.0.0.1:8001/chat/voice_call"
#发送格式
ws_data = {
"audio" : "",

View File

@ -4,7 +4,7 @@ import uuid
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
def test_user_create(self):