Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

fix embed wrapper not invoking immediately

Daniel Avila8e5148b39019
diff --git a/src/components/Messages/TextWrapper.jsx b/src/components/Messages/TextWrapper.jsx
index 54252a9438..7f76a9c28b 100644
--- a/src/components/Messages/TextWrapper.jsx
+++ b/src/components/Messages/TextWrapper.jsx
@@ -38,7 +38,7 @@ export default function TextWrapper({ text }) {
let embedTest = false;
// to match unenclosed code blocks
- if (text.match(/```/g)?.length === 1 && text.match(/```(\w+)/)) {
+ if (text.match(/```/g)?.length === 1) {
// if (text.match(/```/g)?.length === 1) {
// const splitString = text.split('```')[1].split(/\s+/).slice(1).join('').trim();
// embedTest = splitString.length > 0;
diff --git a/src/utils/regexSplit.js b/src/utils/regexSplit.js
index 778363e3b2..b7dfe79c78 100644
--- a/src/utils/regexSplit.js
+++ b/src/utils/regexSplit.js
@@ -2,11 +2,11 @@ const regex = /```([^`\n]*?)\n([\s\S]*?)\n```/g;
const unenclosedCodeTest = (text) => {
let workingText = text;
- if (workingText.startsWith('<') || (!workingText.startsWith('`') && workingText.match(/```/g)?.length === 1)) {
- workingText = `\`\`\`${workingText}`
- }
+ // if (workingText.startsWith('<') || (!workingText.startsWith('`') && workingText.match(/```/g)?.length === 1)) {
+ // workingText = `\`\`\`${workingText}`
+ // }
- return workingText;
+ return workingText.trim();
};
export default function regexSplit(string) {
@@ -36,21 +36,5 @@ export default function regexSplit(string) {
}
}
- console.log(output);
-
- // for (let i = 0; i < matches.length; i++) {
- // const [fullMatch, language, code] = matches[i];
- // output.push(`\`\`\`${language}\n${code}\n\`\`\``);
- // if (i < matches.length - 1 && matches[i + 1]) {
- // const nextText = string.slice(matches[i].index + fullMatch.length, matches[i + 1].index);
- // output.push(nextText.trim());
- // } else if (i === matches.length - 1) {
- // const nextText = string.slice(matches[i].index + fullMatch.length);
- // output.push(nextText.trim());
- // }
- // }
-
- // console.log(output);
-
return output;
}