Spaces:
Runtime error
Runtime error
File size: 1,910 Bytes
629069a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
<b>Instructions</b>:
<span style="color: green;">Use the following pieces of context to answer the question at the end.<br>If you don't know the answer, just say that you don't know, <span style="color: green; font-weight: bold;">don't try to make up an answer.</span></span><br>
<b>Context</b>:
{% for doc in documents %}
<div id="box{{ loop.index }}" class="doc-box">
<div class="doc-label"><b>Doc {{ loop.index }}</b></div>
<span id="doc{{ loop.index }}-short" class="doc-short">{{ doc.content[:50] }}...</span>
<span id="doc{{ loop.index }}-full" class="doc-full">{{ doc.content }}</span>
</div>
{% endfor %}
<b>Query</b>: <span style="color: yellow;">{{ query }}</span>
<style>
.doc-box {
border: 2px solid #aaa;
padding: 10px;
margin-top: 10px;
border-radius: 5px;
background-color: #1E90FF;
position: relative;
cursor: pointer;
}
.doc-label {
font-size: 0.8em;
position: absolute;
top: 10px;
left: 10px;
}
.doc-short, .doc-full {
color: white;
display: block;
margin-top: 20px;
}
.doc-full {
display: none;
}
</style>
<script>
document.addEventListener("DOMContentLoaded", function() {
{% for doc in documents %}
document.getElementById("box{{ loop.index }}").addEventListener("click", function() {
toggleContent('doc{{ loop.index }}');
});
{% endfor %}
});
function toggleContent(docID) {
var shortContent = document.getElementById(docID + '-short');
var fullContent = document.getElementById(docID + '-full');
if (fullContent.style.display === 'none') {
shortContent.style.display = 'none';
fullContent.style.display = 'block';
} else {
shortContent.style.display = 'block';
fullContent.style.display = 'none';
}
}
</script>
|