Skip to content

Commit

Permalink
support features restore
Browse files Browse the repository at this point in the history
  • Loading branch information
warren830 committed Jan 9, 2025
1 parent 140965b commit 93bf1bc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion web/app/components/workflow/hooks/use-workflow-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,21 @@ export const useWorkflowRun = () => {
edges,
viewport,
})
featuresStore?.setState({ features: publishedWorkflow.features })
const mappedFeatures = {
opening: {
enabled: !!publishedWorkflow.features.opening_statement || !!publishedWorkflow.features.suggested_questions.length,
opening_statement: publishedWorkflow.features.opening_statement,
suggested_questions: publishedWorkflow.features.suggested_questions,
},
suggested: publishedWorkflow.features.suggested_questions_after_answer,
text2speech: publishedWorkflow.features.text_to_speech,
speech2text: publishedWorkflow.features.speech_to_text,
citation: publishedWorkflow.features.retriever_resource,
moderation: publishedWorkflow.features.sensitive_word_avoidance,
file: publishedWorkflow.features.file_upload,
}

featuresStore?.setState({ features: mappedFeatures })
workflowStore.getState().setPublishedAt(publishedWorkflow.created_at)
workflowStore.getState().setEnvironmentVariables(publishedWorkflow.environment_variables || [])
}, [featuresStore, handleUpdateWorkflowCanvas, workflowStore])
Expand Down

0 comments on commit 93bf1bc

Please sign in to comment.