Fix: hide model settings button and related functionality (#16563)

This commit is contained in:
chanx
2026-07-02 17:49:52 +08:00
committed by GitHub
parent 2ef78189ce
commit 16b8c79a2b

View File

@@ -14,7 +14,6 @@ import {
useEditInstanceModel,
useFetchAddedProviders,
useFetchInstanceModels,
useFetchProviderInstance,
useFetchProviderInstances,
useUpdateModelStatus,
} from '@/hooks/use-llm-request';
@@ -25,13 +24,7 @@ import {
} from '@/interfaces/database/llm';
import { IProviderModelItem } from '@/interfaces/request/llm';
import { cn } from '@/lib/utils';
import {
ChevronsDown,
ChevronsUp,
Pencil,
Settings,
Trash2,
} from 'lucide-react';
import { ChevronsDown, ChevronsUp, Pencil, Trash2 } from 'lucide-react';
import { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { AddCustomModelDialog } from '../modal/provider-modal/components/add-custom-model-dialog';
@@ -204,8 +197,8 @@ function InstanceRow({
function InstanceModelList({
providerName,
instanceName,
instance,
onEditInstance,
// instance,
// onEditInstance,
}: {
providerName: string;
instanceName: string;
@@ -220,25 +213,25 @@ function InstanceModelList({
// Lazily fetches the full instance details (incl. baseUrl) only when
// the user opens the settings dialog — keeps the collapsed section
// cheap and avoids the extra request for users who never click it.
const { refetch: fetchInstanceDetails } = useFetchProviderInstance(
providerName,
instanceName,
);
// const { refetch: fetchInstanceDetails } = useFetchProviderInstance(
// providerName,
// instanceName,
// );
const handleSettingsClick = useCallback(async () => {
let details: IProviderInstance = instance;
try {
const ret = await fetchInstanceDetails();
if (ret.data) {
details = { ...instance, ...(ret.data as IProviderInstance) };
}
} catch {
// Fall back to the list-level instance data if the show request
// fails (e.g. network error) — the modal still gets a usable
// baseline.
}
onEditInstance?.(providerName, details, models);
}, [fetchInstanceDetails, instance, models, onEditInstance, providerName]);
// const handleSettingsClick = useCallback(async () => {
// let details: IProviderInstance = instance;
// try {
// const ret = await fetchInstanceDetails();
// if (ret.data) {
// details = { ...instance, ...(ret.data as IProviderInstance) };
// }
// } catch {
// // Fall back to the list-level instance data if the show request
// // fails (e.g. network error) — the modal still gets a usable
// // baseline.
// }
// onEditInstance?.(providerName, details, models);
// }, [fetchInstanceDetails, instance, models, onEditInstance, providerName]);
const modelTypes = useMemo(() => {
const types = new Set<string>();
@@ -265,9 +258,9 @@ function InstanceModelList({
</span>
))}
</div>
<Button size="icon" variant="ghost" onClick={handleSettingsClick}>
{/* <Button size="icon" variant="ghost" onClick={handleSettingsClick}>
<Settings size={12} />
</Button>
</Button> */}
</div>
)}