diff --git a/AIClasses/BaseAIFileService.ts b/AIClasses/BaseAIFileService.ts index 92df8be..ef2ec72 100644 --- a/AIClasses/BaseAIFileService.ts +++ b/AIClasses/BaseAIFileService.ts @@ -35,7 +35,7 @@ export abstract class BaseAIFileService implements IAIFileService { this.fileIDs = await this.listFilesFromAPI(); } - public async listFiles(): Promise { + public listFiles(): string[] { return [...this.fileIDs]; } @@ -78,7 +78,7 @@ export abstract class BaseAIFileService implements IAIFileService { // Retries operation on retryable errors (500, 502, 503, 504) with exponential backoff protected async withRetry(operationName: string, operation: () => Promise): Promise { - let lastError: ApiError | unknown; + let lastError: unknown; for (let attempt = 1; attempt <= BaseAIFileService.MAX_RETRIES; attempt++) { try { diff --git a/AIClasses/IAIFileService.ts b/AIClasses/IAIFileService.ts index edacdab..fc59c10 100644 --- a/AIClasses/IAIFileService.ts +++ b/AIClasses/IAIFileService.ts @@ -2,7 +2,7 @@ import type { Attachment } from "Conversations/Attachment"; export interface IAIFileService { refreshCache(): Promise; - listFiles(): Promise; + listFiles(): string[]; uploadFile(attachment: Attachment): Promise; deleteFile(attachment: Attachment): Promise; } \ No newline at end of file diff --git a/Types/ApiError.ts b/Types/ApiError.ts index ed2d39a..4044d5c 100644 --- a/Types/ApiError.ts +++ b/Types/ApiError.ts @@ -23,7 +23,7 @@ export class ApiError extends Error { this.name = "ApiError"; } - static isApiError(error: unknown): boolean { + static isApiError(error: unknown): error is ApiError { return error instanceof ApiError; }