mirror of https://github.com/langgenius/dify.git
refactor: remove MemoryBlockWithVisibility
This commit is contained in:
parent
a8c2a300f6
commit
7c35aaa99d
|
|
@ -70,15 +70,6 @@ class MemoryBlock(BaseModel):
|
|||
node_id: Optional[str] = None
|
||||
|
||||
|
||||
class MemoryBlockWithVisibility(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
value: str
|
||||
version: int
|
||||
end_user_visible: bool
|
||||
end_user_editable: bool
|
||||
|
||||
|
||||
class MemoryValueData(BaseModel):
|
||||
value: str
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue