mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	fix: #277 no cache for credit query
This commit is contained in:
		@@ -9,7 +9,7 @@ const makeRequestParam = (
 | 
			
		||||
  options?: {
 | 
			
		||||
    filterBot?: boolean;
 | 
			
		||||
    stream?: boolean;
 | 
			
		||||
  },
 | 
			
		||||
  }
 | 
			
		||||
): ChatRequest => {
 | 
			
		||||
  let sendMessages = messages.map((v) => ({
 | 
			
		||||
    role: v.role,
 | 
			
		||||
@@ -69,10 +69,9 @@ export async function requestChat(messages: Message[]) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function requestUsage() {
 | 
			
		||||
  const res = await requestOpenaiClient("dashboard/billing/credit_grants")(
 | 
			
		||||
    null,
 | 
			
		||||
    "GET",
 | 
			
		||||
  );
 | 
			
		||||
  const res = await requestOpenaiClient(
 | 
			
		||||
    "dashboard/billing/credit_grants?_vercel_no_cache=1"
 | 
			
		||||
  )(null, "GET");
 | 
			
		||||
 | 
			
		||||
  try {
 | 
			
		||||
    const response = (await res.json()) as {
 | 
			
		||||
@@ -94,7 +93,7 @@ export async function requestChatStream(
 | 
			
		||||
    onMessage: (message: string, done: boolean) => void;
 | 
			
		||||
    onError: (error: Error) => void;
 | 
			
		||||
    onController?: (controller: AbortController) => void;
 | 
			
		||||
  },
 | 
			
		||||
  }
 | 
			
		||||
) {
 | 
			
		||||
  const req = makeRequestParam(messages, {
 | 
			
		||||
    stream: true,
 | 
			
		||||
@@ -189,7 +188,7 @@ export const ControllerPool = {
 | 
			
		||||
  addController(
 | 
			
		||||
    sessionIndex: number,
 | 
			
		||||
    messageIndex: number,
 | 
			
		||||
    controller: AbortController,
 | 
			
		||||
    controller: AbortController
 | 
			
		||||
  ) {
 | 
			
		||||
    const key = this.key(sessionIndex, messageIndex);
 | 
			
		||||
    this.controllers[key] = controller;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user