]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Add Jina's QA Bot to the docs to help people that want to ask quick questions ...
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 5 Mar 2022 18:49:15 +0000 (10:49 -0800)
committerGitHub <noreply@github.com>
Sat, 5 Mar 2022 18:49:15 +0000 (19:49 +0100)
Co-authored-by: yanlong.wang <yanlong.wang@naiver.org>
docs/en/overrides/main.html

index adc6f79fb7e7cc3722afa199343c61173b5ba3e0..5255bfd9b4121572a7109fa5ea2db8cf83a80fc5 100644 (file)
   </div>
 </div>
 {% endblock %}
+{%- block scripts %}
+{{ super() }}
+<!-- DocsQA integration start -->
+<script src="https://cdn.jsdelivr.net/npm/qabot@0.4"></script>
+<script>
+  // This prevents the global search from interfering with qa-bot's internal text input.
+  document.addEventListener('DOMContentLoaded', () => {
+    document.querySelectorAll('qa-bot').forEach((x) => {
+      x.addEventListener('keydown', (event) => {
+        event.stopPropagation();
+      });
+    });
+  });
+</script>
+<qa-bot 
+  server="https://tiangolo-fastapi.docsqa.jina.ai"
+  theme="infer" 
+  title="FastAPI Bot"
+  description="FastAPI framework, high performance, easy to learn, fast to code, ready for production"
+  style="font-size: 0.8rem"
+>
+  <template>
+      <dl>
+          <dt>You can ask questions about FastAPI. Try:</dt>
+          <dd>How do you deploy FastAPI?</dd>
+          <dd>What are type hints?</dd>
+          <dd>What is OpenAPI?</dd>
+      </dl>
+  </template>
+</qa-bot>
+<!-- DocsQA integration end -->
+{%- endblock %}