Skip to content

fix(stage-ui,stage-web): emit literals asap and show streaming messages#451

Merged
sumimakito merged 1 commit intomainfrom
fix/llm-parser-literal
Aug 26, 2025
Merged

fix(stage-ui,stage-web): emit literals asap and show streaming messages#451
sumimakito merged 1 commit intomainfrom
fix/llm-parser-literal

Conversation

@sumimakito
Copy link
Member

@sumimakito sumimakito commented Aug 25, 2025

  • Move back to the FSM-style opening/closing tags scanner in useLlmmarkerParser to emit literals ASAP, otherwise they are only emitted when a complete tag is parsed
    • Time complexity should be linear
    • Pass all tests in llmmarkerParser.test.ts
    • Fix: Emit special tokens with the surrounding <| and |> to keep the behavior untouched
    • Fix: Do not emit a literal if it's part of an incomplete special tag
  • Show the streaming message in the web chat history

@netlify
Copy link

netlify bot commented Aug 25, 2025

Deploy Preview for airi-vtuber ready!

Name Link
🔨 Latest commit cfe2d89
🔍 Latest deploy log https://app.netlify.com/projects/airi-vtuber/deploys/68ad96ae70a91b000891d4be
😎 Deploy Preview https://deploy-preview-451--airi-vtuber.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Aug 25, 2025

Deploy Preview for airi-docs ready!

Name Link
🔨 Latest commit cfe2d89
🔍 Latest deploy log https://app.netlify.com/projects/airi-docs/deploys/68ad96ae1982a20008f23e5e
😎 Deploy Preview https://deploy-preview-451--airi-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sumimakito sumimakito force-pushed the fix/llm-parser-literal branch from efb6b66 to b2506a7 Compare August 25, 2025 19:20
@skirkru
Copy link
Contributor

skirkru commented Aug 25, 2025

LGTM

Comment on lines +68 to +70
const codeBlockSystemPrompt = '- For any programming code block, always specify the programming language that supported on @shikijs/rehype on the rendered markdown, eg. ```python ... ```\n'
const mathSyntaxSystemPrompt = '- For any math equation, use LaTeX format, eg: $ x^3 $, always escape dollar sign outside math equation\n'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that we do prompt injecting.

Copy link
Contributor

@skirkru skirkru Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nekomeowww Yes, its can be omitted, its just enforcing the llm to use specific format to response with language and latex format, without that, it can be intermittence

Comment on lines +43 to +51
const openTagIndex = buffer.indexOf(TAG_OPEN)
if (openTagIndex < 0) {
if (buffer.length - 1 >= minLiteralEmitLength) {
const emit = buffer.slice(0, -1)
buffer = buffer[buffer.length - 1]
await options.onLiteral?.(emit)
}
break
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice way, thanks.

Comment on lines +52 to +70
async function handleFilePaste(files: File[]) {
for (const file of files) {
if (file.type.startsWith('image/')) {
const reader = new FileReader()
reader.onload = (e) => {
const base64Data = (e.target?.result as string)?.split(',')[1]
if (base64Data) {
attachments.value.push({
type: 'image' as const,
data: base64Data,
mimeType: file.type,
url: URL.createObjectURL(file),
})
}
}
reader.readAsDataURL(file)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image support?

@nekomeowww
Copy link
Member

We can merge if ready.

@nekomeowww
Copy link
Member

I merged it.

@sumimakito sumimakito force-pushed the fix/llm-parser-literal branch from 89b42d9 to cfe2d89 Compare August 26, 2025 11:12
@sumimakito sumimakito marked this pull request as ready for review August 26, 2025 11:14
@sumimakito sumimakito merged commit 36d74ca into main Aug 26, 2025
14 checks passed
@sumimakito sumimakito deleted the fix/llm-parser-literal branch August 26, 2025 11:32
Disqort pushed a commit to Disqort/airi that referenced this pull request Aug 29, 2025
lucas-oma pushed a commit to lucas-oma/airi that referenced this pull request Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants