llm-ui-kit / llm-ui

The React library for LLMs
https://llm-ui.com
MIT License
286 stars 9 forks source link

Link reference definitions are ignored if code block exists between definition and destination #275

Open vrslev opened 1 week ago

vrslev commented 1 week ago

This works:

[llm-ui][llm-ui-link]

hello

[llm-ui-link]: https://github.com/llm-ui-kit/llm-ui

This does not:

[llm-ui][llm-ui-link]

hello


[llm-ui-link]: https://github.com/llm-ui-kit/llm-ui

I think, it happens because code block is not detected correctly. I use useLLMOutput as documentation suggests:

const { blockMatches } = useLLMOutput({
    llmOutput: ...,
    fallbackBlock: {
        component: MarkdownComponent,
        lookBack: markdownLookBack(),
    },
    blocks: [
        {
            component: CodeBlock,
            findCompleteMatch: findCompleteCodeBlock(),
            findPartialMatch: findPartialCodeBlock(),
            lookBack: codeBlockLookBack(),
        },
    ],
    isStreamFinished: true,
});
richardgill commented 1 week ago

Hey @vrslev thanks for the report. This is definitely a bug.

I'll try and fix it for you in the next couple of days 👍

vrslev commented 1 week ago

Thanks, really appreciate it ❤️

vrslev commented 15 hours ago

Hey @richardgill Any update on this?