feat: GEO/SEO structured data + search ranking tracker
This commit is contained in:
@@ -15,12 +15,15 @@ def list_topics(
|
||||
page: int = 1,
|
||||
page_size: int = 20,
|
||||
status: Optional[str] = None,
|
||||
field: Optional[str] = None
|
||||
field: Optional[str] = None,
|
||||
org_id: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""获取选题列表,支持分页和筛选"""
|
||||
db = SessionLocal()
|
||||
try:
|
||||
query = db.query(Topic)
|
||||
if org_id:
|
||||
query = query.filter(Topic.org_id == org_id)
|
||||
if status:
|
||||
query = query.filter(Topic.status == status)
|
||||
if field:
|
||||
@@ -51,11 +54,14 @@ def list_topics(
|
||||
db.close()
|
||||
|
||||
|
||||
def get_topic(topic_id: str) -> Dict[str, Any]:
|
||||
def get_topic(topic_id: str, org_id: Optional[str] = None) -> Dict[str, Any]:
|
||||
"""获取单个选题详情"""
|
||||
db = SessionLocal()
|
||||
try:
|
||||
t = db.query(Topic).filter(Topic.id == topic_id).first()
|
||||
query = db.query(Topic).filter(Topic.id == topic_id)
|
||||
if org_id:
|
||||
query = query.filter(Topic.org_id == org_id)
|
||||
t = query.first()
|
||||
if not t:
|
||||
return {"error": f"选题 {topic_id} 不存在"}
|
||||
return {
|
||||
@@ -191,19 +197,21 @@ def list_system_configs() -> List[Dict[str, Any]]:
|
||||
ACTION_REGISTRY = {
|
||||
"list_topics": {
|
||||
"func": list_topics,
|
||||
"description": "获取选题列表,支持分页(page, page_size)和筛选(status, field)",
|
||||
"description": "获取选题列表,支持分页(page, page_size)和筛选(status, field, org_id)",
|
||||
"params_schema": {
|
||||
"page": {"type": "integer", "default": 1, "desc": "页码"},
|
||||
"page_size": {"type": "integer", "default": 20, "desc": "每页条数"},
|
||||
"status": {"type": "string", "enum": ["pending", "review", "draft", "ready", "published"], "desc": "按状态筛选"},
|
||||
"field": {"type": "string", "desc": "按领域筛选"}
|
||||
"field": {"type": "string", "desc": "按领域筛选"},
|
||||
"org_id": {"type": "string", "desc": "按组织筛选"}
|
||||
}
|
||||
},
|
||||
"get_topic": {
|
||||
"func": get_topic,
|
||||
"description": "获取单个选题详情",
|
||||
"params_schema": {
|
||||
"topic_id": {"type": "string", "desc": "选题ID,如 A01 或 LIVING-001-26"}
|
||||
"topic_id": {"type": "string", "desc": "选题ID,如 A01 或 LIVING-001-26"},
|
||||
"org_id": {"type": "string", "desc": "按组织筛选(可选)"}
|
||||
}
|
||||
},
|
||||
"get_recent_task_logs": {
|
||||
|
||||
Reference in New Issue
Block a user