Skip to content

Show /v1/decisions examples for cloud typed-decision models - #242

Merged
apapi merged 1 commit into
mainfrom
fix-241-gateway-decisions-example
Nov 4, 2026
Merged

apapi merged 1 commit into
mainfrom
fix-241-gateway-decisions-example

Conversation

@apapi

@apapi apapi commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Problem

In the AI Gateway page, opening 调用方式 for the cloud model
convaiinnovations/laya showed only chat-completions examples, even though
the gateway advertises it as typed-decisions (#241).

Two gaps caused it:

  • AIGateway.tsx never passed isDecision / isDecisionOnly to
    ApiInfoDialog, so it always rendered the chat examples.
  • Provider-scoped routes had no POST /providers/{providerID}/v1/decisions,
    so the URL in a decisions example would have returned 404.

Changes

  • Gateway UI: cloud provider cards now pass the model's typed_decisions /
    decision_only flags to ApiInfoDialog. decisionsSupported is explicit
    and only true for the cloud provider; third-party providers and provider
    pools keep chat-only examples.
  • Provider-scoped decisions route: POST /providers/{providerID}/v1/decisions
    is wired to the existing handler and honors the route source:
    /providers/csghub skips the local-first lookup, /providers/local requires
    a downloaded model, and third-party providers, pools, cluster and node
    routes return 400 decisions are only available for local and cloud models.
  • Docs: openapi/local-api.json and its embedded copy document the new
    route; the route-family sync test covers it.
  • Root POST /v1/decisions behavior is unchanged.

Testing

  • go test ./internal/server — passes, including new cases for the cloud
    route, third-party provider rejection, pool rejection and local-route
    rejection.
  • cd web && npm test — 23 files, 90 tests pass.
  • cd web && npm run build — passes.
  • Manual: fake AIGateway + browser. convaiinnovations/laya shows only the
    Decisions example with .../providers/csghub/v1/decisions; a chat model
    still shows chat examples; third-party/pool/local negative cases return 400.

web/dist is gitignored; it was rebuilt and synced into
internal/server/static only for local preview.

Fixes #241.

- Pass typed_decisions/decision_only to the gateway API dialog for cloud provider cards.
- Add POST /providers/{providerID}/v1/decisions; third-party providers and pools return a clear 400.
- Document the provider-scoped decisions route in OpenAPI.

Fixes #241.
@apapi
apapi merged commit d861cb5 into main Nov 4, 2026
4 checks passed
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.

/v1/decisions 协议用例错误

1 participant