2026-06-15 15:14:40 +02:00
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
|
|
export default function WorkflowSelector({ disabled, onChange, selection, workflows }) {
|
2026-06-15 20:27:56 +02:00
|
|
|
const value = selection.mode === 'explicit' ? `workflow:${selection.workflowId}` : 'direct'
|
2026-06-15 15:14:40 +02:00
|
|
|
return (
|
|
|
|
|
<label className="workflow-selector" title="Choose how this chat prompt is executed">
|
|
|
|
|
<span>Flow</span>
|
|
|
|
|
<select
|
|
|
|
|
value={value}
|
|
|
|
|
disabled={disabled}
|
|
|
|
|
onChange={(event) => {
|
|
|
|
|
const next = event.target.value
|
2026-06-15 20:27:56 +02:00
|
|
|
if (next === 'direct') onChange({ mode: next, workflowId: null })
|
2026-06-15 15:14:40 +02:00
|
|
|
else onChange({ mode: 'explicit', workflowId: next.replace(/^workflow:/, '') })
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<option value="direct">Direct</option>
|
|
|
|
|
{workflows.filter(item => item.enabled && item.slug !== 'input-output').map(item => (
|
|
|
|
|
<option key={item.id} value={`workflow:${item.id}`}>{item.name}</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
</label>
|
|
|
|
|
)
|
|
|
|
|
}
|