Skip to content
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

Chat page is broken - Throws error when the chat reponse has code snippet #1707

Open
raolak opened this issue Sep 2, 2024 · 0 comments
Open

Comments

@raolak
Copy link

raolak commented Sep 2, 2024

Describe the bug
When the chat response has code blocks then rendering is throwing error

Unexpected Application Error!
Cannot assign to read only property '0' of string 'import { defineConfig } from 'modernjs-builder'; export default defineConfig({ source: { entries: { main: './src/index.js', }, }, output: { path: './dist', filename: '[name].[hash].js', publicPath: '/', }, devServer: { port: 8082, open: true, hot: true, }, module: { rules: [ { test: /.tsx?$/, use: 'ts-loader', exclude: /node_modules/, }, { test: /.css$/, use: ['style-loader', 'css-loader'], }, ], }, resolve: { extensions: ['.ts', '.tsx', '.js'], }, plugins: [], }); '

Example content unable to render
my-todo-app/
├── public/
│ └── index.html
├── src/
│ ├── components/
│ │ ├── TodoItem.js
│ │ └── TodoList.js
│ ├── App.js
│ └── index.js
├── .gitignore
├── package.json
├── README.md
└── webpack.config.js

...

Possible fix...wrap the chat message with Markdown renderers like ReactMarkdown ..or provide specialised Renderer based on chat repsponse that UI can decide which renderer to use ...thats chat response will be processed through chain of renderers to provide both static and dynamic treatment to chat response...

For quick fix
import ReactMarkdown from 'react-markdown';
{chatMessage}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To triage
Development

No branches or pull requests

1 participant