Keldos commited on
Commit
4283a5e
1 Parent(s): d165b48

refactor: load-mathjax -> external-scripts

Browse files
assets/{load-mathjax.js → external-scripts.js} RENAMED
@@ -1,3 +1,4 @@
 
1
  // window.MathJax = {
2
  // tex: {
3
  // inlineMath: [['$', '$'], ['\\(', '\\)']]
 
1
+
2
  // window.MathJax = {
3
  // tex: {
4
  // inlineMath: [['$', '$'], ['\\(', '\\)']]
modules/overwrites.py CHANGED
@@ -76,15 +76,15 @@ def postprocess_chat_messages(
76
  else:
77
  raise ValueError(f"Invalid message for Chatbot component: {chat_message}")
78
 
79
- with open("./assets/custom.js", "r", encoding="utf-8") as f, open("./assets/Kelpy-Codos.js", "r", encoding="utf-8") as f2, open("./assets/load-mathjax.js", "r", encoding="utf-8") as f3:
80
  customJS = f.read()
81
  kelpyCodos = f2.read()
82
- loadMathjax = f3.read()
83
 
84
 
85
  def reload_javascript():
86
  print("Reloading javascript...")
87
- js = f'<script>{customJS}</script><script>{kelpyCodos}</script><script async>{loadMathjax}</script>'
88
  def template_response(*args, **kwargs):
89
  res = GradioTemplateResponseOriginal(*args, **kwargs)
90
  res.body = res.body.replace(b'</html>', f'{js}</html>'.encode("utf8"))
 
76
  else:
77
  raise ValueError(f"Invalid message for Chatbot component: {chat_message}")
78
 
79
+ with open("./assets/custom.js", "r", encoding="utf-8") as f, open("./assets/Kelpy-Codos.js", "r", encoding="utf-8") as f2, open("./assets/external-scripts.js", "r", encoding="utf-8") as f3:
80
  customJS = f.read()
81
  kelpyCodos = f2.read()
82
+ externalScripts = f3.read()
83
 
84
 
85
  def reload_javascript():
86
  print("Reloading javascript...")
87
+ js = f'<script>{customJS}</script><script>{kelpyCodos}</script><script async>{externalScripts}</script>'
88
  def template_response(*args, **kwargs):
89
  res = GradioTemplateResponseOriginal(*args, **kwargs)
90
  res.body = res.body.replace(b'</html>', f'{js}</html>'.encode("utf8"))