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