fix: auto-fix code issues (cron)
- 修复重复导入/字段 (llm_client.py 中的重复注释) - 修复PEP8格式问题 (E501行长度超过100字符) - 修复多行SQL语句和字符串格式化 - 修复f-string过长问题 涉及文件: - backend/developer_ecosystem_manager.py - backend/document_processor.py - backend/enterprise_manager.py - backend/export_manager.py - backend/growth_manager.py - backend/llm_client.py - backend/localization_manager.py - backend/main.py - backend/neo4j_manager.py - backend/ops_manager.py - backend/performance_manager.py - backend/plugin_manager.py - backend/search_manager.py - backend/security_manager.py - backend/subscription_manager.py - backend/tenant_manager.py - backend/test_phase8_task6.py - backend/test_phase8_task8.py - backend/tingwu_client.py - backend/workflow_manager.py
This commit is contained in:
@@ -233,7 +233,8 @@ class FullTextSearch:
|
||||
|
||||
# 创建索引
|
||||
conn.execute(
|
||||
"CREATE INDEX IF NOT EXISTS idx_search_content ON search_indexes(content_id, content_type)",
|
||||
"""CREATE INDEX IF NOT EXISTS idx_search_content
|
||||
ON search_indexes(content_id, content_type)""",
|
||||
)
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_search_project ON search_indexes(project_id)")
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_term_freq_term ON search_term_freq(term)")
|
||||
@@ -310,7 +311,8 @@ class FullTextSearch:
|
||||
conn.execute(
|
||||
"""
|
||||
INSERT OR REPLACE INTO search_indexes
|
||||
(id, content_id, content_type, project_id, tokens, token_positions, created_at, updated_at)
|
||||
(id, content_id, content_type, project_id, tokens, token_positions,
|
||||
created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""",
|
||||
(
|
||||
@@ -579,7 +581,10 @@ class FullTextSearch:
|
||||
(content_id,),
|
||||
).fetchone()
|
||||
if row:
|
||||
return f"{row['source_name']} {row['relation_type']} {row['target_name']} {row['evidence'] or ''}"
|
||||
return (
|
||||
f"{row['source_name']} {row['relation_type']} "
|
||||
f"{row['target_name']} {row['evidence'] or ''}"
|
||||
)
|
||||
return None
|
||||
|
||||
return None
|
||||
@@ -784,7 +789,10 @@ class FullTextSearch:
|
||||
).fetchall()
|
||||
|
||||
for r in relations:
|
||||
text = f"{r['source_name']} {r['relation_type']} {r['target_name']} {r['evidence'] or ''}"
|
||||
text = (
|
||||
f"{r['source_name']} {r['relation_type']} "
|
||||
f"{r['target_name']} {r['evidence'] or ''}"
|
||||
)
|
||||
if self.index_content(r["id"], "relation", r["project_id"], text):
|
||||
stats["relations"] += 1
|
||||
else:
|
||||
@@ -854,7 +862,8 @@ class SemanticSearch:
|
||||
""")
|
||||
|
||||
conn.execute(
|
||||
"CREATE INDEX IF NOT EXISTS idx_embedding_content ON embeddings(content_id, content_type)",
|
||||
"""CREATE INDEX IF NOT EXISTS idx_embedding_content
|
||||
ON embeddings(content_id, content_type)""",
|
||||
)
|
||||
conn.execute("CREATE INDEX IF NOT EXISTS idx_embedding_project ON embeddings(project_id)")
|
||||
|
||||
@@ -1107,7 +1116,8 @@ class SemanticSearch:
|
||||
conn = self._get_conn()
|
||||
|
||||
row = conn.execute(
|
||||
"SELECT embedding, project_id FROM embeddings WHERE content_id = ? AND content_type = ?",
|
||||
"""SELECT embedding, project_id FROM embeddings
|
||||
WHERE content_id = ? AND content_type = ?""",
|
||||
(content_id, content_type),
|
||||
).fetchone()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user