mirror of https://github.com/langgenius/dify.git
fix CI
This commit is contained in:
parent
e9657cfb48
commit
224f426765
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
from collections.abc import Sequence
|
||||
from typing import Protocol, cast
|
||||
|
||||
from sqlalchemy import desc, select
|
||||
from sqlalchemy.orm import Session, selectinload
|
||||
|
|
@ -14,6 +15,19 @@ from models.account import Account
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class _CommentAccountCache(Protocol):
|
||||
_created_by_account_cache: Account | None
|
||||
_resolved_by_account_cache: Account | None
|
||||
|
||||
|
||||
class _ReplyAccountCache(Protocol):
|
||||
_created_by_account_cache: Account | None
|
||||
|
||||
|
||||
class _MentionAccountCache(Protocol):
|
||||
_mentioned_user_account_cache: Account | None
|
||||
|
||||
|
||||
class WorkflowCommentService:
|
||||
"""Service for managing workflow comments."""
|
||||
|
||||
|
|
@ -65,12 +79,17 @@ class WorkflowCommentService:
|
|||
|
||||
# Cache accounts on objects
|
||||
for comment in comments:
|
||||
comment._created_by_account_cache = account_map.get(comment.created_by)
|
||||
comment._resolved_by_account_cache = account_map.get(comment.resolved_by) if comment.resolved_by else None
|
||||
comment_cache = cast(_CommentAccountCache, comment)
|
||||
comment_cache._created_by_account_cache = account_map.get(comment.created_by)
|
||||
comment_cache._resolved_by_account_cache = (
|
||||
account_map.get(comment.resolved_by) if comment.resolved_by else None
|
||||
)
|
||||
for reply in comment.replies:
|
||||
reply._created_by_account_cache = account_map.get(reply.created_by)
|
||||
reply_cache = cast(_ReplyAccountCache, reply)
|
||||
reply_cache._created_by_account_cache = account_map.get(reply.created_by)
|
||||
for mention in comment.mentions:
|
||||
mention._mentioned_user_account_cache = account_map.get(mention.mentioned_user_id)
|
||||
mention_cache = cast(_MentionAccountCache, mention)
|
||||
mention_cache._mentioned_user_account_cache = account_map.get(mention.mentioned_user_id)
|
||||
|
||||
@staticmethod
|
||||
def get_comment(tenant_id: str, app_id: str, comment_id: str, session: Session | None = None) -> WorkflowComment:
|
||||
|
|
|
|||
Loading…
Reference in New Issue