Skip to content

fix(articles): AI drafts failed — pin a live OpenRouter model + readable errors - #426

Merged
catomean merged 1 commit into
mainfrom
fix/articles-ai-model
Jul 22, 2026
Merged

fix(articles): AI drafts failed — pin a live OpenRouter model + readable errors#426
catomean merged 1 commit into
mainfrom
fix/articles-ai-model

Conversation

@catomean

Copy link
Copy Markdown
Collaborator

Live-verification hotfix for the AI writer (PR #425).

Bug 1 — article drafts 404'd. The long-form path used openai/gpt-oss-120b:free; OpenRouter returns 404 for it (free model IDs rot — prod logs confirmed platform-llm: model call failed status 404). Pinned the model the offer-engine already proves works on the box: meta-llama/llama-4-maverick:free, for both short and long-form. Also: retry a JSON-mode call once without response_format (for models that reject it), and trimmed long-form max_tokens to a safer 3000.

Bug 2 — errors showed "[object Object]". The client threw new Error(json.error), but the standard API shape is error: { code, message }. Now extracts .message.

Topic suggestions already worked live (grounded in the user's real profile/entities/memories); this fixes the full-article draft path + error display.

Verified: type-check + lint clean, prod build green. Re-verifying the live draft after deploy.

🤖 Generated with Claude Code

…le errors

Live verification caught two bugs in the AI writer:

1. Article drafts 404'd: the long-form path used `openai/gpt-oss-120b:free`,
   which OpenRouter returns 404 for (free model IDs rot). Pin the model the
   offer-engine already proves works on the box — `meta-llama/llama-4-maverick:free`
   — for both short and long-form. Also retry a JSON-mode call once without
   `response_format` for models that reject it, and trim long-form max_tokens
   to a safer 3000.

2. Errors rendered as "[object Object]": the client threw `new Error(json.error)`
   but the standard API shape is `error: { code, message }`. Extract `.message`.

Verified: type-check + lint clean, prod build green. Re-verifying draft live.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@catomean
catomean merged commit 6c878b8 into main Jul 22, 2026
1 of 3 checks passed
@catomean
catomean deleted the fix/articles-ai-model branch July 22, 2026 16:30
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.

1 participant