@metad/contracts 3.6.2 → 3.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +5 -0
- package/.eslintrc.json +18 -0
- package/babel.config.json +1 -0
- package/index.cjs.js +5 -4233
- package/jest.config.ts +16 -0
- package/package.json +2 -2
- package/project.json +53 -0
- package/src/agent/{ai-model.d.ts → ai-model.ts} +2 -2
- package/src/agent/graph.ts +275 -0
- package/src/agent/index.ts +5 -0
- package/src/agent/token.ts +23 -0
- package/src/agent/utils.spec.ts +283 -0
- package/src/agent/utils.ts +122 -0
- package/src/agent/variables.ts +66 -0
- package/src/ai/ai-model.model.ts +232 -0
- package/src/ai/ai-provider.model.ts +53 -0
- package/src/ai/ai.model.ts +87 -0
- package/src/ai/chat-message-feedback.model.ts +31 -0
- package/src/ai/chat-message.model.ts +277 -0
- package/src/ai/chat.model.ts +207 -0
- package/src/ai/copilot-checkpoint.model.ts +25 -0
- package/src/ai/copilot-example.model.ts +23 -0
- package/src/ai/copilot-model.model.ts +31 -0
- package/src/ai/copilot-organization.model.ts +21 -0
- package/src/ai/copilot-provider.model.ts +46 -0
- package/src/ai/copilot-role.model.ts +48 -0
- package/src/ai/copilot-store.model.ts +34 -0
- package/src/ai/copilot-user.model.ts +24 -0
- package/src/ai/copilot.model.ts +47 -0
- package/src/ai/{environment.model.d.ts → environment.model.ts} +12 -10
- package/src/ai/feature.model.ts +6 -0
- package/src/ai/index.ts +40 -0
- package/src/ai/knowledge-doc-chunk.model.ts +123 -0
- package/src/ai/knowledge-doc-chunk.spec.ts +47 -0
- package/src/ai/knowledge-doc-page.model.ts +20 -0
- package/src/ai/knowledge-doc.model.ts +364 -0
- package/src/ai/knowledge-pipeline.ts +138 -0
- package/src/ai/knowledge-retrieval-log.model.ts +19 -0
- package/src/ai/knowledgebase-task.model.ts +46 -0
- package/src/ai/knowledgebase.model.ts +205 -0
- package/src/ai/rag-web.ts +54 -0
- package/src/ai/rag.ts +24 -0
- package/src/ai/role-permissions.ts +13 -0
- package/src/ai/types.ts +83 -0
- package/src/ai/xpert-agent-execution.model.ts +115 -0
- package/src/ai/xpert-agent.model.ts +264 -0
- package/src/ai/xpert-project.model.ts +103 -0
- package/src/ai/xpert-table.model.ts +100 -0
- package/src/ai/xpert-task.model.ts +32 -0
- package/src/ai/xpert-template.model.ts +53 -0
- package/src/ai/xpert-tool-mcp.model.ts +77 -0
- package/src/ai/xpert-tool.model.ts +216 -0
- package/src/ai/xpert-toolset.model.ts +220 -0
- package/src/ai/xpert-workflow-task.prompt.ts +71 -0
- package/src/ai/xpert-workflow.model.ts +502 -0
- package/src/ai/xpert-workspace.model.ts +42 -0
- package/src/ai/xpert.model.ts +637 -0
- package/src/ai/xpert.utils.ts +214 -0
- package/src/analytics/ai.ts +79 -0
- package/src/analytics/approval-policy.model.ts +40 -0
- package/src/analytics/business-area-user.model.ts +43 -0
- package/src/analytics/business-area.ts +20 -0
- package/src/analytics/certification.model.ts +12 -0
- package/src/analytics/chatbi-conversation.model.ts +16 -0
- package/src/analytics/chatbi-model.model.ts +22 -0
- package/src/analytics/collection.model.ts +8 -0
- package/src/analytics/comment.model.ts +14 -0
- package/src/analytics/data-source-type.ts +19 -0
- package/src/analytics/data-source.ts +72 -0
- package/src/analytics/favorite.ts +18 -0
- package/src/analytics/features.ts +19 -0
- package/src/analytics/feed-model.ts +15 -0
- package/src/analytics/gateway.ts +31 -0
- package/src/analytics/index.ts +39 -0
- package/src/analytics/indicator-app.ts +49 -0
- package/src/analytics/{indicator-market.d.ts → indicator-market.ts} +6 -2
- package/src/analytics/indicator.ts +143 -0
- package/src/analytics/model-query-log.model.ts +45 -0
- package/src/analytics/model-query.ts +22 -0
- package/src/analytics/{notification-destination.d.ts → notification-destination.ts} +9 -5
- package/src/analytics/{permission-approval-user.model.d.ts → permission-approval-user.model.ts} +10 -8
- package/src/analytics/permission-approval.model.ts +58 -0
- package/src/analytics/project.model.ts +56 -0
- package/src/analytics/role-permissions.ts +36 -0
- package/src/analytics/schema.ts +300 -0
- package/src/analytics/screenshot.model.ts +28 -0
- package/src/analytics/semantic-model-entity.ts +50 -0
- package/src/analytics/semantic-model-member.ts +49 -0
- package/src/analytics/semantic-model.ts +237 -0
- package/src/analytics/{story-point.d.ts → story-point.ts} +11 -6
- package/src/analytics/story-template.model.ts +34 -0
- package/src/analytics/story-widget.ts +15 -0
- package/src/analytics/story.ts +109 -0
- package/src/analytics/subscription.ts +43 -0
- package/src/analytics/visit.model.ts +39 -0
- package/src/analytics/webSocket.ts +53 -0
- package/src/api-key.model.ts +11 -0
- package/src/base-entity.model.ts +34 -0
- package/src/contact.model.ts +45 -0
- package/src/core.model.ts +103 -0
- package/src/{country.model.d.ts → country.model.ts} +3 -2
- package/src/currency.model.ts +582 -0
- package/src/{custom-smtp.model.d.ts → custom-smtp.model.ts} +21 -17
- package/src/date-picker.model.ts +5 -0
- package/src/email-template.model.ts +50 -0
- package/src/email.model.ts +46 -0
- package/src/employee.model.ts +199 -0
- package/src/entity-with-members.model.ts +16 -0
- package/src/feature.model.ts +108 -0
- package/src/file-provider.ts +37 -0
- package/src/help-center-article.model.ts +35 -0
- package/src/help-center.model.ts +33 -0
- package/src/http-status.enum.ts +58 -0
- package/src/import-export.model.ts +42 -0
- package/src/index.ts +60 -0
- package/src/integration/dify.ts +31 -0
- package/src/integration/dingtalk.ts +16 -0
- package/src/integration/fastgpt.ts +32 -0
- package/src/integration/firecrawl.ts +46 -0
- package/src/integration/github.ts +149 -0
- package/src/integration/index.ts +15 -0
- package/src/integration/lark.ts +79 -0
- package/src/integration/wecom.ts +16 -0
- package/src/integration.model.ts +119 -0
- package/src/invite.model.ts +144 -0
- package/src/language.model.ts +22 -0
- package/src/organization-contact.model.ts +84 -0
- package/src/{organization-department.model.d.ts → organization-department.model.ts} +16 -10
- package/src/organization-language.model.ts +24 -0
- package/src/organization-projects.model.ts +99 -0
- package/src/organization-team-employee-model.ts +14 -0
- package/src/organization-team-model.ts +25 -0
- package/src/organization.model.ts +266 -0
- package/src/{password-reset.model.d.ts → password-reset.model.ts} +14 -10
- package/src/{plain-object.model.d.ts → plain-object.model.ts} +1 -1
- package/src/plugin.ts +15 -0
- package/src/role-permission.model.ts +123 -0
- package/src/role.model.ts +31 -0
- package/src/schedule.ts +71 -0
- package/src/secret-token.model.ts +15 -0
- package/src/seed.model.ts +50 -0
- package/src/storage-file.model.ts +46 -0
- package/src/tag-entity.model.ts +23 -0
- package/src/tenant.model.ts +52 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/sandbox.ts +5 -0
- package/src/translation.model.ts +37 -0
- package/src/types.ts +277 -0
- package/src/user-organization.model.ts +31 -0
- package/src/user.model.ts +151 -0
- package/src/visibility.model.ts +6 -0
- package/tsconfig.json +22 -0
- package/tsconfig.lib.json +10 -0
- package/tsconfig.spec.json +9 -0
- package/index.cjs.d.ts +0 -1
- package/index.esm.d.ts +0 -1
- package/index.esm.js +0 -4129
- package/src/agent/graph.d.ts +0 -148
- package/src/agent/index.d.ts +0 -5
- package/src/agent/token.d.ts +0 -21
- package/src/agent/utils.d.ts +0 -19
- package/src/agent/variables.d.ts +0 -14
- package/src/ai/ai-model.model.d.ts +0 -198
- package/src/ai/ai-provider.model.d.ts +0 -43
- package/src/ai/ai.model.d.ts +0 -82
- package/src/ai/chat-message-feedback.model.d.ts +0 -24
- package/src/ai/chat-message.model.d.ts +0 -222
- package/src/ai/chat.model.d.ts +0 -189
- package/src/ai/copilot-checkpoint.model.d.ts +0 -23
- package/src/ai/copilot-example.model.d.ts +0 -19
- package/src/ai/copilot-model.model.d.ts +0 -26
- package/src/ai/copilot-organization.model.d.ts +0 -17
- package/src/ai/copilot-provider.model.d.ts +0 -31
- package/src/ai/copilot-role.model.d.ts +0 -43
- package/src/ai/copilot-store.model.d.ts +0 -29
- package/src/ai/copilot-user.model.d.ts +0 -20
- package/src/ai/copilot.model.d.ts +0 -36
- package/src/ai/feature.model.d.ts +0 -6
- package/src/ai/index.d.ts +0 -39
- package/src/ai/knowledge-doc-chunk.model.d.ts +0 -60
- package/src/ai/knowledge-doc-page.model.d.ts +0 -15
- package/src/ai/knowledge-doc.model.d.ts +0 -192
- package/src/ai/knowledge-pipeline.d.ts +0 -107
- package/src/ai/knowledge-retrieval-log.model.d.ts +0 -10
- package/src/ai/knowledgebase-task.model.d.ts +0 -39
- package/src/ai/knowledgebase.model.d.ts +0 -162
- package/src/ai/rag-web.d.ts +0 -26
- package/src/ai/rag.d.ts +0 -24
- package/src/ai/role-permissions.d.ts +0 -13
- package/src/ai/types.d.ts +0 -39
- package/src/ai/xpert-agent-execution.model.d.ts +0 -96
- package/src/ai/xpert-agent.model.d.ts +0 -192
- package/src/ai/xpert-project.model.d.ts +0 -86
- package/src/ai/xpert-task.model.d.ts +0 -26
- package/src/ai/xpert-template.model.d.ts +0 -47
- package/src/ai/xpert-tool-mcp.model.d.ts +0 -67
- package/src/ai/xpert-tool.model.d.ts +0 -147
- package/src/ai/xpert-toolset.model.d.ts +0 -200
- package/src/ai/xpert-workflow-task.prompt.d.ts +0 -2
- package/src/ai/xpert-workflow.model.d.ts +0 -366
- package/src/ai/xpert-workspace.model.d.ts +0 -32
- package/src/ai/xpert.model.d.ts +0 -529
- package/src/ai/xpert.utils.d.ts +0 -80
- package/src/analytics/ai.d.ts +0 -73
- package/src/analytics/approval-policy.model.d.ts +0 -30
- package/src/analytics/business-area-user.model.d.ts +0 -35
- package/src/analytics/business-area.d.ts +0 -17
- package/src/analytics/certification.model.d.ts +0 -11
- package/src/analytics/chatbi-conversation.model.d.ts +0 -15
- package/src/analytics/chatbi-model.model.d.ts +0 -18
- package/src/analytics/collection.model.d.ts +0 -6
- package/src/analytics/comment.model.d.ts +0 -10
- package/src/analytics/data-source-type.d.ts +0 -16
- package/src/analytics/data-source.d.ts +0 -62
- package/src/analytics/favorite.d.ts +0 -14
- package/src/analytics/features.d.ts +0 -19
- package/src/analytics/feed-model.d.ts +0 -13
- package/src/analytics/gateway.d.ts +0 -27
- package/src/analytics/index.d.ts +0 -38
- package/src/analytics/indicator-app.d.ts +0 -44
- package/src/analytics/indicator.d.ts +0 -106
- package/src/analytics/model-query-log.model.d.ts +0 -41
- package/src/analytics/model-query.d.ts +0 -21
- package/src/analytics/permission-approval.model.d.ts +0 -47
- package/src/analytics/project.model.d.ts +0 -50
- package/src/analytics/role-permissions.d.ts +0 -25
- package/src/analytics/schema.d.ts +0 -262
- package/src/analytics/screenshot.model.d.ts +0 -25
- package/src/analytics/semantic-model-entity.d.ts +0 -37
- package/src/analytics/semantic-model-member.d.ts +0 -24
- package/src/analytics/semantic-model.d.ts +0 -175
- package/src/analytics/story-template.model.d.ts +0 -28
- package/src/analytics/story-widget.d.ts +0 -12
- package/src/analytics/story.d.ts +0 -93
- package/src/analytics/subscription.d.ts +0 -38
- package/src/analytics/visit.model.d.ts +0 -34
- package/src/analytics/webSocket.d.ts +0 -48
- package/src/api-key.model.d.ts +0 -10
- package/src/base-entity.model.d.ts +0 -27
- package/src/contact.model.d.ts +0 -41
- package/src/core.model.d.ts +0 -97
- package/src/currency.model.d.ts +0 -579
- package/src/date-picker.model.d.ts +0 -5
- package/src/email-template.model.d.ts +0 -39
- package/src/email.model.d.ts +0 -36
- package/src/employee.model.d.ts +0 -128
- package/src/entity-with-members.model.d.ts +0 -13
- package/src/feature.model.d.ts +0 -93
- package/src/file-provider.d.ts +0 -33
- package/src/help-center-article.model.d.ts +0 -0
- package/src/help-center.model.d.ts +0 -0
- package/src/http-status.enum.d.ts +0 -57
- package/src/import-export.model.d.ts +0 -36
- package/src/index.d.ts +0 -48
- package/src/integration/dify.d.ts +0 -0
- package/src/integration/dingtalk.d.ts +0 -2
- package/src/integration/fastgpt.d.ts +0 -0
- package/src/integration/firecrawl.d.ts +0 -2
- package/src/integration/github.d.ts +0 -69
- package/src/integration/index.d.ts +0 -4
- package/src/integration/lark.d.ts +0 -11
- package/src/integration/wecom.d.ts +0 -2
- package/src/integration.model.d.ts +0 -90
- package/src/invite.model.d.ts +0 -123
- package/src/language.model.d.ts +0 -19
- package/src/organization-contact.model.d.ts +0 -73
- package/src/organization-language.model.d.ts +0 -18
- package/src/organization-projects.model.d.ts +0 -80
- package/src/organization-team-employee-model.d.ts +0 -12
- package/src/organization-team-model.d.ts +0 -19
- package/src/organization.model.d.ts +0 -239
- package/src/plugin.d.ts +0 -13
- package/src/role-permission.model.d.ts +0 -61
- package/src/role.model.d.ts +0 -26
- package/src/schedule.d.ts +0 -27
- package/src/secret-token.model.d.ts +0 -11
- package/src/seed.model.d.ts +0 -37
- package/src/storage-file.model.d.ts +0 -40
- package/src/tag-entity.model.d.ts +0 -20
- package/src/tenant.model.d.ts +0 -40
- package/src/tools/index.d.ts +0 -1
- package/src/tools/sandbox.d.ts +0 -5
- package/src/translation.model.d.ts +0 -26
- package/src/types.d.ts +0 -241
- package/src/user-organization.model.d.ts +0 -24
- package/src/user.model.d.ts +0 -131
- package/src/visibility.model.d.ts +0 -6
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import { I18nObject, IconDefinition, letterStartSUID } from "../types"
|
|
2
|
+
import { ICopilotModel } from "./copilot-model.model"
|
|
3
|
+
import { TKBRecallParams } from "./knowledgebase.model"
|
|
4
|
+
import { ApiAuthType, TErrorHandling, TXpertRefParameter } from "./types"
|
|
5
|
+
import { TKBRetrievalSettings, TStateVariable, TXpertParameter } from "./xpert.model"
|
|
6
|
+
|
|
7
|
+
export type TWorkflowNodeMeta = {
|
|
8
|
+
name: string
|
|
9
|
+
label: I18nObject
|
|
10
|
+
icon: IconDefinition
|
|
11
|
+
configSchema: any
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type TWorkflowTriggerMeta = TWorkflowNodeMeta
|
|
15
|
+
|
|
16
|
+
export enum WorkflowNodeTypeEnum {
|
|
17
|
+
/**
|
|
18
|
+
* Trigger
|
|
19
|
+
*/
|
|
20
|
+
TRIGGER = 'trigger',
|
|
21
|
+
/**
|
|
22
|
+
* State Variable Assigner
|
|
23
|
+
*/
|
|
24
|
+
ASSIGNER = 'assigner',
|
|
25
|
+
/**
|
|
26
|
+
* Router
|
|
27
|
+
*/
|
|
28
|
+
IF_ELSE = 'if-else',
|
|
29
|
+
LIST_OPERATOR = 'list-operator',
|
|
30
|
+
VARIABLE_AGGREGATOR = 'variable-aggregator',
|
|
31
|
+
ITERATING = 'iterating',
|
|
32
|
+
HTTP = 'http',
|
|
33
|
+
SUBFLOW = 'subflow',
|
|
34
|
+
TOOL = 'tool',
|
|
35
|
+
AGENT_TOOL = 'agent-tool',
|
|
36
|
+
NOTE = 'note',
|
|
37
|
+
/**
|
|
38
|
+
* Task node, distribute tasks to sub-agents
|
|
39
|
+
*/
|
|
40
|
+
TASK = 'task',
|
|
41
|
+
|
|
42
|
+
// Knowledge Pipeline nodes
|
|
43
|
+
SOURCE = 'source',
|
|
44
|
+
PROCESSOR = 'processor',
|
|
45
|
+
CHUNKER = 'chunker',
|
|
46
|
+
UNDERSTANDING = 'understanding',
|
|
47
|
+
KNOWLEDGE_BASE = 'knowledgebase',
|
|
48
|
+
|
|
49
|
+
// ===============================
|
|
50
|
+
// 📦 Transform Nodes
|
|
51
|
+
// ===============================
|
|
52
|
+
CLASSIFIER = 'classifier',
|
|
53
|
+
KNOWLEDGE = 'knowledge',
|
|
54
|
+
CODE = 'code',
|
|
55
|
+
TEMPLATE = 'template',
|
|
56
|
+
ANSWER = 'answer',
|
|
57
|
+
JSON_STRINGIFY = 'json-stringify',
|
|
58
|
+
JSON_PARSE = 'json-parse',
|
|
59
|
+
|
|
60
|
+
// ===============================
|
|
61
|
+
// 📦 Database Operation Nodes
|
|
62
|
+
// ===============================
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Custom SQL
|
|
66
|
+
*/
|
|
67
|
+
DB_SQL = 'db-sql',
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Insert data (INSERT)
|
|
71
|
+
*/
|
|
72
|
+
DB_INSERT = 'db-insert',
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Update data (UPDATE)
|
|
76
|
+
*/
|
|
77
|
+
DB_UPDATE = 'db-update',
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Delete data (DELETE)
|
|
81
|
+
*/
|
|
82
|
+
DB_DELETE = 'db-delete',
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Query data (SELECT)
|
|
86
|
+
*/
|
|
87
|
+
DB_QUERY = 'db-query',
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface IWorkflowNode {
|
|
92
|
+
id: string
|
|
93
|
+
key: string
|
|
94
|
+
title?: string
|
|
95
|
+
description?: string | I18nObject
|
|
96
|
+
type: WorkflowNodeTypeEnum
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export enum VariableOperationEnum {
|
|
100
|
+
APPEND = 'append',
|
|
101
|
+
EXTEND = 'extend',
|
|
102
|
+
OVERWRITE = 'overwrite',
|
|
103
|
+
CLEAR = 'clear'
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type TVariableAssigner = {
|
|
107
|
+
id: string
|
|
108
|
+
inputType: 'variable' | 'constant' | 'message'
|
|
109
|
+
/**
|
|
110
|
+
* value from variable
|
|
111
|
+
*/
|
|
112
|
+
value?: string
|
|
113
|
+
/**
|
|
114
|
+
* value write to state's variable
|
|
115
|
+
*/
|
|
116
|
+
variableSelector: string
|
|
117
|
+
/**
|
|
118
|
+
* How to write value to variable
|
|
119
|
+
*/
|
|
120
|
+
operation: VariableOperationEnum
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The message template to write to messages variable
|
|
124
|
+
*/
|
|
125
|
+
messages?: {role: string; content: string}[]
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface IWFNAssigner extends IWorkflowNode {
|
|
129
|
+
type: WorkflowNodeTypeEnum.ASSIGNER
|
|
130
|
+
assigners: TVariableAssigner[]
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface IWFNIfElse extends IWorkflowNode {
|
|
134
|
+
type: WorkflowNodeTypeEnum.IF_ELSE
|
|
135
|
+
cases: TWFCase[]
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The list operator can filter and extract attributes such as file format type, file name, and size,
|
|
140
|
+
* passing different format files to corresponding processing nodes to achieve precise control over different file processing flows.
|
|
141
|
+
*/
|
|
142
|
+
export interface IWFNListOperator extends IWorkflowNode {
|
|
143
|
+
type: WorkflowNodeTypeEnum.LIST_OPERATOR
|
|
144
|
+
// Input Variable *
|
|
145
|
+
input: string
|
|
146
|
+
// Variable type of items in the input array
|
|
147
|
+
itemVarType: string
|
|
148
|
+
// Filter condition
|
|
149
|
+
filterBy?: {
|
|
150
|
+
enabled: boolean
|
|
151
|
+
conditions: TWFCaseCondition[]
|
|
152
|
+
logicalOperator: WorkflowLogicalOperator
|
|
153
|
+
}
|
|
154
|
+
// Extract the N item
|
|
155
|
+
extractBy?: {
|
|
156
|
+
enabled: boolean
|
|
157
|
+
index: number
|
|
158
|
+
}
|
|
159
|
+
// Sort items by variable
|
|
160
|
+
sortBy?: {
|
|
161
|
+
enabled: boolean
|
|
162
|
+
variable: string
|
|
163
|
+
descending?: boolean
|
|
164
|
+
}
|
|
165
|
+
// Top N items
|
|
166
|
+
topN?: {
|
|
167
|
+
enabled: boolean
|
|
168
|
+
count: number
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Aggregate variables from multiple branches into a single variable to achieve unified configuration for downstream nodes.
|
|
174
|
+
*/
|
|
175
|
+
export interface IWFNVariableAggregator extends IWorkflowNode {
|
|
176
|
+
type: WorkflowNodeTypeEnum.VARIABLE_AGGREGATOR
|
|
177
|
+
// Input Variables *
|
|
178
|
+
inputs: string[]
|
|
179
|
+
// Output Variable type
|
|
180
|
+
outputType: string
|
|
181
|
+
// Aggregation method
|
|
182
|
+
// method?: 'concat' | 'merge' | 'custom'
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// export interface IWFNSplitter extends IWorkflowNode {
|
|
186
|
+
// type: WorkflowNodeTypeEnum.SPLITTER
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
export interface IWFNIterating extends IWorkflowNode {
|
|
190
|
+
type: WorkflowNodeTypeEnum.ITERATING
|
|
191
|
+
/**
|
|
192
|
+
* Variable name of input array in state
|
|
193
|
+
*/
|
|
194
|
+
inputVariable: string
|
|
195
|
+
inputParams?: TXpertRefParameter[]
|
|
196
|
+
outputParams?: TXpertRefParameter[]
|
|
197
|
+
/**
|
|
198
|
+
* Execute in parallel, otherwise execute sequentially
|
|
199
|
+
*/
|
|
200
|
+
parallel?: boolean
|
|
201
|
+
/**
|
|
202
|
+
* Maximum number of parallel task
|
|
203
|
+
*/
|
|
204
|
+
maximum?: number
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* - terminate: terminate on error
|
|
208
|
+
* - ignore: ignore error and continue
|
|
209
|
+
* - remove: remove error output
|
|
210
|
+
*/
|
|
211
|
+
errorMode?: 'terminate' | 'ignore' | 'remove'
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The parameter name that represents the entire current element in array
|
|
216
|
+
*/
|
|
217
|
+
export const IteratingItemParameterName = '$item'
|
|
218
|
+
export const IteratingIndexParameterName = '$index'
|
|
219
|
+
|
|
220
|
+
export interface IWFNAnswer extends IWorkflowNode {
|
|
221
|
+
type: WorkflowNodeTypeEnum.ANSWER
|
|
222
|
+
promptTemplate: string
|
|
223
|
+
mute?: boolean
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export enum WorkflowLogicalOperator {
|
|
227
|
+
AND = 'and',
|
|
228
|
+
OR = 'or'
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export enum WorkflowComparisonOperator {
|
|
232
|
+
CONTAINS = 'contains',
|
|
233
|
+
NOT_CONTAINS = 'not-contains',
|
|
234
|
+
EQUAL = 'equal',
|
|
235
|
+
NOT_EQUAL = 'not-equal',
|
|
236
|
+
GT = 'gt',
|
|
237
|
+
LT = 'lt',
|
|
238
|
+
GE = 'ge',
|
|
239
|
+
LE = 'le',
|
|
240
|
+
STARTS_WITH = 'starts-with',
|
|
241
|
+
ENDS_WITH = 'ends-with',
|
|
242
|
+
EMPTY = 'empty',
|
|
243
|
+
NOT_EMPTY = 'not-empty',
|
|
244
|
+
IS_TRUE = 'is-true',
|
|
245
|
+
IS_FALSE = 'is-false',
|
|
246
|
+
LIKE = 'like',
|
|
247
|
+
NOT_LIKE = 'not-like'
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Comparison condition for if-else and list-operator nodes
|
|
252
|
+
*/
|
|
253
|
+
export type TWFCaseCondition = {
|
|
254
|
+
id: string
|
|
255
|
+
comparisonOperator: WorkflowComparisonOperator
|
|
256
|
+
value?: string
|
|
257
|
+
varType?: string
|
|
258
|
+
variableSelector?: string
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export type TWFCase = {
|
|
262
|
+
caseId: string
|
|
263
|
+
conditions: TWFCaseCondition[]
|
|
264
|
+
logicalOperator: WorkflowLogicalOperator
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export type TWorkflowVarGroup = {
|
|
268
|
+
// /**
|
|
269
|
+
// * @deprecated use group
|
|
270
|
+
// */
|
|
271
|
+
// agent?: Partial<IXpertAgent>
|
|
272
|
+
group?: {
|
|
273
|
+
name: string
|
|
274
|
+
description: string | I18nObject
|
|
275
|
+
}
|
|
276
|
+
variables: TStateVariable[]
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export type TWorkflowRetry = {
|
|
280
|
+
enabled?: boolean
|
|
281
|
+
stopAfterAttempt?: number
|
|
282
|
+
retryInterval?: number // second
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface IWFNCode extends IWorkflowNode {
|
|
286
|
+
type: WorkflowNodeTypeEnum.CODE
|
|
287
|
+
language: 'python' | 'javascript'
|
|
288
|
+
code: string
|
|
289
|
+
inputs: {name: string; variable?: string}[]
|
|
290
|
+
outputs: TXpertParameter[]
|
|
291
|
+
/**
|
|
292
|
+
* Retry on failure
|
|
293
|
+
*/
|
|
294
|
+
retry?: TWorkflowRetry
|
|
295
|
+
/**
|
|
296
|
+
* Error handling
|
|
297
|
+
*/
|
|
298
|
+
errorHandling?: TErrorHandling
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Http workflow node
|
|
302
|
+
export type BodyType = 'none' | 'form-data' | 'x-www-form-urlencoded' | 'json' | 'raw' | 'binary';
|
|
303
|
+
interface HttpParam {
|
|
304
|
+
key: string;
|
|
305
|
+
value: string;
|
|
306
|
+
}
|
|
307
|
+
interface HttpHeader {
|
|
308
|
+
name: string;
|
|
309
|
+
value: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export type TWorkflowAuthorization = {
|
|
313
|
+
auth_type?: ApiAuthType
|
|
314
|
+
api_key_type?: '' | 'bearer' | 'custom'
|
|
315
|
+
api_key_header?: string
|
|
316
|
+
api_key_value?: string
|
|
317
|
+
username?: string
|
|
318
|
+
password?: string
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface IWFNHttp extends IWorkflowNode {
|
|
322
|
+
type: WorkflowNodeTypeEnum.HTTP
|
|
323
|
+
authorization?: TWorkflowAuthorization
|
|
324
|
+
method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head'
|
|
325
|
+
url: string
|
|
326
|
+
headers: HttpHeader[]
|
|
327
|
+
params: HttpParam[]
|
|
328
|
+
body: {
|
|
329
|
+
type?: BodyType
|
|
330
|
+
body?: string; // 如果是 JSON 类型
|
|
331
|
+
encodedForm?: HttpParam[]
|
|
332
|
+
}
|
|
333
|
+
connectionTimeout?: number
|
|
334
|
+
readTimeout?: number
|
|
335
|
+
writeTimeout?: number
|
|
336
|
+
/**
|
|
337
|
+
* Retry on failure
|
|
338
|
+
*/
|
|
339
|
+
retry?: TWorkflowRetry
|
|
340
|
+
/**
|
|
341
|
+
* Error handling
|
|
342
|
+
*/
|
|
343
|
+
errorHandling?: TErrorHandling
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface IWFNKnowledgeRetrieval extends IWorkflowNode {
|
|
347
|
+
queryVariable: string
|
|
348
|
+
knowledgebases: string[]
|
|
349
|
+
recall?: TKBRecallParams
|
|
350
|
+
retrieval?: TKBRetrievalSettings
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export interface IWFNSubflow extends IWorkflowNode {
|
|
354
|
+
inputParams?: TXpertRefParameter[]
|
|
355
|
+
outputParams?: TXpertRefParameter[]
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface IWFNTemplate extends IWorkflowNode {
|
|
359
|
+
type: WorkflowNodeTypeEnum.TEMPLATE,
|
|
360
|
+
inputParams?: TXpertRefParameter[]
|
|
361
|
+
code: string
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Error handling
|
|
365
|
+
*/
|
|
366
|
+
errorHandling?: TErrorHandling
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface IWFNClassifier extends IWorkflowNode {
|
|
370
|
+
type: WorkflowNodeTypeEnum.CLASSIFIER
|
|
371
|
+
copilotModel: ICopilotModel
|
|
372
|
+
inputVariables: string[]
|
|
373
|
+
classes: {
|
|
374
|
+
description?: string
|
|
375
|
+
}[]
|
|
376
|
+
instruction?: string
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface IWFNClassifier extends IWorkflowNode {
|
|
380
|
+
type: WorkflowNodeTypeEnum.CLASSIFIER
|
|
381
|
+
copilotModel: ICopilotModel
|
|
382
|
+
inputVariables: string[]
|
|
383
|
+
classes: {
|
|
384
|
+
description?: string
|
|
385
|
+
}[]
|
|
386
|
+
instruction?: string
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface IWFNTemplate extends IWorkflowNode {
|
|
390
|
+
type: WorkflowNodeTypeEnum.TEMPLATE,
|
|
391
|
+
inputParams?: TXpertRefParameter[]
|
|
392
|
+
code: string
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Error handling
|
|
396
|
+
*/
|
|
397
|
+
errorHandling?: TErrorHandling
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface IWFNTool extends IWorkflowNode {
|
|
401
|
+
type: WorkflowNodeTypeEnum.TOOL,
|
|
402
|
+
toolsetId: string
|
|
403
|
+
toolName: string
|
|
404
|
+
/**
|
|
405
|
+
* @deprecated Use parameters instead
|
|
406
|
+
*/
|
|
407
|
+
parameterVariable: string
|
|
408
|
+
parameters?: any
|
|
409
|
+
omitBlankValues?: boolean
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Error handling
|
|
413
|
+
*/
|
|
414
|
+
errorHandling?: TErrorHandling
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface IWFNNote extends IWorkflowNode {
|
|
418
|
+
content: string
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export interface IWFNAgentTool extends IWorkflowNode {
|
|
422
|
+
type: WorkflowNodeTypeEnum.AGENT_TOOL,
|
|
423
|
+
// Tool name
|
|
424
|
+
toolName: string
|
|
425
|
+
// Tool description
|
|
426
|
+
toolDescription?: string
|
|
427
|
+
// Tool schema
|
|
428
|
+
toolParameters?: TXpertParameter[]
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* End point tool
|
|
432
|
+
*/
|
|
433
|
+
isEnd?: boolean
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* @deprecated Mixed sub-processes are not suitable for catching exceptions unless they are implemented using a separate subgraph
|
|
437
|
+
* Error handling
|
|
438
|
+
*/
|
|
439
|
+
errorHandling?: TErrorHandling
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export interface IWFNTrigger extends IWorkflowNode {
|
|
443
|
+
type: WorkflowNodeTypeEnum.TRIGGER,
|
|
444
|
+
from: 'chat' | 'integration' | 'scheduler'
|
|
445
|
+
parameters?: TXpertParameter[]
|
|
446
|
+
config?: any
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export interface IWFNTask extends IWorkflowNode {
|
|
450
|
+
type: WorkflowNodeTypeEnum.TASK,
|
|
451
|
+
descriptionPrefix?: string
|
|
452
|
+
descriptionSuffix?: string
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export interface IWFNJSONStringify extends IWorkflowNode {
|
|
456
|
+
type: WorkflowNodeTypeEnum.JSON_STRINGIFY
|
|
457
|
+
inputVariable: string
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export interface IWFNJSONParse extends IWorkflowNode {
|
|
461
|
+
type: WorkflowNodeTypeEnum.JSON_PARSE
|
|
462
|
+
inputVariable: string
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export function genXpertTriggerKey() {
|
|
466
|
+
return letterStartSUID('Trigger_')
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export function genListOperatorKey() {
|
|
470
|
+
return letterStartSUID('ListOperator_')
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export function genVariableAggregatorKey() {
|
|
474
|
+
return letterStartSUID('VariableAggregator_')
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export function genJSONStringifyKey() {
|
|
478
|
+
return letterStartSUID('JSONStringify_')
|
|
479
|
+
}
|
|
480
|
+
export function genJSONParseKey() {
|
|
481
|
+
return letterStartSUID('JSONParse_')
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export function isAgentKey(key: string) {
|
|
485
|
+
return key?.toLowerCase().startsWith('agent_')
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export function isRouterKey(key: string) {
|
|
489
|
+
return key?.toLowerCase().startsWith('router_')
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export function isIteratingKey(key: string) {
|
|
493
|
+
return key?.toLowerCase().startsWith('iterating_')
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export function isWorkflowKey(key: string) {
|
|
497
|
+
return isRouterKey(key) || isIteratingKey(key)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export function workflowNodeIdentifier(node: IWorkflowNode) {
|
|
501
|
+
return node.title || node.key
|
|
502
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model'
|
|
2
|
+
import { IUser } from '../user.model'
|
|
3
|
+
import { IEnvironment } from './environment.model'
|
|
4
|
+
import { IXpert } from './xpert.model'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Expert Workspace
|
|
8
|
+
*/
|
|
9
|
+
export interface IXpertWorkspace extends IBasePerTenantAndOrganizationEntityModel {
|
|
10
|
+
name: string
|
|
11
|
+
description?: string
|
|
12
|
+
status: TXpertWorkspaceStatus
|
|
13
|
+
settings?: TXpertWorkspaceSettings
|
|
14
|
+
|
|
15
|
+
// Many to one
|
|
16
|
+
ownerId: string
|
|
17
|
+
owner?: IUser
|
|
18
|
+
|
|
19
|
+
// One to many
|
|
20
|
+
xperts?: IXpert[]
|
|
21
|
+
environments?: IEnvironment[]
|
|
22
|
+
|
|
23
|
+
members?: IUser[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type TXpertWorkspaceSettings = {
|
|
27
|
+
//
|
|
28
|
+
}
|
|
29
|
+
export type TXpertWorkspaceStatus = 'active' | 'deprecated' | 'archived'
|
|
30
|
+
|
|
31
|
+
export interface IBasePerWorkspaceEntityModel extends IBasePerTenantAndOrganizationEntityModel {
|
|
32
|
+
workspaceId?: string
|
|
33
|
+
workspace?: IXpertWorkspace
|
|
34
|
+
/**
|
|
35
|
+
* Publish date of latest
|
|
36
|
+
*/
|
|
37
|
+
publishAt?: Date
|
|
38
|
+
/**
|
|
39
|
+
* Soft deleted
|
|
40
|
+
*/
|
|
41
|
+
deletedAt?: Date
|
|
42
|
+
}
|