fix(retrieval): list_gaps returns ORM entities; admin switches back to the domain API
T12 集成实测暴露:select(KbGap) 的结果调 .mappings(),行键是实体类, GapSummary 按列名取值必然 AttributeError。改为 .scalars() 返回实体; admin 的缺口看板从临时自实现切回 retrieval.list_gaps(语义单一定义)。
This commit is contained in:
@@ -268,8 +268,12 @@ async def record_gap(
|
||||
INVALIDATION_VERSION = 1
|
||||
|
||||
|
||||
async def list_gaps(session: AsyncSession, *, limit: int = 50, offset: int = 0) -> list[RowMapping]:
|
||||
"""缺口看板查询:hit_count 降序,同频次按最近出现降序。"""
|
||||
async def list_gaps(session: AsyncSession, *, limit: int = 50, offset: int = 0) -> list[KbGap]:
|
||||
"""缺口看板查询:hit_count 降序,同频次按最近出现降序。
|
||||
|
||||
返回 ORM 实体而非 mappings:单实体 select 的 mapping 行键是实体类,
|
||||
按列名取值必然 AttributeError(T12 集成实测暴露,此处修正)。
|
||||
"""
|
||||
from sqlalchemy import select
|
||||
|
||||
from packages.shared.models import KbGap
|
||||
@@ -281,4 +285,4 @@ async def list_gaps(session: AsyncSession, *, limit: int = 50, offset: int = 0)
|
||||
.offset(offset)
|
||||
)
|
||||
result = await session.execute(stmt)
|
||||
return list(result.mappings().all())
|
||||
return list(result.scalars().all())
|
||||
|
||||
Reference in New Issue
Block a user