UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

36 lines (34 loc) 1.04 kB
"use client"; class ChatbotAPIError extends Error { constructor(message, status, code) { super(message); this.status = status; this.code = code; this.name = "ChatbotAPIError"; } } // Retry mechanism for failed requests async function withRetry(operation, maxRetries = 3, delay = 1000) { let lastError; for (let attempt = 1; attempt <= maxRetries; attempt++) { try { return await operation(); } catch (error) { lastError = error; // Don't retry on client errors (4xx) if (error instanceof ChatbotAPIError && error.status && error.status >= 400 && error.status < 500) { throw error; } if (attempt < maxRetries) { await new Promise((resolve) => setTimeout(resolve, delay * attempt)); } } } throw lastError; } export { ChatbotAPIError, withRetry }; //# sourceMappingURL=chatbot-api.js.map