From 52c644798d307210e24a6c74de36bf747e321834 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 20 Nov 2024 18:53:19 +1100 Subject: [PATCH] DEV: improve artifact presentation (#932) 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 --- .../ai_bot/artifacts_controller.rb | 1 + .../shared_ai_conversations/show.html.erb | 2 +- config/locales/server.en.yml | 1 + lib/ai_bot/tools/create_artifact.rb | 10 ++++-- .../ai_bot/tools/create_artifact_spec.rb | 36 +++++++++++++++++++ .../ai_bot/artifacts_controller_spec.rb | 3 +- 6 files changed, 48 insertions(+), 5 deletions(-) diff --git a/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb b/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb index ac3b9d86..3ae65ef8 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 @@ module DiscourseAi 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 ac307a9b..b72ea2b5 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 @@ "> - "> + ">