Skip to content

Commit 74a4cf5

Browse files
committed
Updated to delete uploaded dictionary files
1 parent c3be2c0 commit 74a4cf5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

i18n/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ async function saveSummaryLog() {
4242
})
4343
).then(() => console.log("successfully removed all assistants"));
4444

45+
// list and delete all uploaded files
46+
const files = await ai.files.list();
47+
await Promise.all(
48+
files.data.map(async file => {
49+
try {
50+
await ai.files.del(file.id);
51+
} catch (error) {
52+
failedDel.push(file.id);
53+
}
54+
})
55+
).then(() => console.log("successfully deleted all files"))
56+
4557
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
4658
let summaryLog = `
4759
Translation Summary (${timestamp})
@@ -250,7 +262,7 @@ export default async function fancyName(path: string) {
250262
const results = await Promise.allSettled(
251263
batch.map(async file => {
252264
try {
253-
console.log(`Translating file: ${file}`);
265+
console.log(`Starting translation for ${file}`);
254266
await translate("Chinese", file);
255267
return { file, success: true };
256268
} catch (error) {

0 commit comments

Comments
 (0)