Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 总结历史会话时,会有一条空的system 消息,导致 LM Studio 报错 #4667

Closed
1 of 3 tasks
digitXen opened this issue May 12, 2024 · 13 comments
Closed
1 of 3 tasks
Labels
bug Something isn't working

Comments

@digitXen
Copy link

Bug Description

当历史消息压缩启用时,向 API 接口发送的的 POST 请求中,messages的第一条 syetem 消息 content 为空。

 Received POST request to /v1/chat/completions with body: {
  "messages": [
    {
      "role": "system",
      "content": ""
    },
    {
      "role": "user",
      "content": "你是谁?"
    },
... 中间省略
,
    {
      "role": "system",
      "content": "简要总结一下对话内容,用作后续的上下文提示 prompt,控制在 200 字以内"
    }
  ],

而用 LM Studio进行推理时,不能接受空消息,报错如下内容:

 [Server Error] {"title":"'messages' array must only contain objects with a 'content' field that is not empty"}

Steps to Reproduce

启用历史消息压缩,即可能有此问题。

另外,当对话历史中存在空消息(如在大模型推理输出前就进行中断,产生了一条空的消息记录)时,LM Studio 即会报错。

Expected Behavior

希望在发送推理请求时,自动去掉 content 为空的消息。

Screenshots

No response

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

MacOS

Desktop Browser

Firefox

Desktop Browser Version

No response

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

@digitXen digitXen added the bug Something isn't working label May 12, 2024
@Issues-translate-bot
Copy link

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


Title: [Bug] When summarizing historical sessions, there will be an empty system message, causing LM Studio to report an error

@hossain666

This comment was marked as spam.

@hossain666

This comment was marked as spam.

@hossain666

This comment was marked as spam.

@hossain666

This comment was marked as spam.

@Issues-translate-bot
Copy link

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


[]

@hossain666

This comment was marked as spam.

@hossain666

This comment was marked as spam.

@Issues-translate-bot
Copy link

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


[]

@Dean-YZG
Copy link
Contributor

产生空系统消息的原因一般是:历史消息长度大于设定的压缩消息长度阈值 ,会发起一次对话,用于总结历史消息,同时携带上一次的『总结』,这样的方式来生成新的『总结』,作为新的『压缩消息』,但是,有时『上一次的总结』不存在,例如被清空,或是第一次发起『消息压缩』,这是逻辑默认增加一个空字符串作为『上一次总结』。这个pr兼容不支持空字符串的模型,将空字符串修改为";"
#4671

@Issues-translate-bot
Copy link

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


The reason for generating empty system messages is generally that the length of historical messages is greater than the set compression message length threshold. A dialogue will be initiated to summarize historical messages and carry the last "summary". In this way, a new "summary" is generated. ”, as a new “compressed message”, however, sometimes the “last summary” does not exist, for example, it is cleared, or the “message compression” is initiated for the first time, this is the logical default to add an empty string as the “last summary” Summarize". This PR is compatible with models that do not support empty strings. Change the empty string to ";"
#4671

@Dean-YZG
Copy link
Contributor

目前,最新的解决方式为判断是否有『历史总结』,若无,则不会在消息中携带『历史总结』,修复代码已合并入主干

@Issues-translate-bot
Copy link

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


Currently, the latest solution is to determine whether there is a "history summary". If not, the "history summary" will not be carried in the message. The repair code has been merged into the trunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants