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] 当对话输出存在较长代码,模型回答完之后,无法结束当前对话,随后当轮对话消失,并且这个对话也无法再继续 #5756

Open
SamDu1998 opened this issue Feb 5, 2025 · 3 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@SamDu1998
Copy link

📦 Environment

Docker

📌 Version

latest

💻 Operating System

Ubuntu

🌐 Browser

Chrome

🐛 Bug Description

如下用对话生成的Bug描述,当中包含了Python代码,这个对话就会已知卡在无法结束的状态,然后进入对话消失,无法继续对话的状态。只能刷新页面,开启新的对话。
部署环境是Oracle的 ARM机子,Ubuntu24系统。Docker Compose部署

Bug 描述

概要:

当对话中包含较长的 Python 代码块时,模型在回答完后无法正常结束当前对话,随后该轮对话消失,且该对话无法继续。短代码或纯文本对话正常。

重现步骤:

  1. 开始一个新的对话。
  2. 向模型提问,该问题应诱导模型输出包含较长 Python 代码块的回答 (例如:"请帮我写一个计算斐波那契数列的 Python 程序,要求可以计算到第1000项")。
  3. 等待模型输出完整的代码和解释。
  4. 尝试继续对话。

预期结果:

  • 模型在输出完较长的 Python 代码后,对话仍然可以继续。
  • 用户可以继续输入并获得模型的回复。
  • 对话记录能够正常保存和显示。

实际结果:

  • 模型输出完较长的 Python 代码后,当前对话似乎卡住,无法继续输入。
  • 过了一段时间后,该轮对话消失。

示例:

触发 Bug 的示例对话:

用户: 请帮我写一个计算斐波那契数列的 Python 程序,要求可以计算到第1000项。

模型:

def fibonacci(n):
  """
  这个函数用来计算斐波那契数列的第 n 项。
  """
  if n <= 0:
    return "输入必须大于 0"
  elif n == 1:
    return 0
  elif n == 2:
    return 1
  else:
    a, b = 0, 1
    for _ in range(3, n + 1):
      a, b = b, a + b
    return b

# 输出前 10 项进行测试
for i in range(1, 11):
    print(f"fibonacci({i}) = {fibonacci(i)}")

# 计算第1000项
print(f"fibonacci(1000) = {fibonacci(1000)}")

(模型完成输出后,对话卡住,随后这一轮模型的回复消失了)

正常运行的示例对话:

用户: 你好!

模型: 你好!

用户: 今天天气怎么样?

模型: 今天天气晴朗,阳光明媚。

备注:

  • 简单的 "Hello, World!" 程序或纯文本对话不会触发此 Bug。
  • (可选) 尝试过的解决方案: (请在此处描述您尝试过的解决方案,例如:刷新页面、重启浏览器等)

截图/录屏:

Image

Image

Image

📷 Recurrence Steps

重现步骤:

  1. 开始一个新的对话。
  2. 向模型提问,该问题应诱导模型输出包含较长 Python 代码块的回答 (例如:"请帮我写一个计算斐波那契数列的 Python 程序,要求可以计算到第1000项")。
  3. 等待模型输出完整的代码和解释。
  4. 尝试继续对话。

🚦 Expected Behavior

预期结果:

  • 模型在输出完较长的 Python 代码后,对话仍然可以继续。
  • 用户可以继续输入并获得模型的回复。
  • 对话记录能够正常保存和显示。

📝 Additional Information

No response

@SamDu1998 SamDu1998 added the 🐛 Bug Something isn't working | 缺陷 label Feb 5, 2025
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Feb 5, 2025
@lobehubbot
Copy link
Member

👀 @SamDu1998

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 ENVIRONMENT

Docker

📌 version

latest

💻 Operating System

Ubuntu

🌐 Browser

Chrome

🐛 bug description

As follows, the bug description generated by the dialogue contains the Python code. This dialogue will be known to be stuck in a state that cannot be ended, and then enter the state of the conversation to disappear and cannot continue the conversation state. It can only refresh the page and open a new conversation.
The deployment environment is Oracle's ARM machine, Ubuntu24 system. Docker compose deployment

bug description

summary:

When the dialogue contains a longer Python code block, the model cannot end the current dialogue normally after the answer is completed, and then the conversation disappears, and the conversation cannot continue. Short code or pure text dialogue is normal.

** Reapped steps: **

  1. Start a new conversation.
  2. Ask the model, this question should induce the answer to the long Python code block (for example: please help me write a Python program that calculates the Fibonacci number column, and it is required to calculate to the 1000th ").
  3. Wait for the model to output complete code and explanation.
  4. Try to continue the dialogue.

** Expectation results: **

  • After the model is out of the Python code, the conversation can continue.
  • Users can continue to enter and get a recovery of the model.
  • Dialogue records can be stored and displayed normally.

** Actual results: **

  • After the model outputs the long Python code, the current dialogue seems to be stuck and cannot continue to input.
  • After a while, the conversation disappeared.

** Example: **

** Example dialogue to trigger bug: **

User: Please help me write a Python program that calculates the Fibonacci number column, which requires that it can be calculated to the 1,000th item.

Model:
`` `python
DEF Fibonacci (N):
"" ""
This function is used to calculate the nnth item of Fibona.
"" ""
if n <= 0:
Return "input must be greater than 0"
Elif n == 1:
Return 0
Elif n == 2:
Return 1
Else:
A, B = 0, 1
for _ in Range (3, N + 1):
A, B = B, A + B
Return b
"

Output the first 10 items for testing

for I in Range (1, 11):
Print (f "fibonacci ({i}) = {fibonacci (i)}")
"

Calculation No. 1000

Print (f "fibonacci (1000) = {fibonacci (1000)}")
`` `
"
(After the model completes the output, the dialog is stuck, and the reply of this round of model disappears)

** Normal running sample dialogue: **

User: Hello!

Model: Hello!

User: How is the weather today?

Model: The weather is clear today and sunny.

Remark:

  • Simple "Hello, World!" Program or pure text dialogue will not trigger this bug.
  • (Optional) Try solution: (Please describe the solution you have tried here, such as: refresh the page, restart browser, etc.)

** Screenshot/record screen: **

! [Image] (https://github.com/user-attachments/db998c5c5c-211F-4397-9243-858155172)))))

! [Image] (https://github.com/user-attachments/e7acccd8-36c6-42dd-A008-f7686bb84F8D))

! [Image] (https://github.com/user-attachments/ASSETS/F759D1C7-58cc-443C-AF-AF26DCCBC7C5)))))

📷 Recurrence Steps

** Reapped steps: **

  1. Start a new conversation.
  2. Ask the model, this question should induce the answer to the long Python code block (for example: please help me write a Python program that calculates the Fibonacci number column, and it is required to calculate to the 1000th ").
  3. Wait for the model to output complete code and explanation.
  4. Try to continue the dialogue.

🚦 Expected Behavior

** Expectation results: **

  • After the model is out of the Python code, the conversation can continue.
  • Users can continue to enter and get a recovery of the model.
  • Dialogue records can be stored and displayed normally.

📝 Additional information

NO Response @@ ==== [BUG] When there is a long code of the dialogue output, after the model is answered, it cannot end the current dialogue.

Copy link

dosubot bot commented Feb 5, 2025

Hi there, @SamDu1998! 👋 I'm here to help you with any bugs, questions, or contributions!

The issue you're experiencing with long Python code blocks causing the chat to freeze and the conversation to disappear might be related to how the chat framework handles long text or code blocks. The CodeBlock component is used to render code, and it processes the text to determine if it should be displayed as a single line or multiple lines [1]. However, there might be limitations or constraints when dealing with large text or code blocks that are not explicitly documented.

Here are a few suggestions to troubleshoot and potentially resolve the issue:

  1. Check Docker Resource Limits: Ensure that your Docker environment has sufficient resources allocated (CPU, memory) to handle large responses. Sometimes, insufficient resources can cause processes to hang or crash.

  2. Review Code Handling Logic: Investigate if there are any specific configurations or settings in the Docker deployment that could impact the handling of long code blocks or responses. Although no specific configurations were found in the repository, reviewing the deployment settings might help.

  3. Session Management: The chat framework has mechanisms for session management and recovery, such as session switching and refreshing [2]. Ensure these mechanisms are functioning correctly to prevent session loss.

  4. Error Handling and Logging: Enable debugging and check logs for any errors that occur when handling long responses. This might provide insights into what is causing the conversation to freeze or disappear [3][4].

If these steps do not resolve the issue, consider simplifying the code output or breaking it into smaller parts to see if that helps maintain the session stability.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

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
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

2 participants