mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 16:37:15 +08:00
refactor: use VersionedMemoryVariable in creation of WorkflowDraftVariable instead of StringVariable
This commit is contained in:
parent
613d086f1e
commit
516b6b0fa8
@ -14,6 +14,7 @@ from core.file.constants import maybe_file_object
|
|||||||
from core.file.models import File
|
from core.file.models import File
|
||||||
from core.memory.entities import MemoryBlockSpec
|
from core.memory.entities import MemoryBlockSpec
|
||||||
from core.variables import utils as variable_utils
|
from core.variables import utils as variable_utils
|
||||||
|
from core.variables.segments import VersionedMemoryValue
|
||||||
from core.variables.variables import FloatVariable, IntegerVariable, StringVariable
|
from core.variables.variables import FloatVariable, IntegerVariable, StringVariable
|
||||||
from core.workflow.constants import (
|
from core.workflow.constants import (
|
||||||
CONVERSATION_VARIABLE_NODE_ID,
|
CONVERSATION_VARIABLE_NODE_ID,
|
||||||
@ -1280,7 +1281,7 @@ class WorkflowDraftVariable(Base):
|
|||||||
node_id: str | None = None,
|
node_id: str | None = None,
|
||||||
memory_id: str,
|
memory_id: str,
|
||||||
name: str,
|
name: str,
|
||||||
value: str,
|
value: VersionedMemoryValue,
|
||||||
description: str = "",
|
description: str = "",
|
||||||
) -> "WorkflowDraftVariable":
|
) -> "WorkflowDraftVariable":
|
||||||
"""Create a new memory block draft variable."""
|
"""Create a new memory block draft variable."""
|
||||||
@ -1289,11 +1290,11 @@ class WorkflowDraftVariable(Base):
|
|||||||
app_id=app_id,
|
app_id=app_id,
|
||||||
node_id=MEMORY_BLOCK_VARIABLE_NODE_ID,
|
node_id=MEMORY_BLOCK_VARIABLE_NODE_ID,
|
||||||
name=name,
|
name=name,
|
||||||
value=value,
|
value=value.model_dump_json(),
|
||||||
description=description,
|
description=description,
|
||||||
selector=[MEMORY_BLOCK_VARIABLE_NODE_ID, memory_id] if node_id is None else
|
selector=[MEMORY_BLOCK_VARIABLE_NODE_ID, memory_id] if node_id is None else
|
||||||
[MEMORY_BLOCK_VARIABLE_NODE_ID, memory_id, node_id],
|
[MEMORY_BLOCK_VARIABLE_NODE_ID, memory_id, node_id],
|
||||||
value_type=SegmentType.STRING,
|
value_type=SegmentType.VERSIONED_MEMORY,
|
||||||
visible=True,
|
visible=True,
|
||||||
editable=True,
|
editable=True,
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user