init
This commit is contained in:
@@ -432,7 +432,14 @@ def list_ai_news(offset: int = 0, limit: int = 10):
|
||||
og = _extract_og(r["url"]) if r.get("url") else {"title":"","description":"","image":"","url":r.get("url")}
|
||||
r.update({"meta": og})
|
||||
enriched.append(r)
|
||||
return {"items": enriched, "nextOffset": offset + len(enriched)}
|
||||
# Frontend infinite-scroll safety:
|
||||
# - Return `nextOffset: null` when there is no next page.
|
||||
# - Otherwise return the next numeric offset.
|
||||
if len(enriched) < limit:
|
||||
next_offset = None
|
||||
else:
|
||||
next_offset = offset + len(enriched)
|
||||
return {"items": enriched, "nextOffset": next_offset}
|
||||
|
||||
@app.post("/community/ai_news")
|
||||
def create_ai_news(dto: AiNewsCreateDTO):
|
||||
|
||||
Reference in New Issue
Block a user