diff --git a/backend/app.py b/backend/app.py index 08bf12f..2bfa46f 100644 --- a/backend/app.py +++ b/backend/app.py @@ -276,6 +276,20 @@ def init_db(): ] for key, value, desc in default_configs: cursor.execute('INSERT INTO system_configs (key, value, description) VALUES (?, ?, ?)', (key, value, desc)) + else: + # 检查并添加缺失的配置项(兼容旧数据库) + default_configs = [ + ('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('SELECT COUNT(*) FROM system_configs WHERE key=?', (key,)) + if cursor.fetchone()[0] == 0: + cursor.execute('INSERT INTO system_configs (key, value, description) VALUES (?, ?, ?)', (key, value, desc)) # 初始化管理员账户 cursor.execute('SELECT COUNT(*) FROM admin_users')