修改崩溃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("")
|
characters = database.get_character_byname("")
|
||||||
protocol = {}
|
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["status"] = 1
|
||||||
protocol["message"] = "success"
|
protocol["message"] = "success"
|
||||||
characterforUE = {}
|
characterforUE = {}
|
||||||
@ -178,8 +190,10 @@ async def process_protocol_json(json_str: str, client: WebSocket):
|
|||||||
protocol = json.loads(json_str)
|
protocol = json.loads(json_str)
|
||||||
cmd = protocol.get("cmd")
|
cmd = protocol.get("cmd")
|
||||||
data = protocol.get("data")
|
data = protocol.get("data")
|
||||||
if cmd == "CharacterList":
|
if cmd == "RequestCharacterInfos":
|
||||||
await handle_characterlist(client)
|
await handle_characterlist(client)
|
||||||
|
elif cmd == "RequestCharacterNames":
|
||||||
|
await handle_characternames(client)
|
||||||
elif cmd == "AddCharacter":
|
elif cmd == "AddCharacter":
|
||||||
await handle_addcharacter(client, data)
|
await handle_addcharacter(client, data)
|
||||||
elif cmd == "AiChatGenerate":
|
elif cmd == "AiChatGenerate":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user