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

Add SmartTrend pipe #1372

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Add SmartTrend pipe #1372

wants to merge 18 commits into from

Conversation

giraffekey
Copy link
Contributor

SmartTrend is a pipe created for the Developer Program that acts as a Twitter engagement assistant that finds relevant tweets and suggests replies to help the user engage more easily.

SmartTrend-2025-02-16_20.01.35.mp4

/claim #1191
/closes #1191

Copy link

vercel bot commented Feb 17, 2025

@giraffekey is attempting to deploy a commit to the louis030195's projects Team on Vercel.

A member of the Team first needs to authorize it.

@louis030195
Copy link
Collaborator

@giraffekey
Copy link
Contributor Author

I think this is an issue with different setups. I tried running the linkedin ai assistant to see how it works and got the error:

[chrome-route] chrome launch failed with error: Error: failed to connect to chrome debug port after all attempts

Mine works if you install puppeteer with npm i puppeteer, but I don't think that's very portable. I'm not sure how to automate these installations.

@giraffekey
Copy link
Contributor Author

I added a button that installs Chrome before the Connect button is enabled.

@louis030195
Copy link
Collaborator

@louis030195
Copy link
Collaborator

not enough user feedback, please show what the bot is doing, like write some status text idk

does not work in general, waited a bit, nothing happen

https://cap.so/s/n1mn2yxspxehbgq

@giraffekey
Copy link
Contributor Author

Should now connect to the already running browser instance instead of downloading Chrome for Testing. Added status text for the processes and toasts for any caught errors.

@louis030195
Copy link
Collaborator

Screenshot 2025-02-19 at 10 07 46 AM

1 does not compile

2

Error: dlopen(/Users/louisbeaumont/.screenpipe/pipes/smarttrend/node_modules/lmdb/build/Release/lmdb.node, 0x 0001): tried: '/Users/louisbeaumont/.screenpipe/pipes/smarttrend/node_modules/lmdb/build/Release/lmdb.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/louisbeaumont/.screenpipe/pipes/smarttrend/node_modules/lmdb/build/Release/lmdb.node' (no such file), '/Users/louisbeaumont/.scr eenpipe/pipes/smarttrend/node_modules/lmdb/build/Release/lmdb.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

Screenshot 2025-02-19 at 10 07 35 AM

@giraffekey
Copy link
Contributor Author

Should be fixed.

@louis030195
Copy link
Collaborator

https://cap.so/s/ds7rtm2rs18vwp3

does not work

@giraffekey
Copy link
Contributor Author

It can only connect to Chrome if the remote debugging port is open. Added code to open chrome with the correct args.

@louis030195
Copy link
Collaborator

@giraffekey
Copy link
Contributor Author

The only time it fails silently like that is when the AI model can't be detected.

It should work correctly with aiProviderType set to "openai" and openaiApiKey being set. It's also supposed to work with Ollama.

@louis030195
Copy link
Collaborator

@giraffekey
Copy link
Contributor Author

It turns out screenpipe cloud works differently than other OpenAI providers. I'm not able to use the ai crate's streamText and streamObject functions with it. I've implemented a fix to make text streaming work by parsing the errors, but streaming structured data is still only working with the normal OpenAI provider, which means tweet suggestions are not currently working.

@giraffekey
Copy link
Contributor Author

This code works with openai.com but does not work with screenpipe cloud:

import { streamObject } from "ai";
import { z } from "zod";

const schema = z.object({
  tweetId: z.string(),
  handle: z.string(),
  reason: z.string(),
  reply: z.string(),
});
const { elementStream } = await streamObject({
  model,
  output: "array",
  schema,
  prompt: "...",
});

@giraffekey
Copy link
Contributor Author

It should work with screenpipe cloud now, but it might sometimes fail if the AI returns incorrect schema, since it doesn't support object streaming.

@louis030195
Copy link
Collaborator

It should work with screenpipe cloud now, but it might sometimes fail if the AI returns incorrect schema, since it doesn't support object streaming.

you mean screenpipe-cloud does not support object streaming?

@Gmin2 can you fix that? will give tip

@louis030195
Copy link
Collaborator

louis030195 commented Feb 20, 2025

https://cap.so/s/1s3zr27j73w9ek5

thats great, starts to become rly good, few issues:

  • it grab focus on the chrome window and distract me from work, usually the linkedin agent was properly acting in background completely?
  • click on post does not find the tweet many times
  • stop bot does not do anything or there is no user feedback (need loading or something) and is slow
  • maybe need more settings on frequency, time, etc.
  • should let me give system prompt and/or use my style from usual x replies

logs

Screenshot 2025-02-20 at 8 59 39 AM

ill try to use more daily to see if it's useful

@Gmin2
Copy link
Contributor

Gmin2 commented Feb 20, 2025

@Gmin2 can you fix that? will give tip

sure @louis030195 ,
can yu share the output when yu run screenpipe cloud with strucctured outputs(cc @giraffekey )

@giraffekey
Copy link
Contributor Author

@Gmin2 can you fix that? will give tip

sure @louis030195 , can yu share the output when yu run screenpipe cloud with strucctured outputs(cc @giraffekey )

It doesn't give output. What happens is it hangs for a while, then stops the stream without having ever returned anything. When I use generateObject instead of streamObject I get a "max retries reached" error. Maybe it's trying to call an endpoint that doesn't exist.

@Gmin2
Copy link
Contributor

Gmin2 commented Feb 21, 2025

It doesn't give output. What happens is it hangs for a while, then stops the stream without having ever returned anything. When I use generateObject instead of streamObject I get a "max retries reached" error. Maybe it's trying to call an endpoint that doesn't exist.

Investigating 🕵️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bounty] [pipe] [developer program] twitter bot
3 participants