Feat: tenant llm provider (#14595)

### What problem does this PR solve?

Python implementation of the Go-based model_provider API suite.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: bill <yibie_jingnian@163.com>
This commit is contained in:
Lynn
2026-05-29 17:39:41 +08:00
committed by GitHub
parent b79f79d9b9
commit dc4b82523b
148 changed files with 6059 additions and 3075 deletions

View File

@@ -40,3 +40,41 @@ export interface Llm {
status: '0' | '1';
used_token: number;
}
export interface IAvailableProvider {
name: string;
model_types: string[];
url: { default?: string; [key: string]: string | undefined };
}
export interface IProviderInstance {
api_key: string;
id: string;
instance_name: string;
provider_id: string;
region: string;
status: string;
}
export interface IAddedModel {
model_type: string[];
name: string;
provider_id: string;
provider_name: string;
instance_id: string;
instance_name: string;
}
export interface IInstanceModel {
max_tokens: number;
model_type: string[];
name: string;
status: string;
}
export interface IDefaultModel {
enable: boolean;
model_instance: string;
model_name: string;
model_provider: string;
model_type: string;
}

View File

@@ -1,7 +1,7 @@
export interface IAddLlmRequestBody {
llm_factory: string; // Ollama
llm_name: string;
model_type: string;
model_type: string | string[];
api_base?: string; // chat|embedding|speech2text|image2text
api_key?: string | Record<string, any>;
max_tokens: number;
@@ -12,3 +12,50 @@ export interface IDeleteLlmRequestBody {
llm_factory: string; // Ollama
llm_name?: string;
}
export interface IListProvidersRequestParams {
available?: boolean;
}
export interface IAddProviderRequestBody {
provider_name: string;
}
export type IAddProviderInstanceRequestBody = IAddLlmRequestBody & {
instance_name: string;
};
export interface IDeleteProviderInstanceRequestBody {
provider_name: string;
instances: string[];
}
export interface IShowProviderInstanceRequestParams {
provider_name: string;
instance_name: string;
}
export interface IAddInstanceModelRequestBody {
model_name: string;
model_type: string[];
max_tokens: number;
extra?: Record<string, any>;
}
export interface IListAllModelsRequestParams {
type?: string;
}
export interface IUpdateModelStatusRequestBody {
provider_name: string;
instance_name: string;
model_name: string;
status: 'active' | 'inactive';
}
export interface ISetDefaultModelRequestBody {
model_provider: string;
model_instance: string;
model_type: string;
model_name: string;
}