Generative-X (twitter) augments your twitter timeline with AI using image filters, text-to-speech, auto replies, and dynamic UI components that pop in to give more context to tweets!
Built during the SPCxOpenAI Hackathon
Under the hood, there's a nextjs application and a chrome extension used to pull tweets off of your feed and inject the nextjs app as an iframe into X
Let's start by running the nextjs app wwhich will use a sample twitter feed
- Add your OPENAI_API_KEY and ELEVENLABS_API_KEY (used for tts)
cp .env.local.example .env.local
- Run the application
npm run dev
- Try out the image filters (these will be snappy as they're cached)
- Try out the dynamic UI switch
You'll need to load the extension into your browser to use it
- Download this repo - the extension is in the
chrome_extensions/src
folder (where this file is) - Open Chrome > Go to Extensions
- Enable Developer mode (switch top-right)
- Click on "Load unpacked" and select the
src
folder at the same level of this file
- Browse to https://twitter.com
- Click on the extension icon in the toolbar (heart-shaped for now)
- Select "X Timeline" from the menu
There are currently 5 dynamic components that can be rendered based on tweet context. We use GPT3.5 with function calling to determine which component to render.
Dynamic User Interfaces (DUIs) can be found in /app/components/dui
-
weather.tsx
Renders live weather data if location and "weather" is mentioned in a tweet -
stocks.tsx
Renders live stock data if a ticker symbol i.e $TSLA is mentioned in a tweet -
poltics.tsx
Renders a political scale with refeference links (generated from perplexity sonar) if a tweet is poltical -
clothing.tsx
This component will try to match the clothing items in a tweet image to items in the Nordstrom Rack catalog. For the demo it will only render for tweets under the @TechBroDrip -
Reply.tsx
Renders a few suggested replies with tts in a reply component. This is the default component is there are not other components rendered.
This application gets better with more components. If you have ideas for components that could augment the X experience, open a PR.
Docs on adding new components flow coming soon.
- move function calling router out of
actions/tsx
and into it's own api (there is currently an issue where server action calls are not parallelized in production see vercel/next.js#50743)