Enhance workflow name detection by checking multiple event payload fields
This commit is contained in:
11
src/App.jsx
11
src/App.jsx
@@ -1205,6 +1205,10 @@ export default function App() {
|
|||||||
return buildModelPickerOptions(availableChatModels, model, 'saved model unavailable')
|
return buildModelPickerOptions(availableChatModels, model, 'saved model unavailable')
|
||||||
}, [availableChatModels, model])
|
}, [availableChatModels, model])
|
||||||
|
|
||||||
|
function getWorkflowEventName(event) {
|
||||||
|
return event?.payload?.workflow?.name || event?.payload?.name || event?.payload?.workflow_name || null
|
||||||
|
}
|
||||||
|
|
||||||
const handleWorkflowRunEvent = React.useCallback((sessionId, event) => {
|
const handleWorkflowRunEvent = React.useCallback((sessionId, event) => {
|
||||||
if (
|
if (
|
||||||
event.type === 'tool_result'
|
event.type === 'tool_result'
|
||||||
@@ -1215,9 +1219,10 @@ export default function App() {
|
|||||||
void refreshLibraryJobs()
|
void refreshLibraryJobs()
|
||||||
}
|
}
|
||||||
setWorkflowExecutions(previous => {
|
setWorkflowExecutions(previous => {
|
||||||
|
const eventWorkflowName = getWorkflowEventName(event)
|
||||||
const current = previous[sessionId] || {
|
const current = previous[sessionId] || {
|
||||||
runId: event.run_id,
|
runId: event.run_id,
|
||||||
workflowName: event.payload?.workflow?.name || 'Workflow',
|
workflowName: eventWorkflowName || 'Workflow',
|
||||||
status: 'running',
|
status: 'running',
|
||||||
startedAt: Date.now(),
|
startedAt: Date.now(),
|
||||||
events: [],
|
events: [],
|
||||||
@@ -1227,7 +1232,7 @@ export default function App() {
|
|||||||
...previous,
|
...previous,
|
||||||
[sessionId]: {
|
[sessionId]: {
|
||||||
runId: event.run_id,
|
runId: event.run_id,
|
||||||
workflowName: event.payload?.workflow?.name || 'Workflow',
|
workflowName: eventWorkflowName || 'Workflow',
|
||||||
status: 'running',
|
status: 'running',
|
||||||
startedAt: Date.now(),
|
startedAt: Date.now(),
|
||||||
events: [event],
|
events: [event],
|
||||||
@@ -1256,7 +1261,7 @@ export default function App() {
|
|||||||
[sessionId]: {
|
[sessionId]: {
|
||||||
...current,
|
...current,
|
||||||
runId: event.run_id || current.runId,
|
runId: event.run_id || current.runId,
|
||||||
workflowName: event.payload?.workflow?.name || current.workflowName,
|
workflowName: eventWorkflowName || current.workflowName,
|
||||||
status,
|
status,
|
||||||
finishedAt,
|
finishedAt,
|
||||||
events: [...(current.events || []), event].slice(-120),
|
events: [...(current.events || []), event].slice(-120),
|
||||||
|
|||||||
Reference in New Issue
Block a user