Skip to content

Commit

Permalink
Update _worker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jyx04 authored Jun 21, 2024
1 parent 020caa9 commit 72c9027
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ if (url.pathname === '/backend-api/accounts/check') {
});
}
return response;
}

//初始化信息填入功能
async function handleInitialRequest(request) {
Expand Down Expand Up @@ -2667,25 +2668,6 @@ async function generateTableHTML(usersData, queryType) {
`;
}

function combineData(usersData, historyData) {
let combinedData = [];
let allUsers = new Set(usersData.map(u => u.user).concat(historyData.flatMap(h => h.usersData.map(u => u.user))));

allUsers.forEach(user => {
let historyUsage = historyData.map(h => {
let userUsage = h.usersData.find(u => u.user === user);
return userUsage ? { gpt4: userUsage.gpt4, gpt35: userUsage.gpt35 } : { gpt4: '', gpt35: '' };
});
let realTimeUsage = usersData.find(u => u.user === user);
combinedData.push({
user,
historyUsage,
realTimeUsage: realTimeUsage ? { gpt4: realTimeUsage.gpt4, gpt35: realTimeUsage.gpt35 } : { gpt4: '', gpt35: '' }
});
});

return combinedData;
}

function generateHeaderRow(historyData) {
return historyData.map(h => `<th>GPT-4</th><th>GPT-3.5</th>`).join('');
Expand Down

0 comments on commit 72c9027

Please sign in to comment.