Restore prompt to editor on API key validation failure

fixes #77
This commit is contained in:
Mario Zechner 2025-11-28 23:00:37 +01:00
parent 4830a9cf40
commit 754e745b1f
3 changed files with 23 additions and 1 deletions

View file

@ -141,6 +141,23 @@ export const MODELS = {
contextWindow: 200000,
maxTokens: 4096,
} satisfies Model<"anthropic-messages">,
"claude-opus-4-5-20251101": {
id: "claude-opus-4-5-20251101",
name: "Claude Opus 4.5",
api: "anthropic-messages",
provider: "anthropic",
baseUrl: "https://api.anthropic.com",
reasoning: true,
input: ["text", "image"],
cost: {
input: 5,
output: 25,
cacheRead: 0.5,
cacheWrite: 6.25,
},
contextWindow: 200000,
maxTokens: 64000,
} satisfies Model<"anthropic-messages">,
"claude-sonnet-4-5": {
id: "claude-sonnet-4-5",
name: "Claude Sonnet 4.5 (latest)",
@ -2023,7 +2040,7 @@ export const MODELS = {
cacheWrite: 6.25,
},
contextWindow: 200000,
maxTokens: 32000,
maxTokens: 64000,
} satisfies Model<"openai-completions">,
"allenai/olmo-3-7b-instruct": {
id: "allenai/olmo-3-7b-instruct",

View file

@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- **Prompt Restoration on API Key Error**: When submitting a message fails due to missing API key, the prompt is now restored to the editor instead of being lost. ([#77](https://github.com/badlogic/pi-mono/issues/77))
## [0.10.2] - 2025-11-27
### Changed

View file

@ -418,6 +418,7 @@ export class TuiRenderer {
`No API key found for ${currentModel.provider}.\n\n` +
`Set the appropriate environment variable or update ~/.pi/agent/models.json`,
);
this.editor.setText(text);
return;
}