diff --git a/src/agents/tools/utils/localHashStorage.ts b/src/agents/tools/utils/localHashStorage.ts index 1bb85834..c9d981ee 100644 --- a/src/agents/tools/utils/localHashStorage.ts +++ b/src/agents/tools/utils/localHashStorage.ts @@ -1,5 +1,5 @@ import { join } from 'path'; -import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'; +import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'fs'; import { createLogger } from '../../../utils/logger.js'; const logger = createLogger('local-hash-storage'); @@ -37,3 +37,12 @@ export const getLocalHash = (): string | null => { return null; } }; + +export const deleteLocalHash = (): void => { + try { + unlinkSync(HASH_FILE); + logger.info('Local hash deleted'); + } catch (error) { + logger.error('Failed to delete local hash:', error); + } +}; diff --git a/src/index.ts b/src/index.ts index f60782e6..3d8be678 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { config } from './config/index.js'; import { createLogger } from './utils/logger.js'; import { runWorkflow } from './agents/workflows/kol/workflow.js'; - +import { deleteLocalHash } from './agents/tools/utils/localHashStorage.js'; const logger = createLogger('app'); // Get character name from command line args @@ -25,6 +25,7 @@ const startWorkflowPolling = async () => { const main = async () => { try { + deleteLocalHash(); await startWorkflowPolling(); setInterval(startWorkflowPolling, config.twitterConfig.RESPONSE_INTERVAL_MS);