mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
fix(ai): Codex backend request body matches OpenAI Responses schema
After v1.4.9 the OAuth connect went green, but every real insight
call still failed with:
Codex request failed (400): { "detail": "Input must be a list" }
The `chatgpt.com/backend-api/codex/responses` endpoint speaks the
OpenAI Responses API shape (`ResponsesApiRequest` in
`codex-rs/codex-api/src/common.rs`), where `input` is a list of typed
message items rather than a single string. CodexClient was sending
the older Chat-Completions-style body (`input: <string>`) which the
upstream rejects with the 400 above.
The body now mirrors the canonical shape:
{
"model": "gpt-5.3-codex",
"instructions": "<system prompt>",
"input": [
{ "type": "message", "role": "user",
"content": [{ "type": "input_text", "text": "<user prompt>" }] }
],
"tools": [], "tool_choice": "auto",
"parallel_tool_calls": false, "store": false, "stream": false
}
The response shape (Output `ResponseItem[]` with `output_text`
content) is unchanged, so `parseResponse` still works without
modification. Both Settings → KI "Verbindung testen" and the insight
generator now complete end-to-end through the ChatGPT subscription.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
3dbc8af627
commit
68e5797e48
3 files changed
+33
-2
No files matched your search
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## [1.4.10] — 2026-05-09
|
||||
|
||||
### Fixed — KI Insights via ChatGPT
|
||||
|
||||
- **Codex-Backend bekommt jetzt das richtige Request-Format.** Nach
|
||||
dem v1.4.9-Connect war der OAuth durch, aber jeder echte Insight-
|
||||
Call ist mit `Codex request failed (400) — "Input must be a list"`
|
||||
gestorben. Der `chatgpt.com/backend-api/codex/responses`-Endpoint
|
||||
spricht das OpenAI-Responses-API-Schema (`input: ResponseItem[]`)
|
||||
und nicht das Chat-Completions-Schema mit String-Input. v1.4.10
|
||||
baut den Body korrekt — `input` ist eine Liste mit einem
|
||||
Message-Item, das wiederum eine Liste von `input_text`-Content-
|
||||
Blöcken trägt — exakt wie die `ResponsesApiRequest`-Struktur im
|
||||
offiziellen `codex-rs/codex-api/src/common.rs`. Settings → KI
|
||||
"Verbindung testen" und der Insight-Generator laufen damit jetzt
|
||||
beide gegen dein ChatGPT-Abo durch.
|
||||
|
||||
## [1.4.9] — 2026-05-09
|
||||
|
||||
### Fixed — Settings · KI
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "healthlog",
|
||||
"version": "1.4.9",
|
||||
"version": "1.4.10",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@10.31.0",
|
||||
"scripts": {
|
||||
|
||||
@@ -69,6 +69,10 @@ export class CodexClient implements AIProvider {
|
||||
}
|
||||
|
||||
private async doRequest(params: CompletionParams): Promise<Response> {
|
||||
// The chatgpt.com/backend-api/codex/responses endpoint expects the
|
||||
// OpenAI Responses API shape: `input` is an array of typed message
|
||||
// items, NOT a raw string. The Codex CLI's `ResponsesApiRequest`
|
||||
// (`codex-rs/codex-api/src/common.rs`) is the canonical definition.
|
||||
return fetch(CODEX_ENDPOINT, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -78,7 +82,17 @@ export class CodexClient implements AIProvider {
|
||||
body: JSON.stringify({
|
||||
model: CODEX_MODEL,
|
||||
instructions: params.systemPrompt,
|
||||
input: params.userPrompt,
|
||||
input: [
|
||||
{
|
||||
type: "message",
|
||||
role: "user",
|
||||
content: [{ type: "input_text", text: params.userPrompt }],
|
||||
},
|
||||
],
|
||||
tools: [],
|
||||
tool_choice: "auto",
|
||||
parallel_tool_calls: false,
|
||||
store: false,
|
||||
stream: false,
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user