MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / postYamlNameChange

Function postYamlNameChange

frontend/src/utils/apiFunctions.js:108–145  ·  view source on GitHub ↗
(filename, newFilename)

Source from the content-addressed store, hash-verified

106
107// Rename YAML file
108export async function postYamlNameChange(filename, newFilename) {
109 try {
110 const yamlFilename = addYamlSuffix(filename)
111 const yamlNewFilename = addYamlSuffix(newFilename)
112 const response = await fetch(apiUrl(`/api/workflows/${encodeURIComponent(yamlFilename)}/rename`), {
113 method: 'POST',
114 headers: {
115 'Content-Type': 'application/json',
116 },
117 body: JSON.stringify({
118 new_filename: yamlNewFilename
119 })
120 })
121
122 const data = await response.json().catch(() => ({}))
123
124 if (response.ok) {
125 return {
126 success: true,
127 filename: data?.filename || yamlNewFilename,
128 message: data?.message || 'Workflow renamed successfully'
129 }
130 }
131
132 return {
133 success: false,
134 detail: data?.detail,
135 message: data?.message || 'Failed to rename workflow',
136 status: response.status
137 }
138 } catch (error) {
139 console.error('Error renaming workflow YAML:', error)
140 return {
141 success: false,
142 message: 'API error'
143 }
144 }
145}
146
147// Copy YAML file
148export async function postYamlCopy(filename, newFilename) {

Callers

nothing calls this directly

Calls 3

addYamlSuffixFunction · 0.85
apiUrlFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected