NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

[Bug] 没说完就停了

Open hhtnFxQVwQntBLkULKjy opened this issue 1 year ago • 17 comments

📦 部署方式

Vercel

📌 软件版本

2.15.8

💻 系统环境

Windows

📌 系统版本

10

🌐 浏览器

Chrome

📌 浏览器版本

132.0.6834.160

🐛 问题描述

Image

📷 复现步骤

过长的回答会说一半就会停

🚦 期望结果

修复

📝 补充信息

No response

hhtnFxQVwQntBLkULKjy avatar Feb 08 '25 00:02 hhtnFxQVwQntBLkULKjy

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


Title: [Bug] Stopped before I finished speaking

📦 Deployment method

Vercel

📌 Software version

2.15.8

💻 System environment

Windows

📌 System version

10

🌐 Browser

Chrome

📌 Browser version

132.0.6834.160

🐛 Question description

Image

📷 Reproduction steps

If you have too long answers, you will stop halfway

🚦 Expected results

repair

📝 Supplementary information

No response

Issues-translate-bot avatar Feb 08 '25 00:02 Issues-translate-bot

me too 我也有这样的问题出现,几乎每一次长文回答都会出现该问题

LonePheasantWarrior avatar Feb 08 '25 06:02 LonePheasantWarrior

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


me too I also have such a question, and this question will appear almost every time I answer a long article

Issues-translate-bot avatar Feb 08 '25 06:02 Issues-translate-bot

Same problem. Almost every answer to using deepseek R1 breaks down like this. Setting max tokens to 4096 or 8192 doesn't work, it still breaks down. There is no problem in the online experience of siliconflow.

responsewrite avatar Feb 08 '25 06:02 responsewrite

需要要检查是 max_tokens 截断还是请求超时的问题

QAbot-zh avatar Feb 08 '25 07:02 QAbot-zh

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


Need to check whether max_tokens truncation or request timeout

Issues-translate-bot avatar Feb 08 '25 07:02 Issues-translate-bot

我也有这样的问题,用的是第三方提供的 deepseek-r1-search 模型(应该是逆向的 deepseek 网页),然后接的 new-api 提供服务,在 NextChat 已经尝试修改 max_token 无果 在 new-api 的 Playguard 上测试输出正常无截断,但中途有一两次卡住然后突然出来一大截,估计是请求超时的问题 (主要现在在外面用手机不太方便,晚点我浏览器F12看看能不能发现什么问题)

找到问题之所在了,因为是逆向模型,模型名没有经过特殊适配,还用的是默认的超时时间,改一下就正常了 https://github.com/ChatGPTNextWeb/NextChat/commit/a5a976824591a7e2c228dbb257616b98fd7a53ed 其他模型我还没测试暂时也没碰到更多问题,但估计出这种问题的都是思考模型,遇到相同问题的建议报一下模型名称 估计得模糊匹配一下思考模型单独设置超时时间,或者给个变量 设置项之类的方便改🤔

liuran001 avatar Feb 11 '25 11:02 liuran001

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


I also have this problem. I use the deepseek-r1-search model provided by a third party (it should be a reverse deepseek webpage), and then the new-api service is provided. In NextChat, I have tried to modify max_token without success. The test output on Playguard in new-api is normal and has no truncation, but it gets stuck once or twice in the middle and then suddenly comes out. It is probably because the request timeout is a problem. (It is mainly not convenient to use your phone outside now. I will see if I can find any problems when I browser F12 is late)

Issues-translate-bot avatar Feb 11 '25 11:02 Issues-translate-bot

I encountered the same issue with the Gemini Flash Thinking model and the DeepSeek-R1(Upper Case) API. I don't think relying on name matching (such as "r1") is a valid approach.

pikkali avatar Feb 19 '25 09:02 pikkali

用字节火山的DeepSeek API也会遇到这个问题 自定义接入点的模型名称是类似这样的:"ep-20250205160249-h6d7g" 如果是用预置接入点,模型名称是:"deepseek-r1-250120" 看现在的代码是用endWith("-r1")来判断,好像也不能兼容

csliuchi avatar Feb 20 '25 01:02 csliuchi

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


This problem will also occur with the DeepSeek API of Byte Volcano The model name of the custom access point is similar to this: "ep-20250205160249-h6d7g" If you are using a preset access point, the model name is: "deepseek-r1-250120" Look at the current code, it is judged by endWith("-r1"), and it seems that it is not compatible.

