Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

AI-83: Add /[type]/[id] endpoint for getting or generating things

Implementation Details

This PR adds a new API endpoint that follows the pattern /[type]/[id] in the ai-database package. The endpoint:

  1. Extracts the type and id parameters from the URL pathname
  2. Tries to find an existing thing in the database with matching type and ID
  3. If found, returns it with appropriate context and links
  4. If not found, queues a job using the existing 'generateThing' workflow to create it
  5. Returns a 202 status with job information when generation is in progress

The implementation follows the existing patterns in the codebase, particularly the /[id] route for nouns, but extends it to handle any type of thing.

Open Questions

  • Should we add any additional validation for the type parameter?
  • Should we enhance error handling for specific edge cases?

Additional Information

@linear
Copy link

linear bot commented May 17, 2025

@vercel
Copy link

vercel bot commented May 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ai-directory ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2025 1:59am
ai-landing-page ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2025 1:59am
db.mw ❌ Failed (Inspect) May 17, 2025 1:59am
ideas ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2025 1:59am
primitives.org.ai ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2025 1:59am

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@nathanclevenger
Copy link
Contributor

Error: You cannot use different slug names for the same dynamic path ('id' !== 'type').
at Array.forEach ()
 ELIFECYCLE  Command failed with exit code 1.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants