25 lines
688 B
Python
25 lines
688 B
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
"""重置配置 - 使用mock模式"""
|
|||
|
|
import sys
|
|||
|
|
sys.path.insert(0, '/home/xian/.openclaw/workspace-coder/works/ai-chat')
|
|||
|
|
|
|||
|
|
from models import SessionLocal, SystemConfig, init_db
|
|||
|
|
|
|||
|
|
init_db()
|
|||
|
|
db = SessionLocal()
|
|||
|
|
|
|||
|
|
# 删除所有AI配置(让服务使用mock模式)
|
|||
|
|
keys_to_delete = ['ai_api_base', 'ai_api_key', 'ai_model']
|
|||
|
|
for key in keys_to_delete:
|
|||
|
|
c = db.query(SystemConfig).filter(SystemConfig.key == key).first()
|
|||
|
|
if c:
|
|||
|
|
db.delete(c)
|
|||
|
|
|
|||
|
|
# 保留Matrix配置
|
|||
|
|
print("当前配置:")
|
|||
|
|
for c in db.query(SystemConfig).all():
|
|||
|
|
print(f" {c.key}: {c.value[:20]}...")
|
|||
|
|
|
|||
|
|
db.commit()
|
|||
|
|
print("\nAI将使用mock模式(因为没有配置AI API)")
|
|||
|
|
db.close()
|