Spaces:
Sleeping
Sleeping
Keldos
commited on
Commit
•
d16fdf3
1
Parent(s):
7795280
BREAKING: 移除`render_latex`配置
Browse files- gradio在 https://github.com/gradio-app/gradio/commit/12470571c9251e55b44961e7e19654f0e0a33040 中加入了katex
tmd气人!又不给开发者留选择余地!!!
- ChuanhuChatbot.py +0 -1
- config_example.json +0 -1
- modules/config.py +0 -7
- modules/overwrites.py +2 -6
ChuanhuChatbot.py
CHANGED
@@ -88,7 +88,6 @@ with gr.Blocks(css=customCSS, theme=small_and_beautiful_theme) as demo:
|
|
88 |
with gr.Row():
|
89 |
single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False)
|
90 |
use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False)
|
91 |
-
# render_latex_checkbox = gr.Checkbox(label=i18n("渲染LaTeX公式"), value=render_latex, interactive=True, elem_id="render_latex_checkbox")
|
92 |
language_select_dropdown = gr.Dropdown(
|
93 |
label=i18n("选择回复语言(针对搜索&索引功能)"),
|
94 |
choices=REPLY_LANGUAGES,
|
|
|
88 |
with gr.Row():
|
89 |
single_turn_checkbox = gr.Checkbox(label=i18n("单轮对话"), value=False)
|
90 |
use_websearch_checkbox = gr.Checkbox(label=i18n("使用在线搜索"), value=False)
|
|
|
91 |
language_select_dropdown = gr.Dropdown(
|
92 |
label=i18n("选择回复语言(针对搜索&索引功能)"),
|
93 |
choices=REPLY_LANGUAGES,
|
config_example.json
CHANGED
@@ -16,7 +16,6 @@
|
|
16 |
// "https_proxy": "http://127.0.0.1:1079",
|
17 |
// "http_proxy": "http://127.0.0.1:1079",
|
18 |
// 是否默认渲染LaTeX
|
19 |
-
"render_latex": true,
|
20 |
"users": [], // 用户列表,[[用户名1, 密码1], [用户名2, 密码2], ...]
|
21 |
"local_embedding": false, //是否在本地编制索引
|
22 |
"hide_history_when_not_logged_in": false, //未登录情况下是否不展示对话历史
|
|
|
16 |
// "https_proxy": "http://127.0.0.1:1079",
|
17 |
// "http_proxy": "http://127.0.0.1:1079",
|
18 |
// 是否默认渲染LaTeX
|
|
|
19 |
"users": [], // 用户列表,[[用户名1, 密码1], [用户名2, 密码2], ...]
|
20 |
"local_embedding": false, //是否在本地编制索引
|
21 |
"hide_history_when_not_logged_in": false, //未登录情况下是否不展示对话历史
|
modules/config.py
CHANGED
@@ -18,7 +18,6 @@ __all__ = [
|
|
18 |
"log_level",
|
19 |
"advance_docs",
|
20 |
"update_doc_config",
|
21 |
-
"render_latex",
|
22 |
"usage_limit",
|
23 |
"multi_api_key",
|
24 |
"server_name",
|
@@ -82,12 +81,6 @@ os.environ["MINIMAX_API_KEY"] = minimax_api_key
|
|
82 |
minimax_group_id = config.get("minimax_group_id", "")
|
83 |
os.environ["MINIMAX_GROUP_ID"] = minimax_group_id
|
84 |
|
85 |
-
render_latex = config.get("render_latex", True)
|
86 |
-
|
87 |
-
if render_latex:
|
88 |
-
os.environ["RENDER_LATEX"] = "yes"
|
89 |
-
else:
|
90 |
-
os.environ["RENDER_LATEX"] = "no"
|
91 |
|
92 |
usage_limit = os.environ.get("USAGE_LIMIT", config.get("usage_limit", 120))
|
93 |
|
|
|
18 |
"log_level",
|
19 |
"advance_docs",
|
20 |
"update_doc_config",
|
|
|
21 |
"usage_limit",
|
22 |
"multi_api_key",
|
23 |
"server_name",
|
|
|
81 |
minimax_group_id = config.get("minimax_group_id", "")
|
82 |
os.environ["MINIMAX_GROUP_ID"] = minimax_group_id
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
usage_limit = os.environ.get("USAGE_LIMIT", config.get("usage_limit", 120))
|
86 |
|
modules/overwrites.py
CHANGED
@@ -9,7 +9,6 @@ import inspect
|
|
9 |
|
10 |
from modules.presets import *
|
11 |
from modules.index_func import *
|
12 |
-
from modules.config import render_latex
|
13 |
|
14 |
|
15 |
def postprocess(
|
@@ -76,11 +75,8 @@ with open("./assets/custom.js", "r", encoding="utf-8") as f, \
|
|
76 |
def reload_javascript():
|
77 |
print("Reloading javascript...")
|
78 |
js = f'<script>{customJS}</script><script async>{externalScripts}</script>'
|
79 |
-
if render_latex:
|
80 |
-
|
81 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML"></script>
|
82 |
-
<script type="text/x-mathjax-config">MathJax.Hub.Config({skipStartupTypeset: false, tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']],displayMath: [['$$','$$'], ['\\[','\\]']]}});</script>
|
83 |
-
"""
|
84 |
def template_response(*args, **kwargs):
|
85 |
res = GradioTemplateResponseOriginal(*args, **kwargs)
|
86 |
res.body = res.body.replace(b'</html>', f'{js}</html>'.encode("utf8"))
|
|
|
9 |
|
10 |
from modules.presets import *
|
11 |
from modules.index_func import *
|
|
|
12 |
|
13 |
|
14 |
def postprocess(
|
|
|
75 |
def reload_javascript():
|
76 |
print("Reloading javascript...")
|
77 |
js = f'<script>{customJS}</script><script async>{externalScripts}</script>'
|
78 |
+
# if render_latex:
|
79 |
+
# js += """\"""
|
|
|
|
|
|
|
80 |
def template_response(*args, **kwargs):
|
81 |
res = GradioTemplateResponseOriginal(*args, **kwargs)
|
82 |
res.body = res.body.replace(b'</html>', f'{js}</html>'.encode("utf8"))
|