mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 05:45:04 +03:00
A client (e.g. Fabric-AI) calling POST /v1/responses with `input: []` used to be translated into `messages: []`, which every upstream Chat- Completions provider rejects with `400: at least one message is required` (surfaced to the client as a confusing 406). Mirror the existing empty-string handling: when input[] is empty, inject a single placeholder user message so the request is always valid. Touches `openaiResponsesToOpenAIRequest` only (the same translator that already covers the empty-string case at the top of the function), preserves any caller-supplied `instructions` as a system message, and leaves every non-empty input path byte-identical. Adds a TDD test reproducing the empty input[] case (RED before fix, GREEN after) and updates one pre-existing test that enshrined the broken behavior (`assert.deepEqual(call.body.messages, [])`) to assert the new correct shape. Inspired-by: https://github.com/decolua/9router/pull/419 Co-authored-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>