- Task 4: AI 能力增强 (ai_manager.py) - 自定义模型训练(领域特定实体识别) - 多模态大模型集成(GPT-4V、Claude 3、Gemini、Kimi-VL) - 知识图谱 RAG 智能问答 - 智能摘要(提取式/生成式/关键点/时间线) - 预测性分析(趋势/异常/增长/演变预测) - Task 5: 运营与增长工具 (growth_manager.py) - 用户行为分析(Mixpanel/Amplitude 集成) - A/B 测试框架 - 邮件营销自动化 - 推荐系统(邀请返利、团队升级激励) - Task 6: 开发者生态 (developer_ecosystem_manager.py) - SDK 发布管理(Python/JavaScript/Go) - 模板市场 - 插件市场 - 开发者文档与示例代码 - Task 8: 运维与监控 (ops_manager.py) - 实时告警系统(PagerDuty/Opsgenie 集成) - 容量规划与自动扩缩容 - 灾备与故障转移 - 成本优化 Phase 8 全部 8 个任务已完成!
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Initialize database with schema"""
|
|
|
|
import sqlite3
|
|
import os
|
|
|
|
db_path = os.path.join(os.path.dirname(__file__), "insightflow.db")
|
|
schema_path = os.path.join(os.path.dirname(__file__), "schema.sql")
|
|
|
|
print(f"Database path: {db_path}")
|
|
print(f"Schema path: {schema_path}")
|
|
|
|
# Read schema
|
|
with open(schema_path, 'r') as f:
|
|
schema = f.read()
|
|
|
|
# Execute schema
|
|
conn = sqlite3.connect(db_path)
|
|
cursor = conn.cursor()
|
|
|
|
# Split schema by semicolons and execute each statement
|
|
statements = schema.split(';')
|
|
success_count = 0
|
|
error_count = 0
|
|
|
|
for stmt in statements:
|
|
stmt = stmt.strip()
|
|
if stmt:
|
|
try:
|
|
cursor.execute(stmt)
|
|
success_count += 1
|
|
except sqlite3.Error as e:
|
|
# Ignore "already exists" errors
|
|
if "already exists" in str(e):
|
|
success_count += 1
|
|
else:
|
|
print(f"Error: {e}")
|
|
error_count += 1
|
|
|
|
conn.commit()
|
|
conn.close()
|
|
|
|
print(f"\nSchema execution complete:")
|
|
print(f" Successful statements: {success_count}")
|
|
print(f" Errors: {error_count}")
|