fix: Add pony-alpha model and fix model lookup for prefixed model IDs

- Add openrouter/pony-alpha model to models-api.json fixture
- Fix getModel() to lookup models with provider prefix (e.g., openrouter/pony-alpha)
  When user specifies openrouter/pony-alpha, the code now correctly looks for
  the full model ID including prefix in the provider's models object

This fixes the 'ModelNotFoundError' when using OpenRouter models that have
prefixed IDs in the database.
This commit is contained in:
southseact-3d
2026-02-08 16:21:21 +00:00
parent 1fbf5abce6
commit 26c6f5f6c7
4 changed files with 218 additions and 20 deletions

View File

@@ -300,6 +300,26 @@
box-shadow: 0 10px 25px rgba(0, 128, 96, 0.25);
}
/* Cancel mode for send button */
.primary.cancel-mode {
background: linear-gradient(135deg, #ef4444, #dc2626);
color: #fff;
}
.primary.cancel-mode:hover {
box-shadow: 0 10px 25px rgba(239, 68, 68, 0.25);
}
/* Cancelled message styling */
.message.assistant.cancelled {
opacity: 0.7;
}
.message.assistant.cancelled .body {
background: #fef2f2;
border: 1px solid #fecaca;
}
.back-home {
color: var(--muted);
text-decoration: none;
@@ -1932,11 +1952,16 @@
}
const miniBtn = el.miniSendBtn;
const originalLabel = miniBtn ? miniBtn.textContent : '';
if (miniBtn) {
miniBtn.disabled = true;
miniBtn.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>'; // Clock icon for planning
// Set sending state for cancellation support
if (typeof state !== 'undefined') {
state.isSending = true;
state.currentSendingMessageId = tempMessageId;
}
if (typeof updateSendButtonState === 'function') {
updateSendButtonState();
}
try {
const response = await api('/api/plan', { method: 'POST', body: JSON.stringify(payload) });
@@ -1986,14 +2011,13 @@
renderMessages(session);
}
} finally {
if (miniBtn) {
miniBtn.disabled = false;
// Restore original SVG icon
miniBtn.innerHTML = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<line x1="22" y1="2" x2="11" y2="13"></line>
<polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
</svg>`;
// Reset sending state
if (typeof state !== 'undefined') {
state.isSending = false;
state.currentSendingMessageId = null;
}
if (typeof updateSendButtonState === 'function') {
updateSendButtonState();
}
}
}
@@ -2278,7 +2302,15 @@
};
// document.getElementById('send-btn') removed
document.getElementById('mini-send-btn').addEventListener('click', handleSend, true);
// Use handleSendButtonClick which handles both send and cancel modes
document.getElementById('mini-send-btn').addEventListener('click', (e) => {
if (typeof handleSendButtonClick === 'function') {
handleSendButtonClick(e);
} else {
// Fallback to old behavior if function not loaded yet
handleSend(e);
}
}, true);
// Initialize UI
updateBuildModeUI();