@@ -326,6 +369,7 @@ GPT-4是OpenAI发布的大语言模型,参数量约1.8万亿,支持128K上
function renderSidebar() {
const fixedItems = [
{id: 'overview', name: '概览', icon: 'ri-home-4-line'},
+ {id: 'config', name: '网站配置', icon: 'ri-settings-3-line'},
{id: 'categories', name: '分类管理', icon: 'ri-folder-line'},
];
@@ -443,12 +487,53 @@ GPT-4是OpenAI发布的大语言模型,参数量约1.8万亿,支持128K上
}
if (section === 'categories') loadAdminCategories();
+ if (section === 'config') loadSiteConfig();
if (section === 'models') loadAdminModels();
if (section === 'gpus') loadAdminGpus();
if (section === 'cpus') loadAdminCpus();
if (section === 'knowledge') loadAdminKnowledge();
}
+ // 加载网站配置
+ async function loadSiteConfig() {
+ const res = await fetch('/api/config');
+ const config = await res.json();
+
+ document.getElementById('config_site_name').value = config.site_name || '';
+ document.getElementById('config_site_subtitle').value = config.site_subtitle || '';
+ document.getElementById('config_icp_number').value = config.icp_number || '';
+ document.getElementById('config_contact_email').value = config.contact_email || '';
+ document.getElementById('config_github_url').value = config.github_url || '';
+ document.getElementById('config_copyright_year').value = config.copyright_year || '';
+ document.getElementById('config_footer_text').value = config.footer_text || '';
+ }
+
+ // 保存网站配置
+ async function saveSiteConfig() {
+ const config = {
+ site_name: document.getElementById('config_site_name').value,
+ site_subtitle: document.getElementById('config_site_subtitle').value,
+ icp_number: document.getElementById('config_icp_number').value,
+ contact_email: document.getElementById('config_contact_email').value,
+ github_url: document.getElementById('config_github_url').value,
+ copyright_year: document.getElementById('config_copyright_year').value,
+ footer_text: document.getElementById('config_footer_text').value,
+ };
+
+ try {
+ const res = await fetch('/api/config', {
+ method: 'PUT',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(config)
+ });
+
+ const data = await res.json();
+ alert('配置已保存!');
+ } catch (e) {
+ alert('保存失败: ' + e.message);
+ }
+ }
+
// 加载概览统计
async function loadOverview() {
const res = await fetch('/api/stats');
diff --git a/templates/index.html b/templates/index.html
index 5d81fbf..c0fdde1 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -3,7 +3,7 @@
-
ParamHub - 参数百科
+
ParamHub - 参数百科
@@ -14,8 +14,8 @@
- ParamHub
- 参数百科
+ ParamHub
+ 参数百科
@@ -70,7 +70,7 @@