Sfoglia il codice sorgente

threadRelations -> expiredThreadRelations

Shun Miyazawa 1 anno fa
parent
commit
fb767d3a85
1 ha cambiato i file con 5 aggiunte e 5 eliminazioni
  1. 5 5
      apps/app/src/features/openai/server/services/openai.ts

+ 5 - 5
apps/app/src/features/openai/server/services/openai.ts

@@ -72,18 +72,18 @@ class OpenaiService implements IOpenaiService {
   }
 
   public async deleteExpiredThreads(limit: number): Promise<void> {
-    const threadRelations = await ThreadRelationModel.getExpiredThreadRelations(limit);
-    if (threadRelations == null) {
+    const expiredThreadRelations = await ThreadRelationModel.getExpiredThreadRelations(limit);
+    if (expiredThreadRelations == null) {
       return;
     }
 
     const deletedThreadIds: string[] = [];
-    for (const threadRelation of threadRelations) {
+    for (const expiredThreadRelation of expiredThreadRelations) {
       try {
         // eslint-disable-next-line no-await-in-loop
-        const deleteThreadResponse = await this.client.deleteThread(threadRelation.threadId);
+        const deleteThreadResponse = await this.client.deleteThread(expiredThreadRelation.threadId);
         logger.debug('Delete thread', deleteThreadResponse);
-        deletedThreadIds.push(threadRelation.threadId);
+        deletedThreadIds.push(expiredThreadRelation.threadId);
       }
       catch (err) {
         logger.error(err);