Skip to content

Commit 04fbf01

Browse files
authored
Merge branch 'develop' into refactor-farcaster-client
2 parents 10b0e5c + 89b6a19 commit 04fbf01

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
## ✨ Features
2424

2525
- 🛠️ Full-featured Discord, Twitter and Telegram connectors
26-
- 🔗 Support for every model (Llama, Grok, OpenAI, Anthropic, etc.)
26+
- 🔗 Support for every model (Llama, Grok, OpenAI, Anthropic, Gemini, etc.)
2727
- 👥 Multi-agent and room support
2828
- 📚 Easily ingest and interact with your documents
2929
- 💾 Retrievable memory and document store
3030
- 🚀 Highly extensible - create your own actions and clients
31-
- ☁️ Supports many models (local Llama, OpenAI, Anthropic, Groq, etc.)
3231
- 📦 Just works!
3332

3433
## Video Tutorials

packages/client-farcaster/src/actions.ts

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export async function sendCast({
5050
cast,
5151
memory: createCastMemory({
5252
roomId,
53+
senderId: runtime.agentId,
5354
runtime,
5455
cast,
5556
}),

packages/client-farcaster/src/interactions.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ export class FarcasterInteractionManager {
141141

142142
const currentPost = formatCast(cast);
143143

144+
const senderId = stringToUuid(cast.authorFid.toString());
145+
144146
const { timeline } = await this.client.getTimeline({
145147
fid: agent.fid,
146148
pageSize: 10,
@@ -193,6 +195,7 @@ export class FarcasterInteractionManager {
193195
await this.runtime.messageManager.createMemory(
194196
createCastMemory({
195197
roomId: memory.roomId,
198+
senderId,
196199
runtime: this.runtime,
197200
cast,
198201
})
@@ -269,7 +272,7 @@ export class FarcasterInteractionManager {
269272
}
270273
return results.map((result) => result.memory);
271274
} catch (error) {
272-
console.error("Error sending response cast:", error);
275+
elizaLogger.error("Error sending response cast:", error);
273276
return [];
274277
}
275278
};

packages/client-farcaster/src/memory.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import { FarcasterClient } from "./client";
1313

1414
export function createCastMemory({
1515
roomId,
16+
senderId,
1617
runtime,
1718
cast,
1819
}: {
1920
roomId: UUID;
21+
senderId: UUID;
2022
runtime: IAgentRuntime;
2123
cast: Cast;
2224
}): Memory {
@@ -33,7 +35,7 @@ export function createCastMemory({
3335
agentId: runtime.agentId,
3436
}),
3537
agentId: runtime.agentId,
36-
userId: runtime.agentId,
38+
userId: senderId,
3739
content: {
3840
text: cast.text,
3941
source: "farcaster",
@@ -75,7 +77,7 @@ export async function buildConversationThread({
7577
if (!memory) {
7678
elizaLogger.log("Creating memory for cast", currentCast.hash);
7779

78-
const userId = stringToUuid(currentCast.profile.username);
80+
const userId = stringToUuid(currentCast.authorFid.toString());
7981

8082
await runtime.ensureConnection(
8183
userId,
@@ -88,6 +90,7 @@ export async function buildConversationThread({
8890
await runtime.messageManager.createMemory(
8991
createCastMemory({
9092
roomId,
93+
senderId: userId,
9194
runtime,
9295
cast: currentCast,
9396
})

packages/client-farcaster/src/post.ts

+1
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ export class FarcasterPostManager {
218218
await this.runtime.messageManager.createMemory(
219219
createCastMemory({
220220
roomId,
221+
senderId: this.runtime.agentId,
221222
runtime: this.runtime,
222223
cast,
223224
})

0 commit comments

Comments
 (0)