mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-20 14:41:05 +08:00
Feat: v0.27.0 model provider (#16604)
This commit is contained in:
@@ -45,10 +45,16 @@ export interface IAvailableProvider {
|
||||
name: string;
|
||||
model_types: string[];
|
||||
url: { default?: string; [key: string]: string | undefined };
|
||||
has_instance: boolean;
|
||||
}
|
||||
|
||||
export interface IProviderInstance {
|
||||
api_key: string;
|
||||
/**
|
||||
* Usually a plain key string, but the showProviderInstance endpoint
|
||||
* may return an object `{ api_key, ...nested }` for providers that
|
||||
* bundle extra credentials (see the nested fields below).
|
||||
*/
|
||||
api_key: string | Record<string, any>;
|
||||
id: string;
|
||||
instance_name: string;
|
||||
provider_id: string;
|
||||
@@ -56,10 +62,20 @@ export interface IProviderInstance {
|
||||
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).
|
||||
* to pre-fill the base_url/api_base form field when opening a saved
|
||||
* instance.
|
||||
*/
|
||||
base_url?: string;
|
||||
/**
|
||||
* Provider-specific credentials that may be returned either at the top
|
||||
* level or nested inside `api_key`:
|
||||
* - group_id → MiniMax
|
||||
* - api_version → Azure OpenAI
|
||||
* - provider_order → OpenRouter
|
||||
*/
|
||||
group_id?: string;
|
||||
api_version?: string;
|
||||
provider_order?: string;
|
||||
}
|
||||
export interface IAddedModel {
|
||||
model_type: string[];
|
||||
@@ -75,6 +91,20 @@ export interface IInstanceModel {
|
||||
model_type: string[];
|
||||
name: string;
|
||||
status: string;
|
||||
/**
|
||||
* Persisted verification result from the backend:
|
||||
* - `true` → verified successfully
|
||||
* - `false` → verified but failed
|
||||
* - `undefined` → never verified yet
|
||||
*/
|
||||
verify?: 'unknown' | 'success' | 'fail';
|
||||
/**
|
||||
* Persisted Tool-call flag from `tenant_model.extra.is_tools`.
|
||||
* The backend's `_hybrid_get_instance_models` includes this so the
|
||||
* frontend can forward the correct value in auto-save payloads
|
||||
* without relying solely on the (possibly unfetched) catalog.
|
||||
*/
|
||||
is_tools?: boolean;
|
||||
}
|
||||
|
||||
export interface IDefaultModel {
|
||||
|
||||
@@ -38,6 +38,13 @@ export interface IAddProviderRequestBody {
|
||||
export type IAddProviderInstanceRequestBody = IAddLlmRequestBody & {
|
||||
instance_name: string;
|
||||
region?: string;
|
||||
/**
|
||||
* Optional id of an existing instance. When present the backend
|
||||
* treats the call as an update of that row (rather than a create),
|
||||
* which is what the inline "blur-save" flow on saved instance cards
|
||||
* needs.
|
||||
*/
|
||||
id?: string;
|
||||
};
|
||||
|
||||
export interface IDeleteProviderInstanceRequestBody {
|
||||
@@ -73,6 +80,42 @@ export interface IUpdateModelStatusRequestBody {
|
||||
status: 'active' | 'inactive';
|
||||
}
|
||||
|
||||
/**
|
||||
* Body shape for PATCH `/providers/{name}/instances/{name}/models/{model_name}`.
|
||||
* All fields are optional; only the supplied keys are updated server-side.
|
||||
*/
|
||||
export interface IPatchInstanceModelRequestBody {
|
||||
provider_name: string;
|
||||
instance_name: string;
|
||||
model_name: string;
|
||||
status?: 'active' | 'inactive';
|
||||
max_tokens?: number;
|
||||
model_type?: string[];
|
||||
extra?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface IDeleteInstanceModelsRequestBody {
|
||||
provider_name: string;
|
||||
instance_name: string;
|
||||
model_name: string[];
|
||||
}
|
||||
|
||||
export interface IUpdateProviderInstanceRequestBody {
|
||||
provider_name: string;
|
||||
instance_name: string;
|
||||
id?: string;
|
||||
/**
|
||||
* Either a plain API-key string, or — for providers that need an
|
||||
* extra credential such as MiniMax's `group_id` — an object bundling
|
||||
* the key with those fields: `{ api_key, group_id }`.
|
||||
*/
|
||||
api_key?: string | Record<string, any>;
|
||||
base_url?: string;
|
||||
region?: string;
|
||||
model_info?: IModelInfo[];
|
||||
verify?: boolean;
|
||||
}
|
||||
|
||||
export interface ISetDefaultModelRequestBody {
|
||||
model_provider: string;
|
||||
model_instance: string;
|
||||
@@ -98,7 +141,7 @@ export interface IProviderModelItem {
|
||||
*/
|
||||
export interface IListProviderModelsRequestBody {
|
||||
provider_name: string;
|
||||
api_key: string;
|
||||
api_key?: string;
|
||||
base_url?: string;
|
||||
region?: string;
|
||||
model_info?: IModelInfo[];
|
||||
|
||||
Reference in New Issue
Block a user