修改崩溃bug
This commit is contained in:
parent
873dd45584
commit
2984aaa4be
BIN
AIGC/data.db
BIN
AIGC/data.db
Binary file not shown.
18
AIGC/main.py
18
AIGC/main.py
@ -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":
|
||||
|
Loading…
x
Reference in New Issue
Block a user