MCPcopy
hub / github.com/HisMax/RedInk / autoSaveConfig

Function autoSaveConfig

frontend/src/composables/useProviderForm.ts:168–188  ·  view source on GitHub ↗

* 自动保存配置

()

Source from the content-addressed store, hash-verified

166 * 自动保存配置
167 */
168 async function autoSaveConfig() {
169 try {
170 const config: Partial<Config> = {
171 text_generation: {
172 active_provider: textConfig.value.active_provider,
173 providers: textConfig.value.providers
174 },
175 image_generation: imageConfig.value
176 }
177
178 const result = await updateConfig(config)
179 if (result.success) {
180 // 重新加载配置以获取最新的脱敏 API Key
181 await loadConfig()
182 setSuccess(result.message || '配置已保存')
183 }
184 } catch (e) {
185 console.error('自动保存失败:', e)
186 setError(e, '保存配置失败')
187 }
188 }
189
190 function setSuccess(message: string) {
191 feedback.value = { type: 'success', message }

Callers 6

activateTextProviderFunction · 0.85
saveTextProviderFunction · 0.85
deleteTextProviderFunction · 0.85
activateImageProviderFunction · 0.85
saveImageProviderFunction · 0.85
deleteImageProviderFunction · 0.85

Calls 4

updateConfigFunction · 0.90
loadConfigFunction · 0.85
setSuccessFunction · 0.85
setErrorFunction · 0.85

Tested by

no test coverage detected