Files
WeKnora/frontend/index.html
T
wizardchen 3231ae30a4 fix(frontend): bundle tdesign-icons sprite locally for offline deploys
The <t-icon> component from tdesign-vue-next lazily loads its SVG sprite
from https://tdesign.gtimg.com/icon/<ver>/fonts/index.js at runtime. In
air-gapped or intranet deployments this request fails and the whole UI
loses its icons (agent cards, knowledge-base breadcrumbs/cards, upload
buttons, etc.).

Ship the sprite (tdesign-icons-vue-next@0.4.1) as a static asset under
frontend/public/tdesign-icons/0.4.1/fonts/index.js and preload it from
index.html so every <t-icon name="..."> resolves against local symbols.
An offline guard injects stub <script>/<link> nodes that match tdesign's
dedup selectors, so checkScriptAndLoad / checkLinkAndLoad short-circuit
without ever hitting the CDN (covers both the 0.4.0 and 0.4.1 hardcoded
URLs for forward-compat).

Closes #867
Closes #897
2026-04-23 18:21:49 +08:00

80 lines
3.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>WeKnora</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="keywords" content="知识问答、微信对话开放平台、对话开放平台、对话平台、人工智能定制、人机对话、智能问答、人机交互、自然语言处理、自然语言理解、NLP、人工智能产品、人工智能开源、人工智能算法、语音助手"/>
<meta name="description" content="WeKnora是一款基于大语言模型的文档理解与语义检索框架,专为结构复杂、内容异构的文档场景而打造。"/>
<link rel="shortcut icon" type="image/png" href="./public/favicon.ico"/>
<link rel="apple-touch-icon" sizes="120x120" type="image/png" href="./public/favicon.ico"/>
</head>
<body>
<script>
(function(){
var t=localStorage.getItem('WeKnora_theme')||'light';
if(t==='system')t=window.matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light';
document.documentElement.setAttribute('theme-mode',t);
/* 与 theme.css 中 --td-bg-color-page 一致,避免样式加载后整页背景从 #fff 跳到 #eee 触发重绘闪动 */
var bg=t==='dark'?'#181818':'#eee';
document.documentElement.style.background=bg;
document.documentElement.style.minHeight='100%';
document.documentElement.style.colorScheme=t==='dark'?'dark':'light';
document.body.style.background=bg;
document.body.style.minHeight='100%';
try{
var w=window.runtime;
if(w){
if(t==='dark'){
if(w.WindowSetDarkTheme)w.WindowSetDarkTheme();
if(w.WindowSetBackgroundColour)w.WindowSetBackgroundColour(24,24,24,255);
}else{
if(w.WindowSetLightTheme)w.WindowSetLightTheme();
if(w.WindowSetBackgroundColour)w.WindowSetBackgroundColour(238,238,238,255);
}
}
}catch(_){}
})();
</script>
<script>
(function(){
try {
if (localStorage.getItem('weknora_lite_mode') !== 'true') return;
var saved = sessionStorage.getItem('weknora_lite_last_path');
if (!saved || saved.indexOf('/platform/') !== 0 || saved.indexOf('/platform/organizations') === 0) return;
var path = window.location.pathname;
if (path !== '/' && path !== '/platform' && path !== '/platform/knowledge-bases') return;
var target = saved.indexOf('#') >= 0 ? saved.slice(0, saved.indexOf('#')) : saved;
if (!target) return;
var current = window.location.pathname + window.location.search;
if (target !== current) window.history.replaceState(window.history.state, '', target);
} catch (e) {}
})();
</script>
<script src="/config.js"></script>
<!--
离线部署兼容:提前本地加载 tdesign-icons SVG sprite,避免 tdesign-vue-next 的
<t-icon> 运行时向 https://tdesign.gtimg.com 发起请求(见 issue #867 / #897)。
升级 tdesign-icons-vue-next 时需同步更新 public/tdesign-icons/<version>/fonts/index.js。
-->
<script src="/tdesign-icons/0.4.1/fonts/index.js"></script>
<div id="app"></div>
<script>
(function(){
var t=localStorage.getItem('WeKnora_theme')||'light';
if(t==='system')t=window.matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light';
var bg=t==='dark'?'#181818':'#eee';
var el=document.getElementById('app');
if(el){ el.style.background=bg; el.style.minHeight='100%'; }
})();
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>