Issues-translate-bot avatar Feb 20 '25 01:02 Issues-translate-bot

这个有解决吗?同样使用火山的模型出现这个问题

MengYingjie avatar Feb 25 '25 12:02 MengYingjie

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


Is this a solution? This problem occurs when using the volcano model

Issues-translate-bot avatar Feb 25 '25 12:02 Issues-translate-bot

哥哥们,大佬们,此问题解决了吗?用着好难受呀

MengYingjie avatar Mar 06 '25 11:03 MengYingjie

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


Brothers, big guys, has this problem been solved? It's so uncomfortable to use

Issues-translate-bot avatar Mar 06 '25 11:03 Issues-translate-bot

我也有这样的问题,用的是第三方提供的 deepseek-r1-search 模型(应该是逆向的 deepseek 网页),然后接的 new-api 提供服务,在 NextChat 已经尝试修改 max_token 无果 在 new-api 的 Playguard 上测试输出正常无截断,但中途有一两次卡住然后突然出来一大截,估计是请求超时的问题 (主要现在在外面用手机不太方便,晚点我浏览器F12看看能不能发现什么问题)

找到问题之所在了,因为是逆向模型,模型名没有经过特殊适配,还用的是默认的超时时间,改一下就正常了 a5a9768 其他模型我还没测试暂时也没碰到更多问题,但估计出这种问题的都是思考模型,遇到相同问题的建议报一下模型名称 估计得模糊匹配一下思考模型单独设置超时时间,或者给个变量 设置项之类的方便改🤔

楼上这位找到了其中之一问题所在,不过没给具体代码如何修改。当然除了这个问题,还有另一个问题前面也有人说了可能和max_tokens有关,火山引擎的deepseek模型默认是4096(目前作者未提供max_tokens配置),最大支持16384。

看作者没回复,我在这里先给个临时的解决方案,使用该解决方案后火山引擎只能使用deepseek-r1/v3模型。 第一个问题是模型名没匹配上导致取的超时时间有误,需要修改app/utils.ts文件,增加自定义接入点名称bot-xxxx-xxxx,其中模型自定义接入点ep开头,创建的联网搜索版应用bot开头。

export function getTimeoutMSByModel(model: string) {
  model = model.toLowerCase();
  if (
      model.startsWith("dall-e") ||
      model.startsWith("dalle") ||
      model.startsWith("o1") ||
      model.startsWith("o3") ||
      model.includes("deepseek-r") ||
      model.includes("-thinking")
  )
    return REQUEST_TIMEOUT_MS_FOR_THINKING;
  return REQUEST_TIMEOUT_MS;
}

修改为

export function getTimeoutMSByModel(model: string) {
  model = model.toLowerCase();
  if (
      model.startsWith("dall-e") ||
      model.startsWith("dalle") ||
      model.startsWith("o1") ||
      model.startsWith("o3") ||
      model.includes("deepseek-r") ||
      model.includes("-thinking") ||
      model.includes("bot-xxxx-xxxx")
  )
    return REQUEST_TIMEOUT_MS_FOR_THINKING;
  return REQUEST_TIMEOUT_MS;
}

第二个问题是模型名没匹配上导致取的超时时间有误,需要修改app/client/platforms/bytedance.ts文件的两处地方,在调api时增加max_tokens属性,并且强制设置为16384。 第一处:

interface RequestPayloadForByteDance {
  messages: {
    role: "system" | "user" | "assistant";
    content: string | MultimodalContent[];
  }[];
  stream?: boolean;
  model: string;
  temperature: number;
  presence_penalty: number;
  frequency_penalty: number;
  top_p: number;
}

修改为

interface RequestPayloadForByteDance {
  messages: {
    role: "system" | "user" | "assistant";
    content: string | MultimodalContent[];
  }[];
  stream?: boolean;
  model: string;
  temperature: number;
  presence_penalty: number;
  frequency_penalty: number;
  top_p: number;
  max_tokens?: number;
}

第二处:

const requestPayload: RequestPayloadForByteDance = {
      messages,
      stream: shouldStream,
      model: modelConfig.model,
      temperature: modelConfig.temperature,
      presence_penalty: modelConfig.presence_penalty,
      frequency_penalty: modelConfig.frequency_penalty,
      top_p: modelConfig.top_p,
    };

修改为

const requestPayload: RequestPayloadForByteDance = {
      messages,
      stream: shouldStream,
      model: modelConfig.model,
      temperature: modelConfig.temperature,
      presence_penalty: modelConfig.presence_penalty,
      frequency_penalty: modelConfig.frequency_penalty,
      top_p: modelConfig.top_p,
      max_tokens: 16384,
    };

mqfs avatar Mar 09 '25 08:03 mqfs

我也有这样的问题,用的是第三方提供的 deepseek-r1-search 模型(应该是逆向的 deepseek 网页),然后接的 new-api 提供服务,在 NextChat 已经尝试修改 max_token 无果 在 new-api 的 Playguard 上测试输出正常无截断,但中途有一两次卡住然后突然出来一大截,估计是请求超时的问题 (主要现在在外面用手机不太方便,晚点我浏览器F12看看能不能发现什么问题) 找到问题之所在了,因为是逆向模型,模型名没有经过特殊适配,还用的是默认的超时时间,改一下就正常了 a5a9768 其他模型我还没测试暂时也没碰到更多问题,但估计出这种问题的都是思考模型,遇到相同问题的建议报一下模型名称 估计得模糊匹配一下思考模型单独设置超时时间,或者给个变量 设置项之类的方便改🤔

楼上这位找到了其中之一问题所在,不过没给具体代码如何修改。当然除了这个问题,还有另一个问题前面也有人说了可能和max_tokens有关,火山引擎的deepseek模型默认是4096(目前作者未提供max_tokens配置),最大支持16384。

看作者没回复,我在这里先给个临时的解决方案,使用该解决方案后火山引擎只能使用deepseek-r1/v3模型。 第一个问题是模型名没匹配上导致取的超时时间有误,需要修改app/utils.ts文件,增加自定义接入点名称bot-xxxx-xxxx,其中模型自定义接入点ep开头,创建的联网搜索版应用bot开头。

export function getTimeoutMSByModel(model: string) {
  model = model.toLowerCase();
  if (
      model.startsWith("dall-e") ||
      model.startsWith("dalle") ||
      model.startsWith("o1") ||
      model.startsWith("o3") ||
      model.includes("deepseek-r") ||
      model.includes("-thinking")
  )
    return REQUEST_TIMEOUT_MS_FOR_THINKING;
  return REQUEST_TIMEOUT_MS;
}

修改为

export function getTimeoutMSByModel(model: string) {
  model = model.toLowerCase();
  if (
      model.startsWith("dall-e") ||
      model.startsWith("dalle") ||
      model.startsWith("o1") ||
      model.startsWith("o3") ||
      model.includes("deepseek-r") ||
      model.includes("-thinking") ||
      model.includes("bot-xxxx-xxxx")
  )
    return REQUEST_TIMEOUT_MS_FOR_THINKING;
  return REQUEST_TIMEOUT_MS;
}

第二个问题是模型名没匹配上导致取的超时时间有误,需要修改app/client/platforms/bytedance.ts文件的两处地方,在调api时增加max_tokens属性,并且强制设置为16384。 第一处:

interface RequestPayloadForByteDance {
  messages: {
    role: "system" | "user" | "assistant";
    content: string | MultimodalContent[];
  }[];
  stream?: boolean;
  model: string;
  temperature: number;
  presence_penalty: number;
  frequency_penalty: number;
  top_p: number;
}

修改为

interface RequestPayloadForByteDance {
  messages: {
    role: "system" | "user" | "assistant";
    content: string | MultimodalContent[];
  }[];
  stream?: boolean;
  model: string;
  temperature: number;
  presence_penalty: number;
  frequency_penalty: number;
  top_p: number;
  max_tokens?: number;
}

第二处:

const requestPayload: RequestPayloadForByteDance = {
      messages,
      stream: shouldStream,
      model: modelConfig.model,
      temperature: modelConfig.temperature,
      presence_penalty: modelConfig.presence_penalty,
      frequency_penalty: modelConfig.frequency_penalty,
      top_p: modelConfig.top_p,
    };

修改为

const requestPayload: RequestPayloadForByteDance = {
      messages,
      stream: shouldStream,
      model: modelConfig.model,
      temperature: modelConfig.temperature,
      presence_penalty: modelConfig.presence_penalty,
      frequency_penalty: modelConfig.frequency_penalty,
      top_p: modelConfig.top_p,
      max_tokens: 16384,
    };

按你这个第二处修改完,问问题后回答就出现这个报错,请问是怎么回事啊?

{ "error": true, "message": "empty response from server" }

jrsdhr avatar Apr 09 '25 13:04 jrsdhr