Skip to content

Commit 210c5c0

Browse files
authored
fix(console): the API console's AI group lists the routes that exist (framework#3718) (#2921)
`/nlq`, `/suggest` and `/insights` sat in the developer API console's AI catalog with "try it" bodies and always 404'd — declared in the framework's `DEFAULT_AI_ROUTES`, implemented in no repo. framework#3840 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, adding the four the catalog never had: `GET`/`PATCH /conversations/:id` and the console-facing diagnostics `GET /status` and `GET /effective-model`. `POST /chat` streams unless told otherwise, so its template now sends `stream: false`; `/chat/stream` keeps the streaming one. Audited table: cloud's `packages/service-ai/src/ai-route-ledger.ts`.
1 parent 5b9cf96 commit 210c5c0

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

apps/console/src/pages/developer/hooks/useApiDiscovery.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,35 @@ function buildAuthEndpoints(authBase: string): EndpointDef[] {
4545
}
4646

4747
export const SERVICE_ENDPOINT_CATALOG: Record<string, { group: string; defaultRoute: string; endpoints: ServiceEndpointEntry[] }> = {
48+
// The twelve routes `buildAIRoutes()` mounts, in table order (framework#3718).
49+
// `/nlq`, `/suggest` and `/insights` used to sit here with "try it" bodies and
50+
// always 404'd — they were declared in the framework's `DEFAULT_AI_ROUTES` and
51+
// never implemented anywhere, so this page offered three endpoints that had no
52+
// server. The audited table is cloud's `packages/service-ai/src/
53+
// ai-route-ledger.ts`; when a route is added or renamed there, mirror it here.
54+
//
55+
// `/status` and `/effective-model` are deliberately NOT SDK surface (operator
56+
// diagnostics) — which is exactly why they belong on this page: it explores raw
57+
// HTTP, not `client.*`.
4858
ai: {
4959
group: 'AI',
5060
defaultRoute: '/api/v1/ai',
5161
endpoints: [
52-
{ method: 'POST', path: '/chat', desc: 'Chat completion', bodyTemplate: { messages: [{ role: 'user', content: '' }] } },
62+
// The endpoint STREAMS unless told otherwise, so the JSON template says so:
63+
// without `stream: false` a "try it" here buffers an SSE body as text.
64+
// `/chat/stream` below is the one that means to stream.
65+
{ method: 'POST', path: '/chat', desc: 'Chat completion (JSON)', bodyTemplate: { messages: [{ role: 'user', content: '' }], stream: false } },
5366
{ method: 'POST', path: '/chat/stream', desc: 'Streaming chat (SSE)', bodyTemplate: { messages: [{ role: 'user', content: '' }] } },
5467
{ method: 'POST', path: '/complete', desc: 'Text completion', bodyTemplate: { prompt: '' } },
5568
{ method: 'GET', path: '/models', desc: 'List available models' },
56-
{ method: 'POST', path: '/nlq', desc: 'Natural language query', bodyTemplate: { query: '' } },
57-
{ method: 'POST', path: '/suggest', desc: 'AI-powered suggestions', bodyTemplate: { object: '', field: '', context: {} } },
58-
{ method: 'POST', path: '/insights', desc: 'AI-generated insights', bodyTemplate: { object: '', recordIds: [] } },
69+
{ method: 'GET', path: '/status', desc: 'Active LLM adapter provenance' },
70+
{ method: 'GET', path: '/effective-model', desc: 'Effective model ids and where they came from' },
5971
{ method: 'POST', path: '/conversations', desc: 'Create conversation', bodyTemplate: {} },
6072
{ method: 'GET', path: '/conversations', desc: 'List conversations' },
61-
{ method: 'POST', path: '/conversations/:id/messages', desc: 'Add message to conversation', bodyTemplate: { role: 'user', content: '' } },
73+
{ method: 'GET', path: '/conversations/:id', desc: 'Get conversation with message history' },
74+
{ method: 'PATCH', path: '/conversations/:id', desc: 'Update conversation (title, metadata)', bodyTemplate: { title: '' } },
6275
{ method: 'DELETE', path: '/conversations/:id', desc: 'Delete conversation' },
76+
{ method: 'POST', path: '/conversations/:id/messages', desc: 'Add message to conversation', bodyTemplate: { role: 'user', content: '' } },
6377
],
6478
},
6579
workflow: {

0 commit comments

Comments
 (0)