diff --git a/backend/__pycache__/ai_manager.cpython-312.pyc b/backend/__pycache__/ai_manager.cpython-312.pyc deleted file mode 100644 index ac2bd06..0000000 Binary files a/backend/__pycache__/ai_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/api_key_manager.cpython-312.pyc b/backend/__pycache__/api_key_manager.cpython-312.pyc deleted file mode 100644 index e93826f..0000000 Binary files a/backend/__pycache__/api_key_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/collaboration_manager.cpython-312.pyc b/backend/__pycache__/collaboration_manager.cpython-312.pyc deleted file mode 100644 index ab7e457..0000000 Binary files a/backend/__pycache__/collaboration_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/db_manager.cpython-312.pyc b/backend/__pycache__/db_manager.cpython-312.pyc deleted file mode 100644 index a24f1e8..0000000 Binary files a/backend/__pycache__/db_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/developer_ecosystem_manager.cpython-312.pyc b/backend/__pycache__/developer_ecosystem_manager.cpython-312.pyc deleted file mode 100644 index 7bc9222..0000000 Binary files a/backend/__pycache__/developer_ecosystem_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/document_processor.cpython-312.pyc b/backend/__pycache__/document_processor.cpython-312.pyc deleted file mode 100644 index b2cf9db..0000000 Binary files a/backend/__pycache__/document_processor.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/enterprise_manager.cpython-312.pyc b/backend/__pycache__/enterprise_manager.cpython-312.pyc deleted file mode 100644 index 038897c..0000000 Binary files a/backend/__pycache__/enterprise_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/entity_aligner.cpython-312.pyc b/backend/__pycache__/entity_aligner.cpython-312.pyc deleted file mode 100644 index 7fda3b3..0000000 Binary files a/backend/__pycache__/entity_aligner.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/export_manager.cpython-312.pyc b/backend/__pycache__/export_manager.cpython-312.pyc deleted file mode 100644 index 0326237..0000000 Binary files a/backend/__pycache__/export_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/growth_manager.cpython-312.pyc b/backend/__pycache__/growth_manager.cpython-312.pyc deleted file mode 100644 index ce4b206..0000000 Binary files a/backend/__pycache__/growth_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/image_processor.cpython-312.pyc b/backend/__pycache__/image_processor.cpython-312.pyc deleted file mode 100644 index e1abb3d..0000000 Binary files a/backend/__pycache__/image_processor.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/init_db.cpython-312.pyc b/backend/__pycache__/init_db.cpython-312.pyc deleted file mode 100644 index c81751c..0000000 Binary files a/backend/__pycache__/init_db.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/knowledge_reasoner.cpython-312.pyc b/backend/__pycache__/knowledge_reasoner.cpython-312.pyc deleted file mode 100644 index f144f5e..0000000 Binary files a/backend/__pycache__/knowledge_reasoner.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/llm_client.cpython-312.pyc b/backend/__pycache__/llm_client.cpython-312.pyc deleted file mode 100644 index 3af798a..0000000 Binary files a/backend/__pycache__/llm_client.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/localization_manager.cpython-312.pyc b/backend/__pycache__/localization_manager.cpython-312.pyc deleted file mode 100644 index cad124a..0000000 Binary files a/backend/__pycache__/localization_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/main.cpython-312.pyc b/backend/__pycache__/main.cpython-312.pyc deleted file mode 100644 index ebf50e4..0000000 Binary files a/backend/__pycache__/main.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/multimodal_entity_linker.cpython-312.pyc b/backend/__pycache__/multimodal_entity_linker.cpython-312.pyc deleted file mode 100644 index 5aef7a6..0000000 Binary files a/backend/__pycache__/multimodal_entity_linker.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/multimodal_processor.cpython-312.pyc b/backend/__pycache__/multimodal_processor.cpython-312.pyc deleted file mode 100644 index 03b4715..0000000 Binary files a/backend/__pycache__/multimodal_processor.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/neo4j_manager.cpython-312.pyc b/backend/__pycache__/neo4j_manager.cpython-312.pyc deleted file mode 100644 index 8810f4a..0000000 Binary files a/backend/__pycache__/neo4j_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/ops_manager.cpython-312.pyc b/backend/__pycache__/ops_manager.cpython-312.pyc deleted file mode 100644 index f28c1b6..0000000 Binary files a/backend/__pycache__/ops_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/oss_uploader.cpython-312.pyc b/backend/__pycache__/oss_uploader.cpython-312.pyc deleted file mode 100644 index 99baa98..0000000 Binary files a/backend/__pycache__/oss_uploader.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/performance_manager.cpython-312.pyc b/backend/__pycache__/performance_manager.cpython-312.pyc deleted file mode 100644 index 84d5c38..0000000 Binary files a/backend/__pycache__/performance_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/plugin_manager.cpython-312.pyc b/backend/__pycache__/plugin_manager.cpython-312.pyc deleted file mode 100644 index d6a27a5..0000000 Binary files a/backend/__pycache__/plugin_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/rate_limiter.cpython-312.pyc b/backend/__pycache__/rate_limiter.cpython-312.pyc deleted file mode 100644 index 8d6e533..0000000 Binary files a/backend/__pycache__/rate_limiter.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/search_manager.cpython-312.pyc b/backend/__pycache__/search_manager.cpython-312.pyc deleted file mode 100644 index a8c8b0f..0000000 Binary files a/backend/__pycache__/search_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/security_manager.cpython-312.pyc b/backend/__pycache__/security_manager.cpython-312.pyc deleted file mode 100644 index ccc9896..0000000 Binary files a/backend/__pycache__/security_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/subscription_manager.cpython-312.pyc b/backend/__pycache__/subscription_manager.cpython-312.pyc deleted file mode 100644 index b88a6e4..0000000 Binary files a/backend/__pycache__/subscription_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/tenant_manager.cpython-312.pyc b/backend/__pycache__/tenant_manager.cpython-312.pyc deleted file mode 100644 index be647ce..0000000 Binary files a/backend/__pycache__/tenant_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_multimodal.cpython-312.pyc b/backend/__pycache__/test_multimodal.cpython-312.pyc deleted file mode 100644 index 3328430..0000000 Binary files a/backend/__pycache__/test_multimodal.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_phase7_task6_8.cpython-312.pyc b/backend/__pycache__/test_phase7_task6_8.cpython-312.pyc deleted file mode 100644 index 98c9401..0000000 Binary files a/backend/__pycache__/test_phase7_task6_8.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_phase8_task1.cpython-312.pyc b/backend/__pycache__/test_phase8_task1.cpython-312.pyc deleted file mode 100644 index 75bc270..0000000 Binary files a/backend/__pycache__/test_phase8_task1.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_phase8_task2.cpython-312.pyc b/backend/__pycache__/test_phase8_task2.cpython-312.pyc deleted file mode 100644 index 966d580..0000000 Binary files a/backend/__pycache__/test_phase8_task2.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_phase8_task4.cpython-312.pyc b/backend/__pycache__/test_phase8_task4.cpython-312.pyc deleted file mode 100644 index 63ba118..0000000 Binary files a/backend/__pycache__/test_phase8_task4.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_phase8_task5.cpython-312.pyc b/backend/__pycache__/test_phase8_task5.cpython-312.pyc deleted file mode 100644 index 637c8d7..0000000 Binary files a/backend/__pycache__/test_phase8_task5.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_phase8_task6.cpython-312.pyc b/backend/__pycache__/test_phase8_task6.cpython-312.pyc deleted file mode 100644 index 0e30270..0000000 Binary files a/backend/__pycache__/test_phase8_task6.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/test_phase8_task8.cpython-312.pyc b/backend/__pycache__/test_phase8_task8.cpython-312.pyc deleted file mode 100644 index 1110dfd..0000000 Binary files a/backend/__pycache__/test_phase8_task8.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/tingwu_client.cpython-312.pyc b/backend/__pycache__/tingwu_client.cpython-312.pyc deleted file mode 100644 index 3ad1563..0000000 Binary files a/backend/__pycache__/tingwu_client.cpython-312.pyc and /dev/null differ diff --git a/backend/__pycache__/workflow_manager.cpython-312.pyc b/backend/__pycache__/workflow_manager.cpython-312.pyc deleted file mode 100644 index 13c356b..0000000 Binary files a/backend/__pycache__/workflow_manager.cpython-312.pyc and /dev/null differ diff --git a/backend/ai_manager.py b/backend/ai_manager.py index 94ce570..61f6758 100644 --- a/backend/ai_manager.py +++ b/backend/ai_manager.py @@ -204,14 +204,14 @@ class SmartSummary: class AIManager: """AI 能力管理主类""" - def __init__(self, db_path: str = DB_PATH): + def __init__(self, db_path: str = DB_PATH) -> None: self.db_path = db_path self.kimi_api_key = os.getenv("KIMI_API_KEY", "") self.kimi_base_url = os.getenv("KIMI_BASE_URL", "https://api.kimi.com/coding") self.openai_api_key = os.getenv("OPENAI_API_KEY", "") self.anthropic_api_key = os.getenv("ANTHROPIC_API_KEY", "") - def _get_db(self) -> None: + def _get_db(self) -> sqlite3.Connection: """获取数据库连接""" conn = sqlite3.connect(self.db_path) conn.row_factory = sqlite3.Row diff --git a/backend/api_key_manager.py b/backend/api_key_manager.py index 219cd3f..b900110 100644 --- a/backend/api_key_manager.py +++ b/backend/api_key_manager.py @@ -47,7 +47,7 @@ class ApiKeyManager: KEY_PREFIX = "ak_live_" KEY_LENGTH = 48 # 总长度: 前缀(8) + 随机部分(40) - def __init__(self, db_path: str = DB_PATH): + def __init__(self, db_path: str = DB_PATH) -> None: self.db_path = db_path self._init_db() diff --git a/backend/db_manager.py b/backend/db_manager.py index a035b69..038f9c3 100644 --- a/backend/db_manager.py +++ b/backend/db_manager.py @@ -167,7 +167,8 @@ class DatabaseManager: def create_entity(self, entity: Entity) -> Entity: conn = self.get_conn() conn.execute( - """INSERT INTO entities (id, project_id, name, canonical_name, type, definition, aliases, created_at, updated_at) + """INSERT INTO entities (id, project_id, name, canonical_name, type, + definition, aliases, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)""", ( entity.id, @@ -736,7 +737,8 @@ class DatabaseManager: now = datetime.now().isoformat() conn.execute( """INSERT INTO attribute_templates - (id, project_id, name, type, options, default_value, description, is_required, sort_order, created_at, updated_at) + (id, project_id, name, type, options, default_value, description, + is_required, sort_order, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", ( template.id, diff --git a/backend/developer_ecosystem_manager.py b/backend/developer_ecosystem_manager.py index 928527e..55c31a7 100644 --- a/backend/developer_ecosystem_manager.py +++ b/backend/developer_ecosystem_manager.py @@ -980,12 +980,14 @@ class DeveloperEcosystemManager: """ INSERT INTO plugin_market (id, name, description, category, tags, author_id, author_name, status, - price, currency, pricing_model, preview_image_url, demo_url, documentation_url, - repository_url, download_url, webhook_url, permissions, install_count, - active_install_count, rating, rating_count, review_count, version, - min_platform_version, file_size, checksum, created_at, updated_at, - published_at, reviewed_by, reviewed_at, review_notes) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + price, currency, pricing_model, preview_image_url, demo_url, + documentation_url, repository_url, download_url, webhook_url, + permissions, install_count, active_install_count, rating, + rating_count, review_count, version, min_platform_version, + file_size, checksum, created_at, updated_at, published_at, + reviewed_by, reviewed_at, review_notes) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) """, ( plugin.id, diff --git a/backend/enterprise_manager.py b/backend/enterprise_manager.py index 68b1b06..fab08f3 100644 --- a/backend/enterprise_manager.py +++ b/backend/enterprise_manager.py @@ -1003,7 +1003,11 @@ class EnterpriseManager: def _generate_self_signed_cert(self) -> str: """生成自签名证书(简化实现)""" # 实际应该使用 cryptography 库生成 - return "MIICpDCCAYwCCQDU+pQ4nEHXqzANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwHhcNMjQwMTAxMDAwMDAwWhcNMjUwMTAxMDAwMDAwWjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC..." + return ( + "MIICpDCCAYwCCQDU+pQ4nEHXqzANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAlsb2NhbGhvc3Qw" + "HhcNMjQwMTAxMDAwMDAwWhcNMjUwMTAxMDAwMDAwWjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEi" + "MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC..." + ) # ==================== SCIM 用户目录同步 ==================== diff --git a/backend/export_manager.py b/backend/export_manager.py index dfb8678..cdcf9e3 100644 --- a/backend/export_manager.py +++ b/backend/export_manager.py @@ -121,14 +121,17 @@ class ExportManager: # 生成 SVG svg_parts = [ - f'', + f'', "", - ' ', + ' ', ' ', " ", "", f'', - f'知识图谱 - {project_id}', + f'知识图谱 - {project_id}', ] # 绘制关系连线 @@ -440,7 +443,10 @@ class ExportManager: story.append(Paragraph("InsightFlow 项目报告", title_style)) story.append(Paragraph(f"项目名称: {project_name}", styles["Heading2"])) story.append( - Paragraph(f"生成时间: {datetime.now().strftime('%Y-%m-%d %H:%M')}", styles["Normal"]) + Paragraph( + f"生成时间: {datetime.now().strftime('%Y-%m-%d %H:%M')}", + styles["Normal"], + ) ) story.append(Spacer(1, 0.3 * inch)) diff --git a/backend/llm_client.py b/backend/llm_client.py index bffe2c6..cfd301b 100644 --- a/backend/llm_client.py +++ b/backend/llm_client.py @@ -119,18 +119,23 @@ class LLMClient: 文本:{text[:3000]} 要求: -1. entities: 每个实体包含 name(名称), type(类型: PROJECT/TECH/PERSON/ORG/OTHER), definition(一句话定义), confidence(置信度0-1) -2. relations: 每个关系包含 source(源实体名), target(目标实体名), type(关系类型: belongs_to/works_with/depends_on/mentions/related), confidence(置信度0-1) +1. entities: 每个实体包含 name(名称), type(类型: PROJECT/TECH/PERSON/ORG/OTHER), + definition(一句话定义), confidence(置信度0-1) +2. relations: 每个关系包含 source(源实体名), target(目标实体名), + type(关系类型: belongs_to/works_with/depends_on/mentions/related), confidence(置信度0-1) 3. 只返回 JSON 对象,格式: {{"entities": [...], "relations": [...]}} 示例: {{ "entities": [ - {{"name": "Project Alpha", "type": "PROJECT", "definition": "核心项目", "confidence": 0.95}}, - {{"name": "K8s", "type": "TECH", "definition": "Kubernetes容器编排平台", "confidence": 0.88}} + {{"name": "Project Alpha", "type": "PROJECT", "definition": "核心项目", + "confidence": 0.95}}, + {{"name": "K8s", "type": "TECH", "definition": "Kubernetes容器编排平台", + "confidence": 0.88}} ], "relations": [ - {{"source": "Project Alpha", "target": "K8s", "type": "depends_on", "confidence": 0.82}} + {{"source": "Project Alpha", "target": "K8s", "type": "depends_on", + "confidence": 0.82}} ] }}""" diff --git a/backend/localization_manager.py b/backend/localization_manager.py index ad50d99..2d42b07 100644 --- a/backend/localization_manager.py +++ b/backend/localization_manager.py @@ -917,7 +917,8 @@ class LocalizationManager: cursor.execute( """ INSERT OR IGNORE INTO localized_payment_methods - (id, provider, name, name_local, supported_countries, supported_currencies, is_active, display_order) + (id, provider, name, name_local, supported_countries, + supported_currencies, is_active, display_order) VALUES (?, ?, ?, ?, ?, ?, ?, ?) """, ( @@ -1001,10 +1002,14 @@ class LocalizationManager: cursor = conn.cursor() cursor.execute( """ - INSERT INTO translations (id, key, language, value, namespace, context, created_at, updated_at) + INSERT INTO translations + (id, key, language, value, namespace, context, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(key, language, namespace) DO UPDATE SET - value = excluded.value, context = excluded.context, updated_at = excluded.updated_at, is_reviewed = 0 + value = excluded.value, + context = excluded.context, + updated_at = excluded.updated_at, + is_reviewed = 0 """, (translation_id, key, language, value, namespace, context, now, now), ) @@ -1186,11 +1191,15 @@ class LocalizationManager: cursor.execute( """ INSERT INTO tenant_data_center_mappings - (id, tenant_id, primary_dc_id, secondary_dc_id, region_code, data_residency, created_at, updated_at) + (id, tenant_id, primary_dc_id, secondary_dc_id, region_code, + data_residency, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(tenant_id) DO UPDATE SET - primary_dc_id = excluded.primary_dc_id, secondary_dc_id = excluded.secondary_dc_id, - region_code = excluded.region_code, data_residency = excluded.data_residency, updated_at = excluded.updated_at + primary_dc_id = excluded.primary_dc_id, + secondary_dc_id = excluded.secondary_dc_id, + region_code = excluded.region_code, + data_residency = excluded.data_residency, + updated_at = excluded.updated_at """, ( mapping_id, diff --git a/backend/main.py b/backend/main.py index d316f13..afb6d5d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -4880,7 +4880,8 @@ async def get_multimodal_stats_endpoint(project_id: str, _=Depends(verify_api_ke # 统计跨模态关联 cross_modal_count = conn.execute( - "SELECT COUNT(*) as count FROM multimodal_entity_links WHERE entity_id IN (SELECT id FROM entities WHERE project_id = ?)", + """SELECT COUNT(*) as count FROM multimodal_entity_links + WHERE entity_id IN (SELECT id FROM entities WHERE project_id = ?)""", (project_id,), ).fetchone()["count"] diff --git a/backend/ops_manager.py b/backend/ops_manager.py index d73b2cf..5a2ede9 100644 --- a/backend/ops_manager.py +++ b/backend/ops_manager.py @@ -973,7 +973,12 @@ class OpsManager: "tag": "div", "text": { "tag": "lark_md", - "content": f"**描述:** {alert.description}\n\n**指标:** {alert.metric}\n**当前值:** {alert.value}\n**阈值:** {alert.threshold}", + "content": ( + f"**描述:** {alert.description}\n\n" + f"**指标:** {alert.metric}\n" + f"**当前值:** {alert.value}\n" + f"**阈值:** {alert.threshold}" + ), }, }, {