Skip to content

Conversation

@embire2
Copy link

@embire2 embire2 commented Aug 24, 2025

Summary

  • Added automatic detection of markdown code blocks that appear outside artifact tags
  • Code blocks are now automatically wrapped with proper artifact/action tags
  • Prevents code from appearing in chat when AI models fail to use proper formatting

Problem

As reported in #1230, when AI models don't properly format their responses with artifact tags, code blocks would appear directly in the chat interface instead of being generated as files in the workspace. This created a poor user experience and made it difficult to work with the generated code.

Solution

The message parser now includes a fallback mechanism that:

  1. Detects markdown code fences (```) outside of artifact tags
  2. Extracts the language identifier and code content
  3. Automatically generates appropriate artifact and action tags
  4. Routes the code to file generation instead of chat output
  5. Supports 60+ programming languages with automatic file extension mapping

Test Plan

  • Build passes without errors
  • TypeScript checks pass
  • ESLint passes
  • Code blocks without artifact tags are properly converted to files
  • Existing artifact tag functionality remains unchanged
  • Language detection properly maps to file extensions

Changes

  • Modified /app/lib/runtime/message-parser.ts to add fallback code detection
  • Added #getFileExtension() helper method with comprehensive language mapping
  • Added artifact counter to generate unique file names for auto-detected code

Fixes #1230

Co-Authored-By: Keoma Wright founder@lovemedia.org.za

Stijnus and others added 30 commits February 18, 2025 16:30
Previously only the enabled state was being saved to cookies, causing loss of provider configuration like baseURL.
Removed the settings button in the landingpage.
…UGFIX

fix: for remove settings icon _index.tsx
…f-view-v2"

This reverts commit 871aefb, reversing
changes made to 8c72ed7.
- Implemented a new Diff View in the Workbench to visualize file changes
- Added file history tracking with detailed change information
- Enhanced FileTree and FileModifiedDropdown to show line additions and deletions
- Integrated file history saving and retrieval in ActionRunner
- Updated Workbench view types to include 'diff' option
- Added support for inline and side-by-side diff view modes
Exteneded the workflow/action to also deploy a stable release container
the npm install -g corepack@latest is supposed to make problems with the main docker build
…ange detection

- Improved diff algorithm to detect more granular line and character-level changes
- Added support for character-level highlighting in diff view
- Simplified diff view mode by removing side-by-side option
- Updated component rendering to support more detailed change visualization
- Optimized line change detection with improved matching strategy
- Removed lucide-react and next-themes from package dependencies
- Simplified import in workbench store for path and file-saver
- Removed unnecessary module definition in Vite config
- Added dark/light theme support for syntax highlighting
- Enhanced color styles for added/removed lines and characters
- Integrated theme store to dynamically adjust syntax highlighter theme
- Refined color contrast for better readability across themes
Improve connections visually and functionality
- improved organisation of connections (collapsibles)
- improved deploy button
- improved unique chat deployments
netlify deploy button to be disabled on streaming and show link icon when deployed
xKevIsDev and others added 28 commits July 9, 2025 00:37
feat: add SolidJS starter template and update icon files
Add  MCP integration including:
- New MCP settings tab with server configuration
- Tool invocation UI components
- API endpoints for MCP management
- Integration with chat system for tool execution
- Example configurations
…source file handling

- Implemented a function to detect project frameworks based on package.json and configuration files.
- Added support for including source files in the deployment request for frameworks that require building.
- Updated the action function to handle framework detection and adjust deployment configuration accordingly.
- Removed unnecessary console logs and improved error handling for file reading operations.
add glowing effect component for tab tiles
improve tab tile appearance with new glow effect
add 'none' log level and simplify log level handling
simplify tab configuration store by removing developer tabs
remove useDebugStatus hook and related debug functionality
remove system info endpoints no longer needed
Add LLM error alert functionality to display specific error messages based on API responses. Introduce new LlmErrorAlertType interface for structured error alerts. Update chat components to manage and display LLM error alerts effectively, improving user feedback during error scenarios.
- Remove getPackageJson and getGitInfo from vite config
- Remove Updates tab and all related logic as there was no true update logic in the codebase
- Introduced a new SolidJS starter template with relevant metadata including description, tags, and GitHub repository link.
- Updated the FrameworkLink component to enhance the hover effect with grayscale transition.
- Replaced multiple SVG icons with updated versions for Angular, Astro, Qwik, React, Remix, Slidev, Svelte, TypeScript, Vite, and Vue, ensuring improved visuals and consistency across the application.
Add  MCP integration including:
- New MCP settings tab with server configuration
- Tool invocation UI components
- API endpoints for MCP management
- Integration with chat system for tool execution
- Example configurations
feat(mcp): add Model Context Protocol integration
…nents

- Moved the Markdown rendering for content in AssistantMessage to a new position for better structure.
- Updated ToolInvocations component to enhance UI with improved spacing and keyboard shortcut handling for tool execution.
- Added state management for expanded tool details and integrated keyboard shortcuts for approving and rejecting tool calls.
refactor(chat): streamline AssistantMessage and ToolInvocations components
…ges of new parts object

- Introduced a `sanitizeText` function to remove specific HTML elements and content from messages, enhancing the integrity of the streamed text.
- Updated the `streamText` function to utilize `sanitizeText` for both user and assistant messages, ensuring consistent message formatting.
- Adjusted message processing to maintain the structure while applying sanitization.
fix: add text sanitization function to clean user and assistant messages of new parts object
- Changed the maxTokenAllowed property to use Math.min for limiting the value to a maximum of 16384 tokens, ensuring better control over context window size.
fix: update Groq maxTokenAllowed calculation to enforce upper limit
…outer

- Introduced a helper function `isModelLikelyFree` to identify models that are free based on their label or name.
- Added a toggle button to filter models, allowing users to view only free models when using the OpenRouter provider.
- Updated the model filtering logic to incorporate the free models filter and adjusted the UI to reflect the count of free models found.
- Reset the free models filter when the provider changes to ensure accurate results.
… rendering

- Updated UserMessage to accept a new `parts` prop for handling different message types, including images.
- Refactored image handling to extract and display images from the parts array, ensuring proper rendering of image content.
- Adjusted the layout and styling of the UserMessage component for better visual presentation.
feat: add filter for free models in ModelSelector component for OpenRouter
fix: enhance UserMessage component to support image parts and improve rendering
- Removed the `signDlls` option from the `electron-builder.yml` configuration.
- Updated `electron-store` to version 10.1.0 and `electron-builder` to version 26.0.12 in `package.json`. Ensuring compatibility and improved functionality.
fix: update dependencies and config to fix conflicts for electron build
fix: remove logging of messages from chat.client
When AI models fail to use proper artifact tags, code blocks now get
automatically detected and converted to file artifacts, preventing code
from appearing in chat. The parser detects markdown code fences outside
artifacts and wraps them with proper artifact/action tags.

This fixes the issue where code would randomly appear in chat instead
of being generated as files in the workspace.

Fixes stackblitz-labs#1230

Co-Authored-By: Keoma Wright <founder@lovemedia.org.za>
@embire2
Copy link
Author

embire2 commented Aug 24, 2025

Closing - this fix was meant for bolt.diy, not bolt.new. My apologies for the confusion.

@embire2 embire2 closed this Aug 24, 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.