mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-12 23:31:02 +00:00
123e27643d
The three AI addons share one tile in the integration column; a dialog holds the connection, the assistant's limits and AI parsing, which now reads with the assistant's connection unless an install keeps its own. Existing parsing configs stay where they are and keep winning. The chat sees the map on screen, offers next questions under an answer, shows its live step in the window head, previews waiting changes inside the day list, checks whether a day still works, folds a multi-day plan into a week grid, keeps per-trip notes and can estimate costs. An empty or cut-off answer gets one push instead of ending silently, and the assistant's own step and size limits are raised.
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { SetMetadata } from '@nestjs/common';
|
|
|
|
export const REQUIRE_ADDON = 'trek:require-addon';
|
|
|
|
export interface RequireAddonMeta {
|
|
/** The addon, or several of which any one being on opens the route. */
|
|
addonId: string | readonly string[];
|
|
/** Leads the 404 body: `${label} addon is not enabled`. */
|
|
label: string;
|
|
}
|
|
|
|
/**
|
|
* Gate a controller (or a single handler) on a global addon toggle. When the
|
|
* admin has the addon off, the route answers 404 as if it did not exist.
|
|
*
|
|
* Pair it with AddonGuard, and list that guard BEFORE JwtAuthGuard:
|
|
*
|
|
* @UseGuards(AddonGuard, JwtAuthGuard)
|
|
* @RequireAddon(ADDON_IDS.JOURNEY, 'Journey')
|
|
*
|
|
* The order is the contract, not a preference — a disabled addon has to answer
|
|
* 404 to anonymous callers too, so the addon check has to run before the 401.
|
|
*
|
|
* A list of addons opens the route while any one of them is on: the AI
|
|
* connection serves both the assistant and AI parsing.
|
|
*/
|
|
export const RequireAddon = (addonId: string | readonly string[], label: string) =>
|
|
SetMetadata<string, RequireAddonMeta>(REQUIRE_ADDON, { addonId, label });
|