You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

interface.ts 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import { FormInstance } from 'antd';
  2. import { Node } from 'reactflow';
  3. export interface DSLComponentList {
  4. id: string;
  5. name: string;
  6. }
  7. export interface IOperatorForm {
  8. onValuesChange?(changedValues: any, values: any): void;
  9. form?: FormInstance;
  10. node?: Node<NodeData>;
  11. nodeId?: string;
  12. }
  13. export interface IBeginForm {
  14. prologue?: string;
  15. }
  16. export interface IRetrievalForm {
  17. similarity_threshold?: number;
  18. keywords_similarity_weight?: number;
  19. top_n?: number;
  20. top_k?: number;
  21. rerank_id?: string;
  22. empty_response?: string;
  23. kb_ids: string[];
  24. }
  25. export interface IGenerateForm {
  26. max_tokens?: number;
  27. temperature?: number;
  28. top_p?: number;
  29. presence_penalty?: number;
  30. frequency_penalty?: number;
  31. cite?: boolean;
  32. prompt: number;
  33. llm_id: string;
  34. parameters: { key: string; component_id: string };
  35. }
  36. export interface ICategorizeItem {
  37. name: string;
  38. description?: string;
  39. examples?: string;
  40. to?: string;
  41. }
  42. export interface IGenerateParameter {
  43. id?: string;
  44. key: string;
  45. component_id?: string;
  46. }
  47. export interface IInvokeVariable extends IGenerateParameter {
  48. value?: string;
  49. }
  50. export type ICategorizeItemResult = Record<
  51. string,
  52. Omit<ICategorizeItem, 'name'>
  53. >;
  54. export interface ICategorizeForm extends IGenerateForm {
  55. category_description: ICategorizeItemResult;
  56. }
  57. export interface IRelevantForm extends IGenerateForm {
  58. yes: string;
  59. no: string;
  60. }
  61. export interface ISwitchCondition {
  62. items: ISwitchItem[];
  63. logical_operator: string;
  64. to: string;
  65. }
  66. export interface ISwitchItem {
  67. cpn_id: string;
  68. operator: string;
  69. value: string;
  70. }
  71. export interface ISwitchForm {
  72. conditions: ISwitchCondition[];
  73. end_cpn_id: string;
  74. no: string;
  75. }
  76. export type NodeData = {
  77. label: string; // operator type
  78. name: string; // operator name
  79. color: string;
  80. form:
  81. | IBeginForm
  82. | IRetrievalForm
  83. | IGenerateForm
  84. | ICategorizeForm
  85. | ISwitchForm;
  86. };
  87. export type IPosition = { top: number; right: number; idx: number };