Fix/memory interface (#169)
* [changes]《Modify the interface》 1.Remove the "/search/entity_graph" interface 2.Reconstruct the "/updated_end_user/profile" interface 3.Remove the "Update Username" interface 4.Fix the batch query of user association memory configuration * [changes]《Modify the interface》 1.Remove the "/search/entity_graph" interface 2.Reconstruct the "/updated_end_user/profile" interface 3.Remove the "Update Username" interface 4.Fix the batch query of user association memory configuration * [fix]Fix the error response type
This commit is contained in:
@@ -104,38 +104,6 @@ class DataConfigRepository:
|
||||
r.statement AS statement
|
||||
"""
|
||||
|
||||
# Entity graph within group (source node, edge, target node)
|
||||
SEARCH_FOR_ENTITY_GRAPH = """
|
||||
MATCH (n:ExtractedEntity)-[r]->(m:ExtractedEntity)
|
||||
WHERE n.group_id = $group_id
|
||||
RETURN
|
||||
{
|
||||
entity_idx: n.entity_idx,
|
||||
connect_strength: n.connect_strength,
|
||||
description: n.description,
|
||||
entity_type: n.entity_type,
|
||||
name: n.name,
|
||||
fact_summary: COALESCE(n.fact_summary, ''),
|
||||
id: n.id
|
||||
} AS sourceNode,
|
||||
{
|
||||
rel_id: elementId(r),
|
||||
source_id: startNode(r).id,
|
||||
target_id: endNode(r).id,
|
||||
predicate: r.predicate,
|
||||
statement_id: r.statement_id,
|
||||
statement: r.statement
|
||||
} AS edge,
|
||||
{
|
||||
entity_idx: m.entity_idx,
|
||||
connect_strength: m.connect_strength,
|
||||
description: m.description,
|
||||
entity_type: m.entity_type,
|
||||
name: m.name,
|
||||
fact_summary: COALESCE(m.fact_summary, ''),
|
||||
id: m.id
|
||||
} AS targetNode
|
||||
"""
|
||||
@staticmethod
|
||||
def update_reflection_config(
|
||||
db: Session,
|
||||
|
||||
@@ -276,42 +276,6 @@ def get_end_user_by_id(db: Session, end_user_id: uuid.UUID) -> Optional[EndUser]
|
||||
end_user = repo.get_end_user_by_id(end_user_id)
|
||||
return end_user
|
||||
|
||||
def update_end_user_other_name(
|
||||
db: Session,
|
||||
end_user_id: uuid.UUID,
|
||||
other_name: str
|
||||
) -> int:
|
||||
"""
|
||||
通过 end_user_id 更新 end_user 表中的 other_name 字段
|
||||
|
||||
Args:
|
||||
db: 数据库会话
|
||||
end_user_id: 宿主ID
|
||||
other_name: 要更新的用户名
|
||||
|
||||
Returns:
|
||||
int: 更新的记录数
|
||||
"""
|
||||
try:
|
||||
# 执行更新
|
||||
updated_count = (
|
||||
db.query(EndUser)
|
||||
.filter(EndUser.id == end_user_id)
|
||||
.update(
|
||||
{EndUser.other_name: other_name},
|
||||
synchronize_session=False
|
||||
)
|
||||
)
|
||||
|
||||
db.commit()
|
||||
db_logger.info(f"成功更新宿主 {end_user_id} 的 other_name 为: {other_name}")
|
||||
return updated_count
|
||||
|
||||
except Exception as e:
|
||||
db.rollback()
|
||||
db_logger.error(f"更新宿主 {end_user_id} 的 other_name 时出错: {str(e)}")
|
||||
raise
|
||||
|
||||
# 新增的缓存操作函数(保持与类方法一致的接口)
|
||||
def get_by_id(db: Session, end_user_id: uuid.UUID) -> Optional[EndUser]:
|
||||
"""根据ID获取终端用户(用于缓存操作)"""
|
||||
|
||||
Reference in New Issue
Block a user