diff --git a/rnacentral/apiv1/serializers.py b/rnacentral/apiv1/serializers.py index 78e25d662..20c556afc 100644 --- a/rnacentral/apiv1/serializers.py +++ b/rnacentral/apiv1/serializers.py @@ -930,9 +930,13 @@ class LitSummSerializer(serializers.Serializer): rna_id = serializers.CharField() display_id = serializers.CharField() - summary = serializers.CharField() + summary = serializers.SerializerMethodField() primary_id = serializers.CharField() + def get_summary(self, obj): + """Prefix the summary with a warning that it is AI-generated""" + return f"WARNING: This summary was generated by AI. {obj.summary}" + class RnaGenomeLocationsSerializer(serializers.Serializer): """Serializer class for Genome Locations""" diff --git a/rnacentral/portal/templates/portal/base.html b/rnacentral/portal/templates/portal/base.html index 1e0d19e4f..4b464db8f 100644 --- a/rnacentral/portal/templates/portal/base.html +++ b/rnacentral/portal/templates/portal/base.html @@ -284,6 +284,51 @@ (function(d, t) { var g = d.createElement(t);g.id = 'doorbellScript';g.type = 'text/javascript';g.async = true;g.src = 'https://embed.doorbell.io/button/2991?t='+(new Date().getTime());(d.getElementsByTagName('head')[0]||d.getElementsByTagName('body')[0]).appendChild(g); }(document, 'script')); + + // Wait for doorbell to load + (function() { + var ALLOWED_DOCBOT_ORIGINS = [ + 'https://wwwdev.ebi.ac.uk/docbot', + 'http://localhost:8000' // dev + ]; + + var params = new URLSearchParams(window.location.search); + if (params.get('source') !== 'docbot') return; + + var conversation = params.get('conversation') || ''; + if (!conversation) return; + + // Referrer origin + var referrer = document.referrer; + if (referrer) { + try { + var referrerOrigin = new URL(referrer).origin; + if (ALLOWED_DOCBOT_ORIGINS.indexOf(referrerOrigin) === -1) return; + } catch (e) { + return; + } + } + + // Poll until doorbell is available + var attempts = 0; + var interval = setInterval(function() { + if (++attempts > 50) { clearInterval(interval); return; } + if (typeof doorbell === 'undefined') return; + clearInterval(interval); + + doorbell.setOption('onShow', function() { + var textarea = document.getElementById('doorbell-feedback'); + if (textarea) { + textarea.value = conversation; + textarea.dispatchEvent(new Event('input', { bubbles: true })); + textarea.setSelectionRange(0, 0); + textarea.focus(); + } + }); + + doorbell.show(); + }, 100); + })(); $(function(){ $('.doorbell-feedback').on('click', function(){ doorbell.show(); diff --git a/rnacentral/portal/templates/portal/docs/training.md b/rnacentral/portal/templates/portal/docs/training.md index ed6357a2f..88186901d 100644 --- a/rnacentral/portal/templates/portal/docs/training.md +++ b/rnacentral/portal/templates/portal/docs/training.md @@ -82,6 +82,10 @@ RNAcentral has been described in several papers: Pubmed +### Other resources + +Explore community-contributed educational resources including tutorials, slides, and lecture materials: [Educational Resources Repository](https://github.com/RNAcentral/rna-educational-resources). + ### Feedback Let us know what you think by getting in touch on [Twitter](https://twitter.com/rnacentral),