Skip to content

Add SmartTrend pipe #1372

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

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

Add SmartTrend pipe #1372

wants to merge 29 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

I fixed something but I doubt it was related.

@giraffekey
Copy link
Contributor Author

If it doesn't work this time I find it hard to believe that any of the other pipes work :P

@louis030195
Copy link
Collaborator

#1533

need to fix this first to test :(

@louis030195
Copy link
Collaborator

any chance u can add the ai preset to choose the model to use?

4408c18

@giraffekey
Copy link
Contributor Author

Done

@louis030195
Copy link
Collaborator

Screenshot 2025-03-13 at 5 09 07 PM

i can't scroll nor save :/

also why it's not showing existing presets like in search pipe or app ui?

also screenpipe cloud does not work, i cannot select models or type

btw u can publish ur pipe

https://docs.screenpi.pe/docs/plugins#developer-cli

u can probably make it between $20 and $50 a month, depending how much you want to maintain this i'm sure people would pay for this

(we'll give you a bounty soon also) cc @m13v did you test?

@giraffekey
Copy link
Contributor Author

I noticed I was using the wrong components. Still can't get screenpipe cloud to work (the component doesn't seem to ever call fetchOpenAIModels).

@giraffekey
Copy link
Contributor Author

Selecting screenpipe cloud models doesn't work here either
image

@louis030195
Copy link
Collaborator

@shaik-zeeshan any idea what's happening?

@louis030195
Copy link
Collaborator

Screenshot 2025-03-15 at 6 34 49 AM

@louis030195
Copy link
Collaborator

ok did small improvement on the UX in app ai preset for listing models, could be better

i wonder how we deal with people clicking on screenpipe cloud from a pipe if they are not subscribed

i guess same behaviour, open stripe and when they paid it would be unlocked

(rn we see you are not subscribed but does not seem obvious)

@giraffekey
Copy link
Contributor Author

Might work in my pipe for you at least. If not, I just tested it with OpenAI and it worked.

@shaik-zeeshan
Copy link
Contributor

shaik-zeeshan commented Mar 15, 2025

user need to be subscribed for screenpipe cloud to work or show models

i wonder how we deal with people clicking on screenpipe cloud from a pipe if they are not subscribed

maybe we could disable the option to select screenpipe cloud if user is not subscribed

@louis030195
Copy link
Collaborator

https://cap.so/s/6t2kw4a13aqy99z

can you update the store also?

@louis030195
Copy link
Collaborator

/tip $200 @giraffekey

thanks for the first versions 🙏

Copy link

algora-pbc bot commented Mar 17, 2025

🎉🎈 @giraffekey has been awarded $200! 🎈🎊

@louis030195
Copy link
Collaborator

love the new update

i think a good use case of screenpipe SDK for this pipe would be that you query twitter data at interval and turn into a kind of system prompt that you add in the prompts to generate tweets

so it learn to interact with twitter like i do

eg:

  1. every 60 mins
  2. pipe.queryScreenpipe with browser url "x.com" and limit 1000 or 10000 not sure it fit the prompt, and last 60 min of data
  3. deduplicate the data like this
  4. ask llm to create a short system prompt (say max 10-20 lines) that would help the next AI to write similar tweets / replies
  5. add to next prompts

and making sure if it fails to not affect rest of the flow

maybe make sure it does not use too much token

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
4 participants