refactor(api): add UserFrom creator role conversion and reuse in knowledge retrieval

Tests not run (not requested).
This commit is contained in:
-LAN-
2026-01-06 19:53:58 +08:00
parent b64725b733
commit 49c7501cc8
2 changed files with 7 additions and 2 deletions

View File

@ -12,6 +12,11 @@ class UserFrom(StrEnum):
ACCOUNT = "account"
END_USER = "end-user"
def to_creator_user_role(self) -> "CreatorUserRole":
if self == UserFrom.ACCOUNT:
return CreatorUserRole.ACCOUNT
return CreatorUserRole.END_USER
class WorkflowRunTriggeredFrom(StrEnum):
DEBUGGING = "debugging"