fix(rag-client): dapi返回值类型加固(失败可能返回字符串)
This commit is contained in:
parent
8a9d0f8294
commit
8a627b34a1
@ -153,9 +153,10 @@ async def get_owner_apikey(owner_id):
|
||||
except Exception as e:
|
||||
return "", "dapi 发 key 失败: " + str(e)[:200]
|
||||
await sor.sqlExe("COMMIT", {})
|
||||
if not res or res.get("status") != "success" or not res.get("apikey"):
|
||||
return "", "dapi 发 key 失败: " + str(res or {}).get("message", "未知错误")
|
||||
key = res["apikey"]
|
||||
if not isinstance(res, dict) or res.get("status") != "success" or not res.get("apikey"):
|
||||
_msg = res.get("message") if isinstance(res, dict) else str(res)[:120]
|
||||
return "", "dapi 发 key 失败: " + str(_msg or "未知错误")
|
||||
key = res["apikey"] if isinstance(res, dict) else ""
|
||||
# RC4 加密存 params(与平台密码字段约定一致)
|
||||
pname = _KEY_PARAM_PREFIX + str(owner_id)
|
||||
enc = _key_encode(key)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user