|
|
|
|
@ -324,19 +324,10 @@ class WorkflowService:
|
|
|
|
|
if not draft_workflow:
|
|
|
|
|
raise ValueError("Workflow not initialized")
|
|
|
|
|
|
|
|
|
|
# TODO(QuantumGhost): We may get rid of the `list_conversation_variables`
|
|
|
|
|
# here, and rely on `DraftVarLoader` to load conversation variables.
|
|
|
|
|
|
|
|
|
|
with Session(bind=db.engine) as session:
|
|
|
|
|
with Session(bind=db.engine, expire_on_commit=False) as session, session.begin():
|
|
|
|
|
draft_var_srv = WorkflowDraftVariableService(session)
|
|
|
|
|
draft_var_srv.prefill_conversation_variable_default_values(draft_workflow)
|
|
|
|
|
|
|
|
|
|
conv_vars_models = draft_var_srv.list_conversation_variables(app_id=app_model.id)
|
|
|
|
|
conv_vars = [
|
|
|
|
|
segment_to_variable(segment=v.get_value(), id=v.id, selector=v.get_selector())
|
|
|
|
|
for v in conv_vars_models.variables
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
node_config = draft_workflow.get_node_config_by_id(node_id)
|
|
|
|
|
node_type = NodeType(node_config.get("data", {}).get("type"))
|
|
|
|
|
if node_type == NodeType.START:
|
|
|
|
|
@ -355,7 +346,8 @@ class WorkflowService:
|
|
|
|
|
user_id=account.id,
|
|
|
|
|
user_inputs=user_inputs,
|
|
|
|
|
workflow=draft_workflow,
|
|
|
|
|
conversation_variables=conv_vars,
|
|
|
|
|
# NOTE(QuantumGhost): We rely on `DraftVarLoader` to load conversation variables.
|
|
|
|
|
conversation_variables=[],
|
|
|
|
|
node_type=node_type,
|
|
|
|
|
conversation_id=conversation_id,
|
|
|
|
|
)
|
|
|
|
|
|