Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa authored Apr 6, 2023
1 parent 6823839 commit f7e4217
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const makeRequestParam = (
options?: {
filterBot?: boolean;
stream?: boolean;
},
}
): ChatRequest => {
let sendMessages = messages.map((v) => ({
role: v.role,
Expand Down Expand Up @@ -76,15 +76,15 @@ export async function requestUsage() {
.getDate()
.toString()
.padStart(2, "0")}`;
const ONE_DAY = 24 * 60 * 60 * 1000;
const ONE_DAY = 2 * 24 * 60 * 60 * 1000;
const now = new Date(Date.now() + ONE_DAY);
const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
const startDate = formatDate(startOfMonth);
const endDate = formatDate(now);

const [used, subs] = await Promise.all([
requestOpenaiClient(
`dashboard/billing/usage?start_date=${startDate}&end_date=${endDate}`,
`dashboard/billing/usage?start_date=${startDate}&end_date=${endDate}`
)(null, "GET"),
requestOpenaiClient("dashboard/billing/subscription")(null, "GET"),
]);
Expand Down Expand Up @@ -124,7 +124,7 @@ export async function requestChatStream(
onMessage: (message: string, done: boolean) => void;
onError: (error: Error, statusCode?: number) => void;
onController?: (controller: AbortController) => void;
},
}
) {
const req = makeRequestParam(messages, {
stream: true,
Expand Down Expand Up @@ -213,7 +213,7 @@ export const ControllerPool = {
addController(
sessionIndex: number,
messageId: number,
controller: AbortController,
controller: AbortController
) {
const key = this.key(sessionIndex, messageId);
this.controllers[key] = controller;
Expand Down

0 comments on commit f7e4217

Please sign in to comment.