fix model endpoint routing: use model's registered endpoint over custom when available, add page title to translate modal tab
This commit is contained in:
parent
2363944fa6
commit
ca9c994bfe
2 changed files with 25 additions and 5 deletions
|
|
@ -79,11 +79,29 @@ export async function getAPIConfig() {
|
|||
const customBaseURL = localStorage.getItem("customBaseURL");
|
||||
const customAPIKey = localStorage.getItem("customAPIKey");
|
||||
|
||||
// Import model functions to get the currently selected model
|
||||
const { getSelectedModel } = await import("./models.js");
|
||||
const selectedModel = getSelectedModel();
|
||||
|
||||
// Check if the selected model has a registered endpoint - use that instead of custom
|
||||
const { getSelectedModelEndpoint } = await import("./models.js");
|
||||
const modelEndpoint = getSelectedModelEndpoint();
|
||||
|
||||
// If model has its own endpoint, use that regardless of custom setting
|
||||
if (modelEndpoint && modelEndpoint !== customBaseURL) {
|
||||
console.log("🚀 Model has registered endpoint - using:", modelEndpoint);
|
||||
return {
|
||||
isCustom: false,
|
||||
endpoint: modelEndpoint,
|
||||
model: selectedModel,
|
||||
apiKey: API_KEY,
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (customBaseURL && customAPIKey) {
|
||||
// Import model functions to get the currently selected model
|
||||
const { getSelectedModel } = await import("./models.js");
|
||||
const selectedModel = getSelectedModel();
|
||||
|
||||
console.log("🔧 Using CUSTOM API:", {
|
||||
endpoint: customBaseURL,
|
||||
model: selectedModel,
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ export function openTranslateModal() {
|
|||
pageTabLink.setAttribute("aria-selected", "true");
|
||||
pageTabLink.setAttribute("aria-controls", "page-panel");
|
||||
pageTabLink.href = "#page-panel";
|
||||
pageTabLink.textContent = getUIText("translatePageTab");
|
||||
// Include original page title in tab text
|
||||
const originalTitle = document.title || 'Page';
|
||||
pageTabLink.textContent = `${getUIText("translatePageTab")}: ${originalTitle}`;
|
||||
pageTabLink.setAttribute("data-i18n", "translatePageTab");
|
||||
pageTabItem.appendChild(pageTabLink);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue