mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	fix: add max_tokens when using vision model (#4157)
This commit is contained in:
		@@ -110,6 +110,16 @@ export class ChatGPTApi implements LLMApi {
 | 
			
		||||
      // Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // add max_tokens to vision model
 | 
			
		||||
    if (visionModel) {
 | 
			
		||||
      Object.defineProperty(requestPayload, "max_tokens", {
 | 
			
		||||
        enumerable: true,
 | 
			
		||||
        configurable: true,
 | 
			
		||||
        writable: true,
 | 
			
		||||
        value: Math.max(modelConfig.max_tokens, 4096),
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    console.log("[Request] openai payload: ", requestPayload);
 | 
			
		||||
 | 
			
		||||
    const shouldStream = !!options.config.stream;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user