Skip to content

Commit

Permalink
address issue #140
Browse files Browse the repository at this point in the history
  • Loading branch information
Xm0onh committed Jan 16, 2025
1 parent e220402 commit 91c06dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/agents/tools/utils/localHashStorage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'path';
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from 'fs';
import { createLogger } from '../../../utils/logger.js';

const logger = createLogger('local-hash-storage');
Expand Down Expand Up @@ -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);
}
};
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,6 +25,7 @@ const startWorkflowPolling = async () => {

const main = async () => {
try {
deleteLocalHash();
await startWorkflowPolling();
setInterval(startWorkflowPolling, config.twitterConfig.RESPONSE_INTERVAL_MS);

Expand Down

0 comments on commit 91c06dc

Please sign in to comment.