MCPcopy Create free account
hub / github.com/bywwcnll/StreamPanel / exportCurrentToCSV

Function exportCurrentToCSV

devtools/modules/exportManager.js:148–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146}
147
148export function exportCurrentToCSV() {
149 const connection = state.connections[state.selectedConnectionId];
150 if (!connection) {
151 alert('请先选择一个连接');
152 return;
153 }
154
155 const messages = getVisibleMessages(connection.messages);
156 if (messages.length === 0) {
157 alert('当前连接没有消息可导出');
158 return;
159 }
160
161 const formattedMessages = messages.map(msg => ({
162 ...msg,
163 timestamp: formatTimestampForExport(msg.timestamp)
164 }));
165
166 const csv = messagesToCSV(formattedMessages, getConnectionExportInfo(connection));
167 const filename = `stream-messages-${connection.id.substring(0, 8)}-${Date.now()}.csv`;
168 downloadFile(csv, filename, 'text/csv');
169}
170
171export function exportAllToCSV() {
172 const connections = Object.values(state.connections);

Callers 1

handleExportFunction · 0.70

Calls 5

formatTimestampForExportFunction · 0.90
downloadFileFunction · 0.90
getVisibleMessagesFunction · 0.70
messagesToCSVFunction · 0.70
getConnectionExportInfoFunction · 0.70

Tested by

no test coverage detected