mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 03:25:57 +08:00
fix(ops_trace_manager): Adds app_id to TraceTask initialization (#20461)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
parent
2ebf4e767b
commit
f2e0d161a1
@ -32,6 +32,7 @@ from core.repositories import SQLAlchemyWorkflowNodeExecutionRepository
|
|||||||
from core.workflow.nodes.enums import NodeType
|
from core.workflow.nodes.enums import NodeType
|
||||||
from extensions.ext_database import db
|
from extensions.ext_database import db
|
||||||
from models import Account, App, EndUser, WorkflowNodeExecutionTriggeredFrom
|
from models import Account, App, EndUser, WorkflowNodeExecutionTriggeredFrom
|
||||||
|
from models.account import TenantAccountJoin
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -130,6 +131,12 @@ class LangFuseDataTrace(BaseTraceInstance):
|
|||||||
service_account = session.query(Account).filter(Account.id == app.created_by).first()
|
service_account = session.query(Account).filter(Account.id == app.created_by).first()
|
||||||
if not service_account:
|
if not service_account:
|
||||||
raise ValueError(f"Creator account with id {app.created_by} not found for app {app_id}")
|
raise ValueError(f"Creator account with id {app.created_by} not found for app {app_id}")
|
||||||
|
current_tenant = (
|
||||||
|
session.query(TenantAccountJoin).filter_by(account_id=service_account.id, current=True).first()
|
||||||
|
)
|
||||||
|
if not current_tenant:
|
||||||
|
raise ValueError(f"Current tenant not found for account {service_account.id}")
|
||||||
|
service_account.set_tenant_id(current_tenant.tenant_id)
|
||||||
|
|
||||||
workflow_node_execution_repository = SQLAlchemyWorkflowNodeExecutionRepository(
|
workflow_node_execution_repository = SQLAlchemyWorkflowNodeExecutionRepository(
|
||||||
session_factory=session_factory,
|
session_factory=session_factory,
|
||||||
|
@ -487,6 +487,7 @@ class TraceTask:
|
|||||||
"file_list": file_list,
|
"file_list": file_list,
|
||||||
"triggered_from": workflow_run.triggered_from,
|
"triggered_from": workflow_run.triggered_from,
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
|
"app_id": workflow_run.app_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
workflow_trace_info = WorkflowTraceInfo(
|
workflow_trace_info = WorkflowTraceInfo(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user