Skip to content

Commit

Permalink
fix: remove goku fallback image, env variable renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukapetro committed Jan 15, 2025
1 parent c433dc4 commit 98ca027
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
Binary file removed packages/client-instagram/assets/goku.png
Binary file not shown.
8 changes: 4 additions & 4 deletions packages/client-instagram/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ export async function validateInstagramConfig(
),

INSTAGRAM_ENABLE_ACTION_PROCESSING: parseBooleanFromText(
runtime.getSetting("ENABLE_ACTION_PROCESSING") ||
process.env.ENABLE_ACTION_PROCESSING
runtime.getSetting("INSTAGRAM_ENABLE_ACTION_PROCESSING") ||
process.env.INSTAGRAM_ENABLE_ACTION_PROCESSING
) ?? false,

INSTAGRAM_ACTION_INTERVAL: parseInt(
runtime.getSetting("ACTION_INTERVAL") ||
process.env.ACTION_INTERVAL ||
runtime.getSetting("INSTAGRAM_ACTION_INTERVAL") ||
process.env.INSTAGRAM_ACTION_INTERVAL ||
DEFAULT_ACTION_INTERVAL.toString(),
10
),
Expand Down
2 changes: 1 addition & 1 deletion packages/client-instagram/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const InstagramClientInterface: Client = {
await postService.start();
elizaLogger.log("Instagram post service started");

if (config.ENABLE_ACTION_PROCESSING) {
if (config.INSTAGRAM_ENABLE_ACTION_PROCESSING) {
await interactionService.start();
elizaLogger.log("Instagram interaction service started");
}
Expand Down
2 changes: 1 addition & 1 deletion packages/client-instagram/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function authenticate(

// Proceed with fresh login
try {
const loggedInUser = await ig.account.login(
await ig.account.login(
config.INSTAGRAM_USERNAME,
config.INSTAGRAM_PASSWORD
);
Expand Down
12 changes: 6 additions & 6 deletions packages/client-instagram/src/lib/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ export async function fetchRecentMedia(
const feed = ig.feed.user(ig.state.cookieUserId);
const items = await feed.items();

return items.slice(0, count).map(item => ({
return items.slice(0, count).map((item: any) => ({
id: item.id,
mediaType: item.media_type as MediaItem['mediaType'],
mediaUrl: item.media_url,
thumbnailUrl: item.thumbnail_url,
thumbnailUrl: item.thumbnail_url || null,
permalink: item.permalink,
caption: item.caption?.text,
caption: item.caption?.text || null,
timestamp: item.timestamp,
children: item.children?.map(child => ({
children: item.children?.map((child: any) => ({
id: child.id,
mediaType: child.media_type as MediaItem['mediaType'],
mediaUrl: child.media_url,
thumbnailUrl: child.thumbnail_url,
thumbnailUrl: child.thumbnail_url || null,
permalink: child.permalink,
timestamp: child.timestamp
}))
})) || null
}));
} catch (error) {
elizaLogger.error('Error fetching recent media:', error);
Expand Down
9 changes: 2 additions & 7 deletions packages/client-instagram/src/services/post.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// src/services/post.ts
import { IAgentRuntime, ModelClass, composeContext, elizaLogger, generateImage, generateText, getEmbeddingZeroVector, stringToUuid } from "@elizaos/core";
import { promises as fs } from 'fs';
import path, { dirname } from "path";
import path from "path";
import sharp from 'sharp';
import { fileURLToPath } from 'url';
import { getIgClient } from "../lib/state";
import { InstagramState } from "../types";

Expand Down Expand Up @@ -223,11 +222,7 @@ export class InstagramPostService {
stack: error instanceof Error ? error.stack : undefined,
phase: 'getOrGenerateImage'
});

// Fallback to default image if generation fails
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
return path.resolve(__dirname, '../assets/goku.png');
throw error;
}
}

Expand Down

0 comments on commit 98ca027

Please sign in to comment.