2024-06-06 11:01:14 +08:00
|
|
|
import { FormInstance } from 'antd';
|
2024-06-25 19:28:24 +08:00
|
|
|
import { Node } from 'reactflow';
|
2024-06-05 10:46:06 +08:00
|
|
|
|
2024-05-27 08:21:30 +08:00
|
|
|
export interface DSLComponentList {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}
|
2024-06-05 10:46:06 +08:00
|
|
|
|
|
|
|
|
export interface IOperatorForm {
|
|
|
|
|
onValuesChange?(changedValues: any, values: any): void;
|
2024-06-06 11:01:14 +08:00
|
|
|
form?: FormInstance;
|
2024-06-25 19:28:24 +08:00
|
|
|
node?: Node<NodeData>;
|
2024-06-28 08:59:51 +08:00
|
|
|
nodeId?: string;
|
2024-06-05 10:46:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IBeginForm {
|
|
|
|
|
prologue?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IRetrievalForm {
|
|
|
|
|
similarity_threshold?: number;
|
|
|
|
|
keywords_similarity_weight?: number;
|
|
|
|
|
top_n?: number;
|
|
|
|
|
top_k?: number;
|
|
|
|
|
rerank_id?: string;
|
|
|
|
|
empty_response?: string;
|
|
|
|
|
kb_ids: string[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface IGenerateForm {
|
|
|
|
|
max_tokens?: number;
|
|
|
|
|
temperature?: number;
|
|
|
|
|
top_p?: number;
|
|
|
|
|
presence_penalty?: number;
|
|
|
|
|
frequency_penalty?: number;
|
|
|
|
|
cite?: boolean;
|
|
|
|
|
prompt: number;
|
|
|
|
|
llm_id: string;
|
|
|
|
|
parameters: { key: string; component_id: string };
|
|
|
|
|
}
|
2024-06-25 19:28:24 +08:00
|
|
|
export interface ICategorizeItem {
|
|
|
|
|
name: string;
|
|
|
|
|
description?: string;
|
|
|
|
|
examples?: string;
|
|
|
|
|
to?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-03 12:00:56 +08:00
|
|
|
export interface IGenerateParameter {
|
|
|
|
|
id?: string;
|
|
|
|
|
key: string;
|
|
|
|
|
component_id?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-28 18:56:38 +08:00
|
|
|
export interface IInvokeVariable extends IGenerateParameter {
|
|
|
|
|
value?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-25 19:28:24 +08:00
|
|
|
export type ICategorizeItemResult = Record<
|
|
|
|
|
string,
|
|
|
|
|
Omit<ICategorizeItem, 'name'>
|
|
|
|
|
>;
|
|
|
|
|
export interface ICategorizeForm extends IGenerateForm {
|
|
|
|
|
category_description: ICategorizeItemResult;
|
|
|
|
|
}
|
2024-06-05 10:46:06 +08:00
|
|
|
|
2024-07-03 10:15:19 +08:00
|
|
|
export interface IRelevantForm extends IGenerateForm {
|
|
|
|
|
yes: string;
|
|
|
|
|
no: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-28 14:31:19 +08:00
|
|
|
export interface ISwitchCondition {
|
|
|
|
|
items: ISwitchItem[];
|
2024-08-20 16:08:53 +08:00
|
|
|
logical_operator: string;
|
|
|
|
|
to: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-28 14:31:19 +08:00
|
|
|
export interface ISwitchItem {
|
2024-08-20 16:08:53 +08:00
|
|
|
cpn_id: string;
|
|
|
|
|
operator: string;
|
|
|
|
|
value: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ISwitchForm {
|
2024-10-28 14:31:19 +08:00
|
|
|
conditions: ISwitchCondition[];
|
2024-08-20 16:08:53 +08:00
|
|
|
end_cpn_id: string;
|
|
|
|
|
no: string;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-05 10:46:06 +08:00
|
|
|
export type NodeData = {
|
2024-07-01 17:12:04 +08:00
|
|
|
label: string; // operator type
|
|
|
|
|
name: string; // operator name
|
2024-06-05 10:46:06 +08:00
|
|
|
color: string;
|
2024-08-20 16:08:53 +08:00
|
|
|
form:
|
|
|
|
|
| IBeginForm
|
|
|
|
|
| IRetrievalForm
|
|
|
|
|
| IGenerateForm
|
|
|
|
|
| ICategorizeForm
|
|
|
|
|
| ISwitchForm;
|
2024-06-05 10:46:06 +08:00
|
|
|
};
|
2024-07-11 18:01:50 +08:00
|
|
|
|
|
|
|
|
export type IPosition = { top: number; right: number; idx: number };
|