diff --git a/app.py b/app.py index a4944f4..73d5e1a 100644 --- a/app.py +++ b/app.py @@ -40,6 +40,8 @@ app.config["SQLALCHEMY_DATABASE_URI"] = ( f"sqlite:///{os.path.join(app.instance_path, 'chat.db')}" ) app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False +# Enable template auto-reload to prevent stale templates during development +app.config["TEMPLATES_AUTO_RELOAD"] = True db.init_app(app) diff --git a/templates/chat.html b/templates/chat.html index ac3f6d5..fd65cd7 100644 --- a/templates/chat.html +++ b/templates/chat.html @@ -1368,8 +1368,11 @@ function addCopyButtonToCodeBlock(block, wasTruncated = false) { buttonContainer.appendChild(copyButton); buttonContainer.appendChild(playButton); - // Insert the button container after the code block - block.parentNode.insertBefore(buttonContainer, block.nextSibling); + // Insert the button container after the
element (not inside it)
+ // block is , block.parentNode is
+ // We want to insert after , so we use .parentNode and .nextSibling
+ const preElement = block.parentNode;
+ preElement.parentNode.insertBefore(buttonContainer, preElement.nextSibling);
}
// Function to execute code block content