修复遗留合并BUG
This commit is contained in:
@@ -305,11 +305,18 @@ async def search_graph(
|
||||
results[key] = _deduplicate_results(results[key])
|
||||
|
||||
# 更新知识节点的激活值(Statement, ExtractedEntity, MemorySummary)
|
||||
results = await _update_search_results_activation(
|
||||
connector=connector,
|
||||
results=results,
|
||||
end_user_id=end_user_id
|
||||
# Skip activation updates if only searching summaries (optimization)
|
||||
needs_activation_update = any(
|
||||
key in include and key in results and results[key]
|
||||
for key in ['statements', 'entities', 'chunks']
|
||||
)
|
||||
|
||||
if needs_activation_update:
|
||||
results = await _update_search_results_activation(
|
||||
connector=connector,
|
||||
results=results,
|
||||
end_user_id=end_user_id
|
||||
)
|
||||
|
||||
return results
|
||||
|
||||
@@ -417,14 +424,23 @@ async def search_graph_by_embedding(
|
||||
results[key] = _deduplicate_results(results[key])
|
||||
|
||||
# 更新知识节点的激活值(Statement, ExtractedEntity, MemorySummary)
|
||||
update_start = time.time()
|
||||
results = await _update_search_results_activation(
|
||||
connector=connector,
|
||||
results=results,
|
||||
end_user_id=end_user_id
|
||||
# Skip activation updates if only searching summaries (optimization)
|
||||
needs_activation_update = any(
|
||||
key in include and key in results and results[key]
|
||||
for key in ['statements', 'entities', 'chunks']
|
||||
)
|
||||
update_time = time.time() - update_start
|
||||
print(f"[PERF] Activation value updates took: {update_time:.4f}s")
|
||||
|
||||
if needs_activation_update:
|
||||
update_start = time.time()
|
||||
results = await _update_search_results_activation(
|
||||
connector=connector,
|
||||
results=results,
|
||||
end_user_id=end_user_id
|
||||
)
|
||||
update_time = time.time() - update_start
|
||||
logger.info(f"[PERF] Activation value updates took: {update_time:.4f}s")
|
||||
else:
|
||||
logger.info(f"[PERF] Skipping activation updates (only summaries)")
|
||||
|
||||
return results
|
||||
async def get_dedup_candidates_for_entities( # 适配新版查询:使用全文索引按名称检索候选实体
|
||||
|
||||
@@ -505,7 +505,7 @@ class EmotionAnalyticsService:
|
||||
)
|
||||
config_service = MemoryConfigService(db)
|
||||
memory_config = config_service.load_memory_config(
|
||||
config_id=int(config_id),
|
||||
config_id=(config_id),
|
||||
service_name="EmotionAnalyticsService.generate_emotion_suggestions"
|
||||
)
|
||||
from app.core.memory.utils.llm.llm_utils import MemoryClientFactory
|
||||
|
||||
@@ -61,7 +61,7 @@ def _validate_config_id(config_id):
|
||||
|
||||
# Fall back to integer parsing
|
||||
try:
|
||||
parsed_id = int(config_id_stripped)
|
||||
parsed_id = config_id_stripped
|
||||
if parsed_id <= 0:
|
||||
raise InvalidConfigError(
|
||||
f"Configuration ID must be positive: {parsed_id}",
|
||||
|
||||
@@ -92,17 +92,15 @@ class MemoryPerceptualService:
|
||||
|
||||
result = {
|
||||
"id": str(memory.id),
|
||||
"perceptual_type": perceptual_type,
|
||||
"file_name": memory.file_name,
|
||||
"file_path": memory.file_path,
|
||||
"file_ext": memory.file_ext,
|
||||
"storage_service": memory.storage_service,
|
||||
"meta_data": memory.meta_data,
|
||||
"storage_type": memory.storage_service,
|
||||
"summary": memory.summary,
|
||||
"keywords": content.keywords,
|
||||
"topic": content.topic,
|
||||
"domain": content.domain,
|
||||
"created_time": int(memory.created_time.timestamp()*1000),
|
||||
**detail
|
||||
}
|
||||
|
||||
business_logger.info(
|
||||
|
||||
Reference in New Issue
Block a user