stack/apps/backend/src/app/api/latest
aadesh18 8267ebce35
Custom dashboards and unified ai no playground (#1243)
This PR implements unified AI endpoint and custom dashboards. 

**Unified AI Endpoint**
We now use a single endpoint throughout the codebase that makes the call
to openrouter. Specifically, email drafts, email templates, email
themes, wysiwyg, cmd centre ai search and docs ai, all use this unified
ai endpoint. All the tools are defined in the backend, all the prompts
exist in the backend.

How to review this PR for unified ai endpoint:

This PR will be easier to review if we look at the different folders
that were affected.

under packages - We added streaming functionality, and made renaming
changes

under docs - there are three files that have changed
package.json - we updated the package (we were previously using a very
old version of the package)
route.ts - we changed the call from a direct call to openrouter to the
unified ai endpoint
ai-chat.tsx - because of updating the package, we had to make changes to
adapt to the latest versions of the package

under backend

route.ts - the main unified ai endpoint. this endpoint uses various
support files
forward.ts - this is the forward to production functionality
models.ts - consists of the models, and the rules for selecting those
models
prompts.ts - consists of the base prompt + specific system prompts
depending upon the usage
schema.ts
every single file under ai/tools folder - which as the name suggests,
consists of the implementations of the different tools that can be
provided to the llm
route-handlers - added support for streaming to SmartRoute and response
under dashboard

ai-search/route.ts - refactored the file to use unified ai endpoint
chat-adapters.ts - refactored the file to use unified ai endpoint and
created extra checks for the ai generated code

**Custom Dashboards**
We let the user write their query in english. We then use AI to create
dashboards that are interactive, live and savable. This PR includes a
new package called dashboard-ui-components. This package has components
that are used in the dashboard and more importantly, these components
are being imported from esm in the ai generated code for custom
dashboards. We also change the bar at the top for the products pages.

How to review this PR:

Review the new package (package/dashboard-ui-components), the setup and
the files inside it.
Review the schema changes in stack-shared/src
Review the changes in dashboard. The following changes have been made
Updated the design-components folder since we moved the dashboard
components to the new package
Updated imports for these components accordingly
Updated the title bar of the product pages
Created the files for custom dashboards under the dashboards folder and
components under commands/create-dashboard
Created a script under dashboard/scripts that generates the file with
type definitions that would go to the llm
Review the backend
Started using unified ai endpoint

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added custom dashboards feature allowing users to create and manage
personalized dashboards with AI assistance.
* Integrated AI-assisted dashboard code generation with visual preview
and editing capabilities.
* Introduced new AI query endpoints supporting stream and generate modes
with configurable model quality/speed settings.

* **Improvements**
* Reorganized UI components into a dedicated component library package
for better code reuse.
* Enhanced chat architecture with improved message handling and tool
integration.
* Updated AI provider integration with improved configuration
management.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
Co-authored-by: Bilal Godil <bg2002@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-13 20:24:40 +00:00
..
(api-keys) Upgrade Prisma to v7 (#1064) 2025-12-26 08:13:34 -08:00
ai/query/[mode] Custom dashboards and unified ai no playground (#1243) 2026-03-13 20:24:40 +00:00
analytics/events/batch Analytics event tracking (#1208) 2026-02-17 18:33:01 -08:00
auth "Require publishable client key" toggle (#1158) 2026-02-19 10:23:16 -08:00
check-feature-support fix types 2026-01-19 16:51:49 -08:00
check-version update version check alerter 2025-12-11 14:29:44 -08:00
connected-accounts More connected accounts (#1165) 2026-02-18 15:19:35 -08:00
contact-channels Upgrade ESLint 2026-02-27 10:58:28 -08:00
data-vault/stores/[id] encrypt neon connection strings, update connections route (#879) 2025-09-09 21:35:07 +00:00
emails [Refactor][Feat][Fix] Rework Email Section With New Sent Page, Better Drafts Page, and Settings Page (#1221) 2026-03-11 12:01:36 -07:00
integrations CLI init (#1242) 2026-03-13 10:55:22 -07:00
internal Custom dashboards and unified ai no playground (#1243) 2026-03-13 20:24:40 +00:00
migration-tests Move /api/v1 to /api/latest 2025-02-05 17:24:43 -08:00
oauth-providers Fix OAuth provider disablement 2026-02-24 12:43:41 -08:00
payments [Fix] [Refactor] Implement Base Settings for Stack-Auth Plans and Move Metadata from Stripe Webhook Event to Table (#1214) 2026-02-23 22:09:27 -08:00
project-permission-definitions Auto migration (#526) 2025-07-24 02:38:37 +02:00
project-permissions Auto migration (#526) 2025-07-24 02:38:37 +02:00
projects Onboarding app & restricted users (#1069) 2026-01-11 17:22:14 -08:00
projects-anonymous-users/[project_id]/.well-known Improved anonymous users (#857) 2025-08-24 11:36:01 -07:00
session-replays/batch analytics: reduce batch size limit (#1216) 2026-02-24 12:12:56 -08:00
team-invitations Fix tests 2026-02-17 19:57:08 -08:00
team-member-profiles Onboarding app & restricted users (#1069) 2026-01-11 17:22:14 -08:00
team-memberships Auto migration (#526) 2025-07-24 02:38:37 +02:00
team-permission-definitions Auto migration (#526) 2025-07-24 02:38:37 +02:00
team-permissions Auto migration (#526) 2025-07-24 02:38:37 +02:00
teams Upgrade Prisma to v7 (#1064) 2025-12-26 08:13:34 -08:00
users Fix restricted user schema 2026-02-11 10:52:55 -08:00
webhooks/svix-token svix embedded portal (#1007) 2025-11-11 11:06:09 -08:00
beta-changes.txt Move /api/v1 to /api/latest 2025-02-05 17:24:43 -08:00
changes.txt Move /api/v1 to /api/latest 2025-02-05 17:24:43 -08:00
route.ts Endpoints branching (#659) 2025-04-30 15:39:47 -07:00