没有意思
async getAIGCChat(req) {
var _a, _b;
const options = await this.formatChatSteamReq(req);
const res = await got_1.default.post(ai_service_const_1.AIGC_SERVICE_API['chatAi'], options).json();
if ((res === null || res === void 0 ? void 0 : res.code) === 200) {
return (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : '';
}
throw new exceptions_1.CustomException({ type: 'AI_API_CALL_ERROR' });
}
async getAIGCChat(req) {
var _a, _b;
const options = await this.formatChatSteamReq(req);
const res = await got_1.default.post(ai_service_const_1.AIGC_SERVICE_API['chatAi'], options).json();
if ((res === null || res === void 0 ? void 0 : res.code) === 200) {
return (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : '';
}
throw new exceptions_1.CustomException({ type: 'AI_API_CALL_ERROR' });
}
async getAIGCChat(req: AigcChatReqPayload): Promise<any> {
const options = await this.formatChatSteamReq(req);
const res = <AigcResponse>await got.post(AIGC_SERVICE_API['chatAi'], options).json();
if (res.code! === 200) {
return res.data?.message ?? '';
}
throw new CustomException({ type: 'AI_API_CALL_ERROR' });
}
等同于
async getAIGCChat(req: AigcChatReqPayload): Promise<any> {
const options = await this.formatChatSteamReq(req);
const res = <AigcResponse>await got.post(AIGC_SERVICE_API['chatAi'], options).json();
if (res?.code === 200) {
return res.data?.message ?? '';
}
throw new CustomException({ type: 'AI_API_CALL_ERROR' });
}