MCPcopy
hub / github.com/OpenBMB/ChatDev / updateYaml

Function updateYaml

frontend/src/utils/apiFunctions.js:69–105  ·  view source on GitHub ↗
(filename, content)

Source from the content-addressed store, hash-verified

67}
68
69export async function updateYaml(filename, content) {
70 try {
71 const yamlFilename = addYamlSuffix(filename)
72 const response = await fetch(apiUrl(`/api/workflows/${encodeURIComponent(yamlFilename)}/update`), {
73 method: 'PUT',
74 headers: {
75 'Content-Type': 'application/json',
76 },
77 body: JSON.stringify({
78 content
79 })
80 })
81
82 const data = await response.json().catch(() => ({}))
83
84 if (response.ok) {
85 return {
86 success: true,
87 filename: data?.filename || yamlFilename,
88 message: data?.message || 'Workflow updated successfully'
89 }
90 }
91
92 return {
93 success: false,
94 detail: data?.detail,
95 message: data.error?.message || 'Failed to update workflow',
96 status: response.status
97 }
98 } catch (error) {
99 console.error('Error updating workflow YAML:', error)
100 return {
101 success: false,
102 message: 'API error'
103 }
104 }
105}
106
107// Rename YAML file
108export async function postYamlNameChange(filename, newFilename) {

Callers

nothing calls this directly

Calls 3

addYamlSuffixFunction · 0.85
apiUrlFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected