-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Nomnoml Renderer #526
Add Nomnoml Renderer #526
Conversation
Deploying chatcraft-org with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me.
We should consider an update to the default system prompt to use this.
Lets change it |
Hi @tarasglek, @humphd, I've updated the default system prompt following your suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's so cool! Looks good to me!
This fixes #466
Summary of Changes
This adds Nomnoml rendering support to ChatCraft using skanaar/nomnoml.
This feature was heavily based on Mermaid rendering support using mermaid-js. For example, Nomnoml rendering is handled by NomnomlPreview.tsx similar to how Mermaid rendering is handled by MermaidPreview.tsx, and similar to mermaid, the rendering is done in Markdown.tsx when a nomnoml code block is detected:
chatcraft.org/src/components/Markdown.tsx
Lines 108 to 115 in bb7c557
Differences from Mermaid rendering
Although this feature is modelled off of Mermaid rendering, due to the differences between the nomnoml and mermaid-js libraries I had to implement Nomnoml rendering differently:
No Error Message in the Nomnoml Preview
Whenever mermaidjs fails to render mermaid code, it renders an image in the preview, but
Nomnoml currently does not render an error image, so failed renders are rendered as a blank diagram instead:
No SVG ID value support
Unlike the mermaid-js render method, nomnoml's renderSvg method does not support an ID parameter, so in NomnomlPreview.tsx an ID value is not generated or assigned to the rendered SVG.
No config method/no way to directly modify default styling
Nomnoml currently (as of 1.6.2) does not expose a config method like mermaid.initialize.
This means there's currently no way to programatically modify the default styling of nomnoml diagrams.
However, nomnoml has directives that modify styling
Alternative Styling Modification
In the future, I see two ways users can reliably indirectly modify the styling:
However, both of these methods are heavily dependent on the LLM.
Even GPT-4 seems to hallucinate on nomnoml syntax when asked to modify styling, unless a directive example is provided