mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-24 21:36:06 +00:00
perf: unify entities
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import { IDynamicFormItemSchema } from '@/app/infra/entities/form/dynamic';
|
||||
import { I18nLabel } from '@/app/infra/entities/common';
|
||||
import { PipelineConfigTab } from '@/app/infra/entities/pipeline';
|
||||
|
||||
export interface ApiResponse<T> {
|
||||
code: number;
|
||||
data: T;
|
||||
@@ -26,7 +30,9 @@ export interface Requester {
|
||||
label: I18nText;
|
||||
description: I18nText;
|
||||
icon?: string;
|
||||
spec: object;
|
||||
spec: {
|
||||
config: IDynamicFormItemSchema[];
|
||||
}
|
||||
}
|
||||
|
||||
export interface ApiRespProviderLLMModels {
|
||||
@@ -302,3 +308,7 @@ interface GetPipeline {
|
||||
export interface GetPipelineResponseData {
|
||||
pipeline: GetPipeline;
|
||||
}
|
||||
|
||||
export interface GetPipelineMetadataResponseData {
|
||||
configs: PipelineConfigTab[];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface I18nLabel {
|
||||
en_US: string;
|
||||
zh_CN: string;
|
||||
ja_JP?: string;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { I18nLabel } from '@/app/infra/entities/common';
|
||||
|
||||
export interface IDynamicFormItemSchema {
|
||||
id: string;
|
||||
default: string | number | boolean | Array<unknown>;
|
||||
label: I18nLabel;
|
||||
name: string;
|
||||
required: boolean;
|
||||
type: DynamicFormItemType;
|
||||
description?: I18nLabel;
|
||||
options?: IDynamicFormItemOption[];
|
||||
}
|
||||
|
||||
export enum DynamicFormItemType {
|
||||
INT = 'integer',
|
||||
FLOAT = 'float',
|
||||
BOOLEAN = 'boolean',
|
||||
STRING = 'string',
|
||||
STRING_ARRAY = 'array[string]',
|
||||
SELECT = 'select',
|
||||
LLM_MODEL_SELECTOR = 'llm-model-selector',
|
||||
PROMPT_EDITOR = 'prompt-editor',
|
||||
UNKNOWN = 'unknown',
|
||||
}
|
||||
|
||||
export interface IDynamicFormItemOption {
|
||||
name: string;
|
||||
label: I18nLabel;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { I18nLabel } from '@/app/infra/entities/common';
|
||||
import { IDynamicFormItemSchema } from '@/app/infra/entities/form/dynamic';
|
||||
|
||||
export interface PipelineFormEntity {
|
||||
basic: object;
|
||||
ai: object;
|
||||
trigger: object;
|
||||
safety: object;
|
||||
output: object;
|
||||
}
|
||||
|
||||
export interface PipelineConfigTab {
|
||||
name: string;
|
||||
label: I18nLabel;
|
||||
stages: PipelineConfigStage[];
|
||||
}
|
||||
|
||||
export interface PipelineConfigStage {
|
||||
name: string;
|
||||
label: I18nLabel;
|
||||
config: IDynamicFormItemSchema[];
|
||||
}
|
||||
@@ -28,7 +28,8 @@ import {
|
||||
ApiRespUserToken,
|
||||
MarketPluginResponse,
|
||||
GetPipelineResponseData,
|
||||
} from '../api/api-types';
|
||||
GetPipelineMetadataResponseData
|
||||
} from '@/app/infra/entities/api';
|
||||
import { notification } from 'antd';
|
||||
|
||||
type JSONValue = string | number | boolean | JSONObject | JSONArray | null;
|
||||
@@ -249,7 +250,7 @@ class HttpClient {
|
||||
}
|
||||
|
||||
// ============ Pipeline API ============
|
||||
public getGeneralPipelineMetadata(): Promise<object> {
|
||||
public getGeneralPipelineMetadata(): Promise<GetPipelineMetadataResponseData> {
|
||||
// as designed, this method will be deprecated, and only for developer to check the prefered config schema
|
||||
return this.get('/api/v1/pipelines/_/metadata');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user