feat: 系统设置可配置版本信息、技术基础、开发者等

This commit is contained in:
2026-04-27 23:32:37 +08:00
parent 22a109d6c0
commit c71f27072a
3 changed files with 69 additions and 12 deletions

View File

@@ -260,13 +260,19 @@ def init_db():
if cursor.fetchone()[0] == 0:
default_configs = [
('app_name', 'AI助手', '应用名称'),
('app_version', '3.5.1', '应用版本'),
('app_version', '3.10.0', '应用版本'),
('llm_provider', 'zhipu', '默认大模型提供商'),
('enable_search', 'true', '是否启用联网搜索'),
('guest_chat_sessions', '1', '游客每日对话会话限制'),
('guest_chat_messages', '20', '游客每日对话消息限制'),
('guest_agent_messages', '20', '游客每日智能体消息限制'),
('admin_password', 'admin123', '管理员密码'),
('app_developer', 'OpenClaw Team', '开发者'),
('app_update_date', '2026-04-27', '更新日期'),
('app_technology', '智谱 GLM-4.5-Air 大模型', '技术基础'),
('app_description', '提供智能对话、多种智能体服务', '应用简介'),
('privacy_policy_url', '', '隐私政策链接'),
('user_agreement_url', '', '用户协议链接'),
]
for key, value, desc in default_configs:
cursor.execute('INSERT INTO system_configs (key, value, description) VALUES (?, ?, ?)', (key, value, desc))
@@ -1347,13 +1353,19 @@ def get_frontend_config():
'chat_config': dict(chat_config) if chat_config else None,
'system': {
'appName': system.get('app_name', 'AI助手'),
'version': system.get('app_version', '3.6.0'),
'version': system.get('app_version', '3.10.0'),
'enableSearch': system.get('enable_search', 'true') == 'true',
'guestLimits': {
'chatSessions': int(system.get('guest_chat_sessions', '1')),
'chatMessages': int(system.get('guest_chat_messages', '20')),
'agentMessages': int(system.get('guest_agent_messages', '20')),
}
},
'developer': system.get('app_developer', 'OpenClaw Team'),
'updateDate': system.get('app_update_date', '2026-04-27'),
'technology': system.get('app_technology', '智谱 GLM-4.5-Air 大模型'),
'description': system.get('app_description', '提供智能对话、多种智能体服务'),
'privacyPolicyUrl': system.get('privacy_policy_url', ''),
'userAgreementUrl': system.get('user_agreement_url', ''),
}
}

View File

@@ -1355,6 +1355,26 @@ async function loadSystemPage(content) {
<input type="text" class="form-input" id="appVersion" value="${systemConfigs.app_version?.value || ''}">
</div>
<div class="form-group">
<label class="form-label">应用简介</label>
<input type="text" class="form-input" id="appDescription" value="${systemConfigs.app_description?.value || ''}" placeholder="如:提供智能对话、多种智能体服务">
</div>
<div class="form-group">
<label class="form-label">技术基础</label>
<input type="text" class="form-input" id="appTechnology" value="${systemConfigs.app_technology?.value || ''}" placeholder="如:智谱 GLM-4.5-Air 大模型">
</div>
<div class="form-group">
<label class="form-label">开发者</label>
<input type="text" class="form-input" id="appDeveloper" value="${systemConfigs.app_developer?.value || ''}" placeholder="如OpenClaw Team">
</div>
<div class="form-group">
<label class="form-label">更新日期</label>
<input type="text" class="form-input" id="appUpdateDate" value="${systemConfigs.app_update_date?.value || ''}" placeholder="如2026-04-27">
</div>
<h3 style="margin: 24px 0 16px; padding-top: 16px; border-top: 1px solid #e2e8f0;">游客使用限制</h3>
<div class="form-group">
@@ -1379,6 +1399,18 @@ async function loadSystemPage(content) {
<input type="text" class="form-input" id="adminPassword" value="${systemConfigs.admin_password?.value || ''}" placeholder="修改管理员密码">
</div>
<h3 style="margin: 24px 0 16px; padding-top: 16px; border-top: 1px solid #e2e8f0;">链接配置</h3>
<div class="form-group">
<label class="form-label">隐私政策链接</label>
<input type="text" class="form-input" id="privacyPolicyUrl" value="${systemConfigs.privacy_policy_url?.value || ''}" placeholder="隐私政策页面URL">
</div>
<div class="form-group">
<label class="form-label">用户协议链接</label>
<input type="text" class="form-input" id="userAgreementUrl" value="${systemConfigs.user_agreement_url?.value || ''}" placeholder="用户协议页面URL">
</div>
<button class="form-submit" onclick="saveSystemConfig()">保存设置</button>
</div>
@@ -1394,10 +1426,16 @@ async function saveSystemConfig() {
const data = {
app_name: document.getElementById('appName').value,
app_version: document.getElementById('appVersion').value,
app_description: document.getElementById('appDescription').value,
app_technology: document.getElementById('appTechnology').value,
app_developer: document.getElementById('appDeveloper').value,
app_update_date: document.getElementById('appUpdateDate').value,
guest_chat_sessions: document.getElementById('guestChatSessions').value,
guest_chat_messages: document.getElementById('guestChatMessages').value,
guest_agent_messages: document.getElementById('guestAgentMessages').value,
admin_password: document.getElementById('adminPassword').value
admin_password: document.getElementById('adminPassword').value,
privacy_policy_url: document.getElementById('privacyPolicyUrl').value,
user_agreement_url: document.getElementById('userAgreementUrl').value,
};
await fetchAPI('/api/admin/system', 'POST', data);

View File

@@ -1602,8 +1602,8 @@ function renderProfilePage() {
</div>
<div class="profile-footer">
<p>AI助手 v3.6.0</p>
<p>基于智谱 GLM-4.5-Air</p>
<p>${CONFIG?.system?.appName || 'AI助手'} v${CONFIG?.system?.version || '3.10.0'}</p>
<p>基于 ${CONFIG?.system?.technology || '智谱 GLM-4.5-Air'}</p>
</div>
</div>
</div>
@@ -2524,6 +2524,13 @@ function showHelpPage() {
// ==================== 关于页面 ====================
function showAboutPage() {
const appName = CONFIG?.system?.appName || 'AI助手';
const version = CONFIG?.system?.version || '3.10.0';
const developer = CONFIG?.system?.developer || 'OpenClaw Team';
const updateDate = CONFIG?.system?.updateDate || '2026-04-27';
const technology = CONFIG?.system?.technology || '智谱 GLM-4.5-Air 大模型';
const description = CONFIG?.system?.description || '提供智能对话、多种智能体服务';
const aboutHtml = `
<div class="settings-page">
<header class="settings-header">
@@ -2535,22 +2542,22 @@ function showAboutPage() {
<div class="settings-content about-content">
<div class="about-logo">🤖</div>
<div class="about-name">AI助手</div>
<div class="about-version">v3.5.0</div>
<div class="about-name">${appName}</div>
<div class="about-version">v${version}</div>
<div class="about-info">
<p>基于智谱 GLM-4.5-Air 大模型</p>
<p>提供智能对话、多种智能体服务</p>
<p>基于 ${technology}</p>
<p>${description}</p>
</div>
<div class="about-section">
<div class="about-item">
<span class="about-label">开发者</span>
<span class="about-value">OpenClaw Team</span>
<span class="about-value">${developer}</span>
</div>
<div class="about-item">
<span class="about-label">更新日期</span>
<span class="about-value">2026-04-27</span>
<span class="about-value">${updateDate}</span>
</div>
</div>