Skip to content

Commit

Permalink
HTML block: render as HTML, e.g. in case of a full proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Sep 29, 2023
1 parent 5272fa9 commit b2f7c6f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/apps/chat/components/message/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export function parseBlocks(forceText: boolean, text: string): Block[] {
if (forceText)
return [{ type: 'text', content: text }];

// noinspection HtmlRequiredTitleElement
// special case: this could be generated by a proxy that returns an HTML page instead of the API response
if (text.startsWith('<!DOCTYPE html') || text.startsWith('<head>\n'))
return [{ type: 'html', html: text }];

const regexPatterns = {
codeBlock: /`{3,}([\w\\.+-_]+)?\n([\s\S]*?)(`{3,}\n?|$)/g,
imageBlock: /(https:\/\/images\.prodia\.xyz\/.*?\.png)/g, // NOTE: only Prodia for now - but this shall be expanded to markdown images ![alt](url) or any png/jpeg
Expand Down

1 comment on commit b2f7c6f

@vercel
Copy link

@vercel vercel bot commented on b2f7c6f Sep 29, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

big-agi – ./

get.big-agi.com
big-agi-enricoros.vercel.app
big-agi-git-main-enricoros.vercel.app

Please sign in to comment.