修改崩溃bug

This commit is contained in:
997146918 2025-07-10 09:30:45 +08:00
parent 873dd45584
commit 2984aaa4be
2 changed files with 16 additions and 2 deletions

Binary file not shown.

View File

@ -90,7 +90,19 @@ async def handle_characterlist(client: WebSocket):
### 获得数据库中的角色信息###
characters = database.get_character_byname("")
protocol = {}
protocol["cmd"] = "CharacterList"
protocol["cmd"] = "RequestCharacterInfos"
protocol["status"] = 1
protocol["message"] = "success"
characterforUE = {}
characterforUE["characterInfos"] = characters
protocol["data"] = json.dumps(characterforUE)
await senddata(client, protocol)
async def handle_characternames(client: WebSocket):
### 获得数据库中的角色信息###
characters = database.get_character_byname("")
protocol = {}
protocol["cmd"] = "RequestCharacterNames"
protocol["status"] = 1
protocol["message"] = "success"
characterforUE = {}
@ -178,8 +190,10 @@ async def process_protocol_json(json_str: str, client: WebSocket):
protocol = json.loads(json_str)
cmd = protocol.get("cmd")
data = protocol.get("data")
if cmd == "CharacterList":
if cmd == "RequestCharacterInfos":
await handle_characterlist(client)
elif cmd == "RequestCharacterNames":
await handle_characternames(client)
elif cmd == "AddCharacter":
await handle_addcharacter(client, data)
elif cmd == "AiChatGenerate":