Fix: canvas list with team. (#10549)

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu
2025-10-14 19:38:54 +08:00
committed by GitHub
parent 960f47c4d4
commit 16b5feadb7
2 changed files with 4 additions and 7 deletions

View File

@ -143,15 +143,12 @@ class UserCanvasService(CommonService):
] ]
if keywords: if keywords:
agents = cls.model.select(*fields).join(User, on=(cls.model.user_id == User.id)).where( agents = cls.model.select(*fields).join(User, on=(cls.model.user_id == User.id)).where(
cls.model.user_id.in_(joined_tenant_ids), (((cls.model.user_id.in_(joined_tenant_ids)) & (cls.model.permission == TenantPermission.TEAM.value)) | (cls.model.user_id == user_id)),
fn.LOWER(cls.model.title).contains(keywords.lower()) (fn.LOWER(cls.model.title).contains(keywords.lower()))
#(((cls.model.user_id.in_(joined_tenant_ids)) & (cls.model.permission == TenantPermission.TEAM.value)) | (cls.model.user_id == user_id)),
#(fn.LOWER(cls.model.title).contains(keywords.lower()))
) )
else: else:
agents = cls.model.select(*fields).join(User, on=(cls.model.user_id == User.id)).where( agents = cls.model.select(*fields).join(User, on=(cls.model.user_id == User.id)).where(
cls.model.user_id.in_(joined_tenant_ids) (((cls.model.user_id.in_(joined_tenant_ids)) & (cls.model.permission == TenantPermission.TEAM.value)) | (cls.model.user_id == user_id))
#(((cls.model.user_id.in_(joined_tenant_ids)) & (cls.model.permission == TenantPermission.TEAM.value)) | (cls.model.user_id == user_id))
) )
if canvas_category: if canvas_category:
agents = agents.where(cls.model.canvas_category == canvas_category) agents = agents.where(cls.model.canvas_category == canvas_category)

View File

@ -733,7 +733,7 @@ async def run_toc_from_text(chunks, chat_mdl, callback=None):
max_len = 12 if prune else 22 max_len = 12 if prune else 22
filtered = [] filtered = []
for x in titles: for x in titles:
if not x.get("title") or x["title"] == "-1": if not isinstance(x, dict) or not x.get("title") or x["title"] == "-1":
continue continue
if len(rag_tokenizer.tokenize(x["title"]).split(" ")) > max_len: if len(rag_tokenizer.tokenize(x["title"]).split(" ")) > max_len:
continue continue