feat: Unify the 'Add Model Provider' modal (#15768)

### What problem does this PR solve?

feat:Unify the 'Add Model Provider' modal

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
- [x] Refactoring
This commit is contained in:
chanx
2026-06-08 16:46:52 +08:00
committed by GitHub
parent 4bbd59823a
commit 144abbe2eb
40 changed files with 3706 additions and 3840 deletions

View File

@@ -54,6 +54,12 @@ export interface IProviderInstance {
provider_id: string;
region: string;
status: string;
/**
* Optional: only returned by the showProviderInstance endpoint. Used
* to pre-fill the base_url/api_base form field in the ProviderModal
* (e.g. when opening an existing instance in viewMode).
*/
base_url?: string;
}
export interface IAddedModel {
model_type: string[];

View File

@@ -1,12 +1,25 @@
export interface IAddLlmRequestBody {
llm_factory: string; // Ollama
llm_name: string;
model_type: string | string[];
api_base?: string; // chat|embedding|speech2text|image2text
// model_name: string;
// model_type: string | string[];
base_url?: string; // chat|embedding|speech2text|image2text
api_key?: string | Record<string, any>;
max_tokens: number;
is_tools?: boolean;
region?: string;
model_info: IModelInfo[];
}
export interface IModelInfo {
model_name: string;
model_type: string | string[];
max_tokens: number;
/**
* Per-model extras (e.g. `is_tools` derived from the model descriptor's
* `features`). Optional for backward compatibility with legacy
* single-model payloads.
*/
extra?: Record<string, any>;
}
export interface IDeleteLlmRequestBody {
@@ -61,3 +74,27 @@ export interface ISetDefaultModelRequestBody {
model_type: string;
model_name: string;
}
/**
* Item shape returned by the list-provider-models endpoint.
* Fields match the backend's available-model descriptor.
*/
export interface IProviderModelItem {
name: string;
max_tokens: number;
model_types: string[];
features: string[] | null;
}
/**
* Request payload for the list-provider-models endpoint.
* Mirrors the verifyProviderConnection payload so the same form
* fields (api_key, base_url, region, model_info) can be reused.
*/
export interface IListProviderModelsRequestBody {
provider_name: string;
api_key: string;
base_url?: string;
region?: string;
model_info?: IModelInfo[];
}