* Update version to 3.74 * Add support for Yi Model API (#1635) * 更新以支持零一万物模型 * 删除newbing * 修改config --------- Co-authored-by: binary-husky <qingxu.fu@outlook.com> * Refactor function signatures in bridge files * fix qwen api change * rename and ref functions * rename and move some cookie functions * 增加haiku模型,新增endpoint配置说明 (#1626) * haiku added * 新增haiku,新增endpoint配置说明 * Haiku added * 将说明同步至最新Endpoint --------- Co-authored-by: binary-husky <qingxu.fu@outlook.com> * private_upload目录下进行文件鉴权 (#1596) * private_upload目录下进行文件鉴权 * minor fastapi adjustment * Add logging functionality to enable saving conversation records * waiting to fix username retrieve * support 2rd web path * allow accessing default user dir --------- Co-authored-by: binary-husky <qingxu.fu@outlook.com> * remove yaml deps * fix favicon * fix abs path auth problem * forget to write a return * add `dashscope` to deps * fix GHSA-v9q9-xj86-953p * 用户名重叠越权访问patch (#1681) * add cohere model api access * cohere + can_multi_thread * fix block user access(fail) * fix fastapi bug * change cohere api endpoint * explain version * # fix com_zhipuglm.py illegal temperature problem (#1687) * Update com_zhipuglm.py # fix 用户在使用 zhipuai 界面时遇到了关于温度参数的非法参数错误 * allow store lm model dropdown * add a btn to reverse previous reset * remove extra fns * Add support for glm-4v model (#1700) * 修改chatglm3量化加载方式 (#1688) Co-authored-by: zym9804 <ren990603@gmail.com> * save chat stage 1 * consider null cookie situation * 在点击复制按钮时激活语音 * miss some parts * move all to js * done first stage * add edge tts * bug fix * bug fix * remove console log * bug fix * bug fix * bug fix * audio switch * update tts readme * remove tempfile when done * disable auto audio follow * avoid play queue update after shut up * feat: minimizing common.js * improve tts functionality * deterine whether the cached model is in choices * Add support for Ollama (#1740) * print err when doc2x not successful * add icon * adjust url for doc2x key version * prepare merge --------- Co-authored-by: Menghuan1918 <menghuan2003@outlook.com> Co-authored-by: Skyzayre <120616113+Skyzayre@users.noreply.github.com> Co-authored-by: XIao <46100050+Kilig947@users.noreply.github.com> Co-authored-by: Yuki <903728862@qq.com> Co-authored-by: zyren123 <91042213+zyren123@users.noreply.github.com> Co-authored-by: zym9804 <ren990603@gmail.com>
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
from toolbox import get_conf
|
|
CODE_HIGHLIGHT, ADD_WAIFU, LAYOUT = get_conf("CODE_HIGHLIGHT", "ADD_WAIFU", "LAYOUT")
|
|
|
|
def minimize_js(common_js_path):
|
|
try:
|
|
import rjsmin, hashlib, glob, os
|
|
# clean up old minimized js files, matching `common_js_path + '.min.*'`
|
|
for old_min_js in glob.glob(common_js_path + '.min.*.js'):
|
|
os.remove(old_min_js)
|
|
# use rjsmin to minimize `common_js_path`
|
|
c_jsmin = rjsmin.jsmin
|
|
with open(common_js_path, "r") as f:
|
|
js_content = f.read()
|
|
minimized_js_content = c_jsmin(js_content)
|
|
# compute sha256 hash of minimized js content
|
|
sha_hash = hashlib.sha256(minimized_js_content.encode()).hexdigest()[:8]
|
|
minimized_js_path = common_js_path + '.min.' + sha_hash + '.js'
|
|
# save to minimized js file
|
|
with open(minimized_js_path, "w") as f:
|
|
f.write(minimized_js_content)
|
|
# return minimized js file path
|
|
return minimized_js_path
|
|
except:
|
|
return common_js_path
|
|
|
|
def get_common_html_javascript_code():
|
|
js = "\n"
|
|
common_js_path = "themes/common.js"
|
|
minimized_js_path = minimize_js(common_js_path)
|
|
for jsf in [
|
|
f"file={minimized_js_path}",
|
|
]:
|
|
js += f"""<script src="{jsf}"></script>\n"""
|
|
|
|
# 添加Live2D
|
|
if ADD_WAIFU:
|
|
for jsf in [
|
|
"file=themes/waifu_plugin/jquery.min.js",
|
|
"file=themes/waifu_plugin/jquery-ui.min.js",
|
|
]:
|
|
js += f"""<script src="{jsf}"></script>\n"""
|
|
else:
|
|
js += """<script>window.loadLive2D = function(){};</script>\n"""
|
|
return js
|