NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

[Bug] 使用Grok-3-mini或者Grok-4(手动配置)模型时,程序默认传入presence_penalty和frequency_penalty参数导致报错

Open WyBlack opened this issue 4 months ago • 1 comments

📦 部署方式

Other

📌 软件版本

v2.16.1

💻 系统环境

Other

📌 系统版本

所有系统

🌐 浏览器

Chrome

📌 浏览器版本

所有版本

🐛 问题描述

Grok-3-mini和Grok-4两个模型是不能带这两个参数请求api的,只要模型指定为这类,就会报错

📷 复现步骤

No response

🚦 期望结果

把xai旗下模型的这两个参数是否生效改成一个参数,或者直接删掉,其实后面的xai新模型都好像没这俩了

📝 补充信息

这里提供大家一个临时解决的方式,就是临时删除这两个参数,方式是找到app/client/xai.ts,给根节点添加如下代码

export interface XAIRequestPayload { messages: { role: "developer" | "system" | "user" | "assistant"; content: string | MultimodalContent[]; }[]; stream?: boolean; model: string; temperature: number; top_p: number; max_tokens?: number; max_completion_tokens?: number; }

然后把这里的类从 const requestPayload: RequestPayload = { 改成 const requestPayload: XAIRequestPayload = { 就可以,这样模型可以正常调用,缺点是之前支持两个参数的其他XAI模型也会不被传入。

WyBlack avatar Aug 05 '25 14:08 WyBlack

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug] When using the Grok-3-mini or Grok-4 (manual configuration) model, the program passes the present_penalty and frequency_penalty parameters by default, resulting in an error

📦 Deployment method

Other

📌 Software version

v2.16.1

💻 System environment

Other

📌 System version

All systems

🌐 Browser

Chrome

📌 Browser version

All versions

🐛 Question description

Grok-3-mini and Grok-4 cannot request API with these two parameters. As long as the model is specified as this type, an error will be reported.

📷 Reproduction steps

No response

🚦 Expected results

Change these two parameters of xai's model to one parameter, or delete them directly. In fact, the new xai model behind seems to have no these two.

📝 Supplementary information

Here we provide you with a temporary solution, which is to temporarily delete these two parameters. The method is to find app/client/xai.ts and add the following code to the root node.

export interface XAIRequestPayload { messages: { role: "developer" | "system" | "user" | "assistant"; content: string | MultimodalContent[]; }[]; stream?: boolean; model: string; temperature: number; top_p: number; max_tokens?: number; max_completion_tokens?: number; }

Then take the class here from const requestPayload: RequestPayload = { Change to const requestPayload: XAIRequestPayload = { That's fine, so that the model can be called normally. The disadvantage is that other XAI models that previously supported two parameters will not be passed in.

Issues-translate-bot avatar Aug 05 '25 14:08 Issues-translate-bot