
做以下改动修复了(我不会写代码,当然是chatgpt给的解决办法哈哈)
export async function requestUsage() {
const id = Date.now().toString(); // 生成随机数
const res = await requestOpenaiClient(`dashboard/billing/credit_grants?id=${id}`)(
null,
"GET",
);
try {
const response = (await res.json()) as {
total_available: number;
total_granted: number;
total_used: number;
};
return response;
} catch (error) {
console.error("[Request usage] ", error, res.body);
}
}
原方法
export async function requestUsage() {
const res = await requestOpenaiClient("dashboard/billing/credit_grants")(
null,
"GET",
);
try {
const response = (await res.json()) as {
total_available: number;
total_granted: number;
total_used: number;
};
return response;
} catch (error) {
console.error("[Request usage] ", error, res.body);
}
}
做以下改动修复了(我不会写代码,当然是chatgpt给的解决办法哈哈)
原方法