From 77c66cf4cf5499cc728c84a6bcdc4110705f4eff Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Wed, 20 Nov 2024 18:26:16 +1100 Subject: [PATCH 1/2] DEV: improve artifact presentation 1. Keep source in a "details" block after rendered so it does not overwhelm users 2. Ensure artifacts are never indexed by robots 3. Cache break our CSS that changed recently --- .../discourse_ai/ai_bot/artifacts_controller.rb | 1 + .../ai_bot/shared_ai_conversations/show.html.erb | 2 +- config/locales/server.en.yml | 1 + lib/ai_bot/tools/create_artifact.rb | 8 ++++++-- spec/requests/ai_bot/artifacts_controller_spec.rb | 3 ++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb b/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb index ac3b9d860..3ae65ef81 100644 --- a/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb +++ b/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb @@ -68,6 +68,7 @@ def show response.headers.delete("X-Frame-Options") response.headers["Content-Security-Policy"] = "script-src 'unsafe-inline';" + response.headers["X-Robots-Tag"] = "noindex" # Render the content render html: trusted_html.html_safe, layout: false, content_type: "text/html" diff --git a/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb b/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb index ac307a9b2..b72ea2b5a 100644 --- a/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb +++ b/app/views/discourse_ai/ai_bot/shared_ai_conversations/show.html.erb @@ -10,7 +10,7 @@ "> - "> + ">