Skip to content

Error calling LLM Error: No operations seen #1793

Open
@BetterAndBetterII

Description

@BetterAndBetterII

Describe the bug
When I used the xl-ai package with different models, I encountered some failures in SuggestionMenuWithAI and Generate tasks.

I am not a professional front-end engineer, but I found some differences between the success cases and failure cases.

I reproduced this situation in the GitHub codespace:

FAIL src/api/formats/html-blocks/htmlBlocks.test.ts > Models > openai.chat/gpt-4o-2024-08-06 (streaming) > Add > Add heading (h1) and code block
Error: No operations seen
❯ Module.filterNewOrUpdatedOperations src/streamTool/filterNewOrUpdatedOperations.ts:55:11
53|
54| if (!lastOp) {
55| throw new Error("No operations seen");
| ^
56| }
57|
❯ Module.toValidatedOperations src/streamTool/toValidatedOperations.ts:22:20
❯ Module.filterValidOperations src/streamTool/filterValidOperations.ts:27:20
❯ Module.preprocessOperationsStreaming src/streamTool/preprocess.ts:41:3
❯ Object.start src/util/stream.ts:10:26

My reproduction method is relatively rough. I am not very good at adding new test cases. I replaced the existing test request response:
packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code I replaced the content of block_1_91d754a12d792f37fe1483d19a7b4e64.json with the content that will cause an error, and ran nx run @blocknote/xl-ai:test to reproduce the error.

Related Issue
#1744

To Reproduce

  1. Setup Test Environment
  2. Replace packages/xl-ai/src/api/formats/html-blocks/__snapshots__/htmlBlocks.test.ts/Add/__msw_snapshots__/openai.chat/gpt-4o-2024-08-06 (streaming)/Add heading (h1) and code I replaced the content of block_1_91d754a12d792f37fe1483d19a7b4e64.json with the attachtionment below
  3. run test pnpm test

Misc

  • Node version: v22.16
  • Package manager: pnpm v10.7.1
  • Browser: none
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Attachment

Add heading (h1) and code block_1_91d754a12d792f37fe1483d19a7b4e64.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions