diff --git a/src/app/(dashboard)/dashboard/cli-tools/components/DefaultToolCard.js b/src/app/(dashboard)/dashboard/cli-tools/components/DefaultToolCard.js
index 8f945e45..172c2510 100644
--- a/src/app/(dashboard)/dashboard/cli-tools/components/DefaultToolCard.js
+++ b/src/app/(dashboard)/dashboard/cli-tools/components/DefaultToolCard.js
@@ -224,13 +224,14 @@ export default function DefaultToolCard({ toolId, tool, isExpanded, onToggle, ba
const renderIcon = () => {
if (tool.image) {
return (
-
{ e.target.style.display = "none"; }}
+ { e.target.style.display = "none"; }}
/>
);
}
@@ -238,13 +239,14 @@ export default function DefaultToolCard({ toolId, tool, isExpanded, onToggle, ba
return {tool.icon};
}
return (
- { e.target.style.display = "none"; }}
+ { e.target.style.display = "none"; }}
/>
);
};
diff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.js b/src/app/(dashboard)/dashboard/providers/[id]/page.js
index d43667f7..b4bee0c5 100644
--- a/src/app/(dashboard)/dashboard/providers/[id]/page.js
+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.js
@@ -1,13 +1,13 @@
"use client";
-import { useState, useEffect, useMemo, useCallback } from "react";
+import { useState, useEffect, useCallback } from "react";
+import PropTypes from "prop-types";
import { useParams } from "next/navigation";
import Link from "next/link";
import Image from "next/image";
import { Card, Button, Badge, Input, Modal, CardSkeleton, OAuthModal, Toggle } from "@/shared/components";
import { OAUTH_PROVIDERS, APIKEY_PROVIDERS, getProviderAlias } from "@/shared/constants/providers";
import { getModelsByProviderId } from "@/shared/constants/models";
-import { PROVIDER_ENDPOINTS } from "@/shared/constants/config";
import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard";
export default function ProviderDetailPage() {
@@ -193,6 +193,47 @@ export default function ProviderDetailPage() {
}
};
+ const renderModelsSection = () => {
+ if (providerInfo.passthroughModels) {
+ return (
+
+ );
+ }
+ if (models.length === 0) {
+ return No models configured
;
+ }
+ return (
+
+ {models.map((model) => {
+ const fullModel = `${providerAlias}/${model.id}`;
+ const oldFormatModel = `${providerId}/${model.id}`;
+ const existingAlias = Object.entries(modelAliases).find(
+ ([, m]) => m === fullModel || m === oldFormatModel
+ )?.[0];
+ return (
+ handleSetAlias(model.id, alias)}
+ onDeleteAlias={() => handleDeleteAlias(existingAlias)}
+ />
+ );
+ })}
+
+ );
+ };
+
if (!providerInfo) {
return (
@@ -235,13 +276,14 @@ export default function ProviderDetailPage() {
width={48}
height={48}
className="object-contain rounded-lg"
+ style={{ width: "auto", height: "auto" }}
onError={(e) => { e.currentTarget.style.display = "none"; }}
/>
{providerInfo.name}
- {connections.length} connection{connections.length !== 1 ? "s" : ""}
+ {connections.length} connection{connections.length === 1 ? "" : "s"}
@@ -297,41 +339,7 @@ export default function ProviderDetailPage() {
{providerInfo.passthroughModels ? "Model Aliases" : "Available Models"}
- {providerInfo.passthroughModels ? (
-
- ) : models.length === 0 ? (
-
No models configured
- ) : (
-
- {models.map((model) => {
- const fullModel = `${providerAlias}/${model.id}`;
- // Also check for old format (providerId/model) for backward compatibility
- const oldFormatModel = `${providerId}/${model.id}`;
- const existingAlias = Object.entries(modelAliases).find(
- ([, m]) => m === fullModel || m === oldFormatModel
- )?.[0];
- return (
- handleSetAlias(model.id, alias)}
- onDeleteAlias={() => handleDeleteAlias(existingAlias)}
- />
- );
- })}
-
- )}
+ {renderModelsSection()}
@@ -377,6 +385,16 @@ function ModelRow({ model, fullModel, alias, copied, onCopy }) {
);
}
+ModelRow.propTypes = {
+ model: PropTypes.shape({
+ id: PropTypes.string.isRequired,
+ }).isRequired,
+ fullModel: PropTypes.string.isRequired,
+ alias: PropTypes.string,
+ copied: PropTypes.string,
+ onCopy: PropTypes.func.isRequired,
+};
+
function PassthroughModelsSection({ providerAlias, modelAliases, copied, onCopy, onSetAlias, onDeleteAlias }) {
const [newModel, setNewModel] = useState("");
const [adding, setAdding] = useState(false);
@@ -429,8 +447,9 @@ function PassthroughModelsSection({ providerAlias, modelAliases, copied, onCopy,
{/* Add new model */}
-
+
setNewModel(e.target.value)}
@@ -463,14 +482,23 @@ function PassthroughModelsSection({ providerAlias, modelAliases, copied, onCopy,
);
}
+PassthroughModelsSection.propTypes = {
+ providerAlias: PropTypes.string.isRequired,
+ modelAliases: PropTypes.object.isRequired,
+ copied: PropTypes.string,
+ onCopy: PropTypes.func.isRequired,
+ onSetAlias: PropTypes.func.isRequired,
+ onDeleteAlias: PropTypes.func.isRequired,
+};
+
function PassthroughModelRow({ modelId, fullModel, copied, onCopy, onDeleteAlias }) {
return (
smart_toy
-
+
{modelId}
-
+
{fullModel}