chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
60158935f4
commit
6519682885
15831 files changed
+3063428
No files matched your search
@@ -0,0 +1,64 @@
|
||||
"""Mutate owned conversations and dispatch cleanup after persistence commits."""
|
||||
|
||||
from typing import Protocol
|
||||
|
||||
from machinery.context import RequestContext
|
||||
from services.entities.conversation_entities import ConsoleConversationKind, ConversationDeletion, ConversationRef
|
||||
|
||||
|
||||
class ConversationCommandStore(Protocol):
|
||||
def mark_console_read(
|
||||
self, context: RequestContext, app_id: str, conversation_id: str, *, kind: ConsoleConversationKind
|
||||
) -> None: ...
|
||||
|
||||
def delete_console(
|
||||
self, context: RequestContext, app_id: str, conversation_id: str, *, kind: ConsoleConversationKind
|
||||
) -> ConversationDeletion:
|
||||
"""Delete the account's Console conversation within the admitted workspace."""
|
||||
...
|
||||
|
||||
def delete(self, *, ref: ConversationRef) -> ConversationDeletion:
|
||||
"""Commit soft deletion and workspace retirement before returning cleanup data."""
|
||||
...
|
||||
|
||||
def set_pinned(self, *, ref: ConversationRef, is_pinned: bool) -> None:
|
||||
"""Set the caller's pin; removing an absent pin succeeds."""
|
||||
...
|
||||
|
||||
|
||||
class ConversationCleanup(Protocol):
|
||||
def __call__(self, *, tenant_id: str, conversation_id: str, retired_workspace_ids: tuple[str, ...]) -> None: ...
|
||||
|
||||
|
||||
class ConversationCommandService:
|
||||
def __init__(self, *, conversations: ConversationCommandStore, enqueue_delete_cleanup: ConversationCleanup) -> None:
|
||||
self._conversations: ConversationCommandStore = conversations
|
||||
self._enqueue_delete_cleanup: ConversationCleanup = enqueue_delete_cleanup
|
||||
|
||||
def mark_console_read(
|
||||
self, context: RequestContext, app_id: str, conversation_id: str, *, kind: ConsoleConversationKind
|
||||
) -> None:
|
||||
"""Record the legacy Console read receipt after detail rendering succeeds."""
|
||||
self._conversations.mark_console_read(context, app_id, conversation_id, kind=kind)
|
||||
|
||||
def delete_console(
|
||||
self, context: RequestContext, app_id: str, conversation_id: str, *, kind: ConsoleConversationKind
|
||||
) -> None:
|
||||
deleted = self._conversations.delete_console(context, app_id, conversation_id, kind=kind)
|
||||
self._enqueue_delete_cleanup(
|
||||
tenant_id=deleted.tenant_id,
|
||||
conversation_id=deleted.conversation_id,
|
||||
retired_workspace_ids=deleted.retired_workspace_ids,
|
||||
)
|
||||
|
||||
def delete(self, *, ref: ConversationRef) -> None:
|
||||
deleted = self._conversations.delete(ref=ref)
|
||||
# The retirement and soft-delete commit must precede physical cleanup.
|
||||
self._enqueue_delete_cleanup(
|
||||
tenant_id=deleted.tenant_id,
|
||||
conversation_id=deleted.conversation_id,
|
||||
retired_workspace_ids=deleted.retired_workspace_ids,
|
||||
)
|
||||
|
||||
def set_pinned(self, *, ref: ConversationRef, is_pinned: bool) -> None:
|
||||
self._conversations.set_pinned(ref=ref, is_pinned=is_pinned)
|
||||
Reference in new issue
Block a user