mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 17:14:17 +08:00
feat: #2330 disable /list/models
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
DEFAULT_API_HOST,
|
||||
DEFAULT_MODELS,
|
||||
OpenaiPath,
|
||||
REQUEST_TIMEOUT_MS,
|
||||
} from "@/app/constant";
|
||||
@@ -23,6 +24,8 @@ export interface OpenAIListModelResponse {
|
||||
}
|
||||
|
||||
export class ChatGPTApi implements LLMApi {
|
||||
private disableListModels = true;
|
||||
|
||||
path(path: string): string {
|
||||
let openaiUrl = useAccessStore.getState().openaiUrl;
|
||||
if (openaiUrl.length === 0) {
|
||||
@@ -246,6 +249,10 @@ export class ChatGPTApi implements LLMApi {
|
||||
}
|
||||
|
||||
async models(): Promise<LLMModel[]> {
|
||||
if (this.disableListModels) {
|
||||
return DEFAULT_MODELS.slice();
|
||||
}
|
||||
|
||||
const res = await fetch(this.path(OpenaiPath.ListModelPath), {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
Reference in New Issue
Block a user