fix: Make the latency and logs of web applications consistent.

pull/21578/head
刘江波 11 months ago
parent cea6522122
commit ad70b3360a

@ -395,6 +395,7 @@ class EasyUIBasedGenerateTaskPipeline(BasedGenerateTaskPipeline):
message.provider_response_latency = time.perf_counter() - self._start_at message.provider_response_latency = time.perf_counter() - self._start_at
message.total_price = usage.total_price message.total_price = usage.total_price
message.currency = usage.currency message.currency = usage.currency
self._task_state.llm_result.usage.latency = message.provider_response_latency
message.message_metadata = self._task_state.metadata.model_dump_json() message.message_metadata = self._task_state.metadata.model_dump_json()
if trace_manager: if trace_manager:

@ -160,12 +160,13 @@ class WorkflowCycleManager:
exceptions_count: int = 0, exceptions_count: int = 0,
) -> WorkflowExecution: ) -> WorkflowExecution:
workflow_execution = self._get_workflow_execution_or_raise_error(workflow_run_id) workflow_execution = self._get_workflow_execution_or_raise_error(workflow_run_id)
now = datetime.now(UTC).replace(tzinfo=None)
workflow_execution.status = WorkflowExecutionStatus(status.value) workflow_execution.status = WorkflowExecutionStatus(status.value)
workflow_execution.error_message = error_message workflow_execution.error_message = error_message
workflow_execution.total_tokens = total_tokens workflow_execution.total_tokens = total_tokens
workflow_execution.total_steps = total_steps workflow_execution.total_steps = total_steps
workflow_execution.finished_at = datetime.now(UTC).replace(tzinfo=None) workflow_execution.finished_at = now
workflow_execution.exceptions_count = exceptions_count workflow_execution.exceptions_count = exceptions_count
# Use the instance repository to find running executions for a workflow run # Use the instance repository to find running executions for a workflow run
@ -174,7 +175,6 @@ class WorkflowCycleManager:
) )
# Update the domain models # Update the domain models
now = datetime.now(UTC).replace(tzinfo=None)
for node_execution in running_node_executions: for node_execution in running_node_executions:
if node_execution.node_execution_id: if node_execution.node_execution_id:
# Update the domain model # Update the domain model

Loading…
Cancel
Save