Skip to content

[Bug] 生成的 xml 出错导致整个流程阻塞 #240

@liunux4odoo

Description

@liunux4odoo

Note: This template is just a guide. Feel free to ignore the format entirely - any feedback is welcome! Don't let the template stop you from sharing your thoughts.

Bug Description

## Error Type
Runtime Error

## Error Message
Error replacing nodes: Error: Invalid nodes: Could not find or create <root> element


 at replaceNodes (lib/utils.ts:233:15)
 at ChatMessageDisplay.useCallback[handleDisplayChart] (components/chat-message-display.tsx:283:49)
 at ChatMessageDisplay.useEffect (components/chat-message-display.tsx:337:33)
 at ChatMessageDisplay.useEffect (components/chat-message-display.tsx:316:31)
 at ChatMessageDisplay.useEffect (components/chat-message-display.tsx:314:18)
 at ChatPanel (components/chat-panel.tsx:1126:17)
 at Home (app/page.tsx:181:25)

## Code Frame
 231 | return serializer.serializeToString(currentDoc)
 232 | } catch (error) {
> 233 | throw new Error(`Error replacing nodes: ${error}`)
 | ^
 234 | }
 235 | }
 236 |

Next.js version: 16.0.7 (Turbopack)

Steps to Reproduce

不太好复现,要等 LLM 生成错误的 xml

Expected Behavior

  1. 服务器能支持会话
  2. 更好的错误处理

Actual Behavior

一旦 LLM 返回内容出错,马上导致整个应用不可用,即便重启服务器也是自动恢复到出错的状态,无法进一步操作。

Environment

  • OS: windows 10
  • Browser: firefox latest
  • Version: c9b60bf

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions