Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/hash-synch-switching-machines #147

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, unlinkSync, writeFileSync } 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
Loading