From 1deecec5f40aff419f4a3332e5e40c51f46a4bfc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 28 Jul 2026 11:46:33 +0000 Subject: [PATCH] fix(console): the API console's AI group lists the routes that exist (framework#3718) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `/nlq`, `/suggest` and `/insights` sat in the developer API console's AI catalog with "try it" bodies and always 404'd. They came from the framework's `DEFAULT_AI_ROUTES` — a registration table with no runtime consumer — and were never implemented in any repo. framework#3718 deleted the declarations and the three dead `client.ai.*` methods that built the same URLs; this removes the last place a user could click them. The AI group now mirrors the twelve routes `buildAIRoutes()` mounts, in table order, adding the four the catalog never had: `GET /conversations/:id`, `PATCH /conversations/:id`, and the two console-facing diagnostics `GET /status` and `GET /effective-model`. Those two are deliberately not SDK surface, which is precisely why they belong on a page that explores raw HTTP rather than `client.*`. `POST /chat` streams unless the body says otherwise, so its template now sends `stream: false` — without it, "try it" buffers an SSE body as text under a JSON-shaped request. `/chat/stream` keeps the streaming template. The audited table lives in cloud's `packages/service-ai/src/ai-route-ledger.ts`, next to the routes; a comment here points at it. No test is added: this repo has no way to verify an AI URL resolves — service-ai is mounted from another repo — and a test that pins this list to a copy of itself would be the same kind of evidence-free assertion that let the three dead endpoints sit here unnoticed. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01WJX6GnuNix7HisBc92THMN --- .../pages/developer/hooks/useApiDiscovery.ts | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/console/src/pages/developer/hooks/useApiDiscovery.ts b/apps/console/src/pages/developer/hooks/useApiDiscovery.ts index 2a5d94ab95..1b24635590 100644 --- a/apps/console/src/pages/developer/hooks/useApiDiscovery.ts +++ b/apps/console/src/pages/developer/hooks/useApiDiscovery.ts @@ -45,21 +45,35 @@ function buildAuthEndpoints(authBase: string): EndpointDef[] { } export const SERVICE_ENDPOINT_CATALOG: Record = { + // The twelve routes `buildAIRoutes()` mounts, in table order (framework#3718). + // `/nlq`, `/suggest` and `/insights` used to sit here with "try it" bodies and + // always 404'd — they were declared in the framework's `DEFAULT_AI_ROUTES` and + // never implemented anywhere, so this page offered three endpoints that had no + // server. The audited table is cloud's `packages/service-ai/src/ + // ai-route-ledger.ts`; when a route is added or renamed there, mirror it here. + // + // `/status` and `/effective-model` are deliberately NOT SDK surface (operator + // diagnostics) — which is exactly why they belong on this page: it explores raw + // HTTP, not `client.*`. ai: { group: 'AI', defaultRoute: '/api/v1/ai', endpoints: [ - { method: 'POST', path: '/chat', desc: 'Chat completion', bodyTemplate: { messages: [{ role: 'user', content: '' }] } }, + // The endpoint STREAMS unless told otherwise, so the JSON template says so: + // without `stream: false` a "try it" here buffers an SSE body as text. + // `/chat/stream` below is the one that means to stream. + { method: 'POST', path: '/chat', desc: 'Chat completion (JSON)', bodyTemplate: { messages: [{ role: 'user', content: '' }], stream: false } }, { method: 'POST', path: '/chat/stream', desc: 'Streaming chat (SSE)', bodyTemplate: { messages: [{ role: 'user', content: '' }] } }, { method: 'POST', path: '/complete', desc: 'Text completion', bodyTemplate: { prompt: '' } }, { method: 'GET', path: '/models', desc: 'List available models' }, - { method: 'POST', path: '/nlq', desc: 'Natural language query', bodyTemplate: { query: '' } }, - { method: 'POST', path: '/suggest', desc: 'AI-powered suggestions', bodyTemplate: { object: '', field: '', context: {} } }, - { method: 'POST', path: '/insights', desc: 'AI-generated insights', bodyTemplate: { object: '', recordIds: [] } }, + { method: 'GET', path: '/status', desc: 'Active LLM adapter provenance' }, + { method: 'GET', path: '/effective-model', desc: 'Effective model ids and where they came from' }, { method: 'POST', path: '/conversations', desc: 'Create conversation', bodyTemplate: {} }, { method: 'GET', path: '/conversations', desc: 'List conversations' }, - { method: 'POST', path: '/conversations/:id/messages', desc: 'Add message to conversation', bodyTemplate: { role: 'user', content: '' } }, + { method: 'GET', path: '/conversations/:id', desc: 'Get conversation with message history' }, + { method: 'PATCH', path: '/conversations/:id', desc: 'Update conversation (title, metadata)', bodyTemplate: { title: '' } }, { method: 'DELETE', path: '/conversations/:id', desc: 'Delete conversation' }, + { method: 'POST', path: '/conversations/:id/messages', desc: 'Add message to conversation', bodyTemplate: { role: 'user', content: '' } }, ], }, workflow: {