Skip to content

Commit e61466c

Browse files
authored
Added meme generator example (#1929)
1 parent 4b42f77 commit e61466c

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

docs/docs.json

+1
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
"guides/example-projects/batch-llm-evaluator",
322322
"guides/example-projects/claude-thinking-chatbot",
323323
"guides/example-projects/human-in-the-loop-workflow",
324+
"guides/example-projects/meme-generator-human-in-the-loop",
324325
"guides/example-projects/realtime-csv-importer",
325326
"guides/example-projects/realtime-fal-ai",
326327
"guides/example-projects/turborepo-monorepo-prisma",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: "Meme generator with human-in-the-loop approval"
3+
sidebarTitle: "AI meme generator"
4+
description: "This example project creates memes using OpenAI's DALL-E 3 with a human-in-the-loop approval workflow built using Trigger.dev waitpoint tokens."
5+
---
6+
7+
import UpgradeToV4Note from "/snippets/upgrade-to-v4-note.mdx";
8+
9+
<UpgradeToV4Note />
10+
11+
## Overview
12+
13+
This demo is a full stack example that uses the following:
14+
15+
- A [Next.js](https://nextjs.org/) app, with an [endpoint](https://github.com/triggerdotdev/examples/blob/main/meme-generator-human-in-the-loop/src/app/endpoints/[slug]/page.tsx) for approving the generated memes
16+
- [Trigger.dev](https://trigger.dev) tasks to generate the images and orchestrate the waitpoint workflow
17+
- [OpenAI DALL-E 3](https://platform.openai.com/docs/guides/images) for generating the images
18+
- A [Slack app](https://api.slack.com/quickstart) for the human-in-the-loop step, with the approval buttons linked to the endpoint
19+
20+
## GitHub repo
21+
22+
<Card
23+
title="View the meme generator human-in-the-loop example repo"
24+
icon="GitHub"
25+
href="https://github.com/triggerdotdev/examples/tree/main/meme-generator-human-in-the-loop"
26+
>
27+
Click here to view the full code for this project in our examples repository on GitHub. You can
28+
fork it and use it as a starting point for your own project.
29+
</Card>
30+
31+
## Post to Slack
32+
33+
![Meme Generator with Human-in-the-Loop Approval](/images/slack-meme-approval.png)
34+
35+
## Relevant code
36+
37+
- **Meme generator task**:
38+
39+
- The [memegenerator.ts](https://github.com/triggerdotdev/examples/blob/main/meme-generator-human-in-the-loop/src/trigger/memegenerator.ts) task:
40+
- Generates two meme variants using DALL-E 3
41+
- Uses [batchTriggerAndWait](/triggering#yourtask-batchtriggerandwait) to generate multiple meme variants simultaneously (this is because you can only generate 1 image at a time with DALL-E 3)
42+
- Creates a [waitpoint token](/wait-for-token)
43+
- Sends the generated images with approval buttons to Slack for review
44+
- Handles the approval workflow
45+
46+
- **Approval Endpoint**:
47+
- The waitpoint approval handling is in [page.tsx](https://github.com/triggerdotdev/examples/blob/main/meme-generator-human-in-the-loop/src/app/endpoints/[slug]/page.tsx), which processes:
48+
- User selections from Slack buttons
49+
- Waitpoint completion with the chosen meme variant
50+
- Success/failure feedback to the approver
51+
52+
## Learn more
53+
54+
To learn more, take a look at the following resources:
55+
56+
- [Waitpoint tokens](/wait-for-token) - learn about waitpoint tokens in Trigger.dev and human-in-the-loop flows
57+
- [OpenAI DALL-E API](https://platform.openai.com/docs/guides/images) - learn about the DALL-E image generation API
58+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API
59+
- [Slack Incoming Webhooks](https://api.slack.com/messaging/webhooks) - learn about integrating with Slack

docs/images/slack-meme-approval.png

90.2 KB
Loading

0 commit comments

Comments
 (0)