MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / exportConfig

Function exportConfig

web/src/components/playground/configStorage.js:146–168  ·  view source on GitHub ↗
(config, messages = null)

Source from the content-addressed store, hash-verified

144 * @param {Array} messages - 要导出的消息
145 */
146export const exportConfig = (config, messages = null) => {
147 try {
148 const configToExport = {
149 ...config,
150 messages: messages || loadMessages(), // 包含消息数据
151 exportTime: new Date().toISOString(),
152 version: '1.0',
153 };
154
155 const dataStr = JSON.stringify(configToExport, null, 2);
156 const dataBlob = new Blob([dataStr], { type: 'application/json' });
157
158 const link = document.createElement('a');
159 link.href = URL.createObjectURL(dataBlob);
160 link.download = `playground-config-${new Date().toISOString().split('T')[0]}.json`;
161 link.click();
162
163 URL.revokeObjectURL(link.href);
164
165 } catch (error) {
166 console.error('导出配置失败:', error);
167 }
168};
169
170/**
171 * 从文件导入配置(包含消息)

Callers 1

handleExportFunction · 0.90

Calls 1

loadMessagesFunction · 0.85

Tested by

no test coverage detected