mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
fix: show API Key Compatible providers in Antigravity CLI Tools model selector (#241)
This commit is contained in:
@@ -25,6 +25,7 @@ export default function AntigravityToolCard({
|
|||||||
const [modelMappings, setModelMappings] = useState({});
|
const [modelMappings, setModelMappings] = useState({});
|
||||||
const [modalOpen, setModalOpen] = useState(false);
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
const [currentEditingAlias, setCurrentEditingAlias] = useState(null);
|
const [currentEditingAlias, setCurrentEditingAlias] = useState(null);
|
||||||
|
const [modelAliases, setModelAliases] = useState({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (apiKeys?.length > 0 && !selectedApiKey) {
|
if (apiKeys?.length > 0 && !selectedApiKey) {
|
||||||
@@ -40,8 +41,12 @@ export default function AntigravityToolCard({
|
|||||||
if (isExpanded && !status) {
|
if (isExpanded && !status) {
|
||||||
fetchStatus();
|
fetchStatus();
|
||||||
loadSavedMappings();
|
loadSavedMappings();
|
||||||
|
fetchModelAliases();
|
||||||
|
}
|
||||||
|
if (isExpanded) {
|
||||||
|
loadSavedMappings();
|
||||||
|
fetchModelAliases();
|
||||||
}
|
}
|
||||||
if (isExpanded) loadSavedMappings();
|
|
||||||
}, [isExpanded]);
|
}, [isExpanded]);
|
||||||
|
|
||||||
const loadSavedMappings = async () => {
|
const loadSavedMappings = async () => {
|
||||||
@@ -60,6 +65,16 @@ export default function AntigravityToolCard({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fetchModelAliases = async () => {
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/models/alias");
|
||||||
|
const data = await res.json();
|
||||||
|
if (res.ok) setModelAliases(data.aliases || {});
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error fetching model aliases:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const fetchStatus = async () => {
|
const fetchStatus = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch("/api/cli-tools/antigravity-mitm");
|
const res = await fetch("/api/cli-tools/antigravity-mitm");
|
||||||
@@ -249,9 +264,9 @@ export default function AntigravityToolCard({
|
|||||||
{/* Status indicators — ordered: Cert → Server → DNS */}
|
{/* Status indicators — ordered: Cert → Server → DNS */}
|
||||||
<div className="flex items-center gap-1">
|
<div className="flex items-center gap-1">
|
||||||
{[
|
{[
|
||||||
{ key: "cert", label: "Cert", ok: status?.certExists },
|
{ key: "cert", label: "Cert", ok: status?.certExists },
|
||||||
{ key: "server", label: "Server", ok: status?.running },
|
{ key: "server", label: "Server", ok: status?.running },
|
||||||
{ key: "dns", label: "DNS", ok: status?.dnsConfigured },
|
{ key: "dns", label: "DNS", ok: status?.dnsConfigured },
|
||||||
].map(({ key, label, ok }, i) => {
|
].map(({ key, label, ok }, i) => {
|
||||||
const isLoading = startingStep === key;
|
const isLoading = startingStep === key;
|
||||||
return (
|
return (
|
||||||
@@ -455,6 +470,7 @@ export default function AntigravityToolCard({
|
|||||||
onSelect={handleModelSelect}
|
onSelect={handleModelSelect}
|
||||||
selectedModel={currentEditingAlias ? modelMappings[currentEditingAlias] : null}
|
selectedModel={currentEditingAlias ? modelMappings[currentEditingAlias] : null}
|
||||||
activeProviders={activeProviders}
|
activeProviders={activeProviders}
|
||||||
|
modelAliases={modelAliases}
|
||||||
title={`Select model for ${currentEditingAlias}`}
|
title={`Select model for ${currentEditingAlias}`}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user