mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
refactor: remove MemoryBlockWithVisibility
This commit is contained in:
@ -11,7 +11,6 @@ from core.llm_generator.llm_generator import LLMGenerator
|
||||
from core.memory.entities import (
|
||||
MemoryBlock,
|
||||
MemoryBlockSpec,
|
||||
MemoryBlockWithVisibility,
|
||||
MemoryScheduleMode,
|
||||
MemoryScope,
|
||||
MemoryTerm,
|
||||
@ -376,33 +375,6 @@ class ChatflowMemoryService:
|
||||
)
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
def _with_visibility(
|
||||
app: App,
|
||||
raw_results: Sequence[ChatflowMemoryVariable]
|
||||
) -> Sequence[MemoryBlockWithVisibility]:
|
||||
workflow = WorkflowService().get_published_workflow(app)
|
||||
if not workflow:
|
||||
return []
|
||||
results = []
|
||||
for chatflow_memory_variable in raw_results:
|
||||
spec = next(
|
||||
(spec for spec in workflow.memory_blocks if spec.id == chatflow_memory_variable.memory_id),
|
||||
None
|
||||
)
|
||||
if spec:
|
||||
results.append(
|
||||
MemoryBlockWithVisibility(
|
||||
id=chatflow_memory_variable.memory_id,
|
||||
name=chatflow_memory_variable.name,
|
||||
value=MemoryValueData.model_validate_json(chatflow_memory_variable.value).value,
|
||||
end_user_editable=spec.end_user_editable,
|
||||
end_user_visible=spec.end_user_visible,
|
||||
version=chatflow_memory_variable.version
|
||||
)
|
||||
)
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
def _should_update_memory(
|
||||
memory_block: MemoryBlock,
|
||||
|
||||
Reference in New Issue
Block a user