@metad/contracts 3.6.0 → 3.6.2
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/index.cjs.js +306 -69
- package/index.esm.js +296 -67
- package/package.json +8 -1
- package/src/ai/ai-model.model.d.ts +12 -9
- package/src/ai/index.d.ts +1 -0
- package/src/ai/knowledge-doc-chunk.model.d.ts +60 -0
- package/src/ai/knowledge-doc.model.d.ts +46 -31
- package/src/ai/knowledge-pipeline.d.ts +9 -2
- package/src/ai/knowledgebase-task.model.d.ts +3 -0
- package/src/ai/knowledgebase.model.d.ts +6 -4
- package/src/ai/xpert-workflow.model.d.ts +1 -0
- package/src/ai/xpert.model.d.ts +33 -1
- package/src/analytics/data-source.d.ts +1 -1
- package/src/integration.model.d.ts +6 -2
- package/src/password-reset.model.d.ts +3 -3
- package/src/plugin.d.ts +1 -1
- package/src/types.d.ts +1 -0
- package/src/user.model.d.ts +3 -0
- package/src/integration/ragflow.d.ts +0 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { DocumentInterface } from '@langchain/core/documents';
|
|
2
1
|
import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
3
2
|
import { IIntegration } from '../integration.model';
|
|
4
3
|
import { IStorageFile } from '../storage-file.model';
|
|
5
4
|
import { IKnowledgeDocumentPage } from './knowledge-doc-page.model';
|
|
6
5
|
import { IKnowledgebaseTask } from './knowledgebase-task.model';
|
|
7
|
-
import {
|
|
6
|
+
import { IKnowledgebase } from './knowledgebase.model';
|
|
8
7
|
import { TRagWebOptions } from './rag-web';
|
|
8
|
+
import { IKnowledgeDocumentChunk } from './knowledge-doc-chunk.model';
|
|
9
|
+
import { DocumentSourceProviderCategoryEnum } from './knowledge-pipeline';
|
|
10
|
+
import { TCopilotModel } from './copilot-model.model';
|
|
9
11
|
export type DocumentParserConfig = {
|
|
10
12
|
pages?: number[][];
|
|
11
13
|
replaceWhitespace?: boolean;
|
|
@@ -15,13 +17,16 @@ export type DocumentParserConfig = {
|
|
|
15
17
|
[key: string]: unknown;
|
|
16
18
|
};
|
|
17
19
|
transformerType?: string;
|
|
20
|
+
transformerIntegration?: string;
|
|
18
21
|
transformer?: {
|
|
19
22
|
[key: string]: unknown;
|
|
20
23
|
};
|
|
21
24
|
imageUnderstandingType?: string;
|
|
25
|
+
imageUnderstandingIntegration?: string;
|
|
22
26
|
imageUnderstanding?: {
|
|
23
27
|
[key: string]: unknown;
|
|
24
28
|
};
|
|
29
|
+
imageUnderstandingModel?: TCopilotModel;
|
|
25
30
|
};
|
|
26
31
|
export type DocumentTextParserConfig = DocumentParserConfig & {
|
|
27
32
|
delimiter?: string;
|
|
@@ -36,29 +41,28 @@ export type DocumentSheetParserConfig = DocumentParserConfig & {
|
|
|
36
41
|
* Import Type:
|
|
37
42
|
* - file: local file
|
|
38
43
|
* - web: web document
|
|
39
|
-
* - feishu
|
|
40
|
-
* - wechat
|
|
41
|
-
* - notion
|
|
42
44
|
* ...
|
|
43
45
|
*/
|
|
44
|
-
export declare enum
|
|
46
|
+
export declare enum DocumentTypeEnum {
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
FILE = "file",
|
|
49
|
-
/**
|
|
50
|
-
* Remote files (FTP, SFTP, etc.)
|
|
51
|
-
*/
|
|
52
|
-
REMOTE_FILE = "remote-file",
|
|
53
|
-
/**
|
|
54
|
-
* Web documents
|
|
48
|
+
* Folder, parent of other documents
|
|
55
49
|
*/
|
|
56
|
-
|
|
50
|
+
FOLDER = "folder",
|
|
57
51
|
/**
|
|
58
|
-
*
|
|
52
|
+
* Local files
|
|
53
|
+
* @deprecated use DocumentSourceProviderCategoryEnum local file type instead
|
|
59
54
|
*/
|
|
60
|
-
|
|
55
|
+
FILE = "file"
|
|
61
56
|
}
|
|
57
|
+
export declare const KDocumentSourceType: {
|
|
58
|
+
FOLDER: DocumentTypeEnum.FOLDER;
|
|
59
|
+
FILE: DocumentTypeEnum.FILE;
|
|
60
|
+
LocalFile: DocumentSourceProviderCategoryEnum.LocalFile;
|
|
61
|
+
FileSystem: DocumentSourceProviderCategoryEnum.FileSystem;
|
|
62
|
+
OnlineDocument: DocumentSourceProviderCategoryEnum.OnlineDocument;
|
|
63
|
+
WebCrawl: DocumentSourceProviderCategoryEnum.WebCrawl;
|
|
64
|
+
Database: DocumentSourceProviderCategoryEnum.Database;
|
|
65
|
+
};
|
|
62
66
|
/**
|
|
63
67
|
* Document type category, determine how to process the document.
|
|
64
68
|
*/
|
|
@@ -74,6 +78,10 @@ export declare enum KBDocumentStatusEnum {
|
|
|
74
78
|
WAITING = "waiting",
|
|
75
79
|
VALIDATE = "validate",
|
|
76
80
|
RUNNING = "running",
|
|
81
|
+
TRANSFORMED = "transformed",
|
|
82
|
+
SPLITTED = "splitted",
|
|
83
|
+
UNDERSTOOD = "understood",
|
|
84
|
+
EMBEDDING = "embedding",
|
|
77
85
|
CANCEL = "cancel",
|
|
78
86
|
FINISH = "finish",
|
|
79
87
|
ERROR = "error"
|
|
@@ -85,7 +93,6 @@ export type TDocSourceConfig = {
|
|
|
85
93
|
export type TKnowledgeDocument = {
|
|
86
94
|
disabled?: boolean;
|
|
87
95
|
knowledgebaseId?: string;
|
|
88
|
-
knowledgebase?: IKnowledgebase;
|
|
89
96
|
/**
|
|
90
97
|
* @deprecated use fileUrl instead
|
|
91
98
|
*/
|
|
@@ -100,13 +107,14 @@ export type TKnowledgeDocument = {
|
|
|
100
107
|
thumbnail?: string;
|
|
101
108
|
/**
|
|
102
109
|
* default parser ID
|
|
110
|
+
* @deprecated unused
|
|
103
111
|
*/
|
|
104
112
|
parserId: string;
|
|
105
113
|
parserConfig: DocumentTextParserConfig;
|
|
106
114
|
/**
|
|
107
115
|
* where dose this document come from
|
|
108
116
|
*/
|
|
109
|
-
sourceType?:
|
|
117
|
+
sourceType?: DocumentSourceProviderCategoryEnum | DocumentTypeEnum;
|
|
110
118
|
sourceConfig?: TDocSourceConfig;
|
|
111
119
|
/**
|
|
112
120
|
* document type category
|
|
@@ -125,7 +133,13 @@ export type TKnowledgeDocument = {
|
|
|
125
133
|
*/
|
|
126
134
|
filePath: string;
|
|
127
135
|
fileUrl?: string;
|
|
128
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Folder path in server for this document file.
|
|
138
|
+
* Init it in creating document entity.
|
|
139
|
+
*/
|
|
140
|
+
folder?: string;
|
|
141
|
+
size?: string;
|
|
142
|
+
mimeType?: string;
|
|
129
143
|
tokenNum?: number | null;
|
|
130
144
|
chunkNum?: number | null;
|
|
131
145
|
progress?: number | null;
|
|
@@ -146,7 +160,11 @@ export type TKnowledgeDocument = {
|
|
|
146
160
|
options?: TDocumentWebOptions;
|
|
147
161
|
integrationId?: string;
|
|
148
162
|
integration?: IIntegration;
|
|
163
|
+
/**
|
|
164
|
+
* @deprecated use chunks instead
|
|
165
|
+
*/
|
|
149
166
|
pages?: IKnowledgeDocumentPage[];
|
|
167
|
+
chunks?: IKnowledgeDocumentChunk[];
|
|
150
168
|
tasks?: IKnowledgebaseTask[];
|
|
151
169
|
};
|
|
152
170
|
/**
|
|
@@ -155,18 +173,11 @@ export type TKnowledgeDocument = {
|
|
|
155
173
|
export interface IKnowledgeDocument<T = Metadata> extends TKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
|
|
156
174
|
parent?: IKnowledgeDocument | null;
|
|
157
175
|
children?: IKnowledgeDocument[];
|
|
158
|
-
|
|
176
|
+
knowledgebase?: IKnowledgebase;
|
|
177
|
+
draft?: TKnowledgeDocument;
|
|
159
178
|
metadata?: T;
|
|
160
179
|
}
|
|
161
|
-
export
|
|
162
|
-
id: string;
|
|
163
|
-
pageContent: string;
|
|
164
|
-
metadata: Metadata & {
|
|
165
|
-
knowledgeId?: string;
|
|
166
|
-
};
|
|
167
|
-
collection_id: string;
|
|
168
|
-
}
|
|
169
|
-
export type Metadata = Record<string, any>;
|
|
180
|
+
export type Metadata = any;
|
|
170
181
|
export interface IKnowledgeDocumentCreateInput extends IKnowledgeDocument, IBasePerTenantAndOrganizationEntityModel {
|
|
171
182
|
}
|
|
172
183
|
export interface IKnowledgeDocumentUpdateInput extends Partial<IKnowledgeDocumentCreateInput> {
|
|
@@ -175,3 +186,7 @@ export interface IKnowledgeDocumentUpdateInput extends Partial<IKnowledgeDocumen
|
|
|
175
186
|
export interface IKnowledgeDocumentFindInput extends IBasePerTenantAndOrganizationEntityModel, IKnowledgeDocument {
|
|
176
187
|
}
|
|
177
188
|
export declare function isDocumentSheet(type: string): boolean;
|
|
189
|
+
export declare function isImageType(type: string): boolean;
|
|
190
|
+
export declare function isVideoType(type: string): boolean;
|
|
191
|
+
export declare function isAudioType(type: string): boolean;
|
|
192
|
+
export declare function classificateDocumentCategory(entity: Partial<IKnowledgeDocument>): KBDocumentCategoryEnum;
|
|
@@ -49,11 +49,11 @@ export interface IDocumentUnderstandingProvider extends IDocumentNodeProvider {
|
|
|
49
49
|
/**
|
|
50
50
|
* Knowledge Pipeline Source Node
|
|
51
51
|
*/
|
|
52
|
-
export interface IWFNSource extends IWorkflowNode {
|
|
52
|
+
export interface IWFNSource<T = any> extends IWorkflowNode {
|
|
53
53
|
type: WorkflowNodeTypeEnum.SOURCE;
|
|
54
54
|
provider: string;
|
|
55
55
|
parameters?: TXpertParameter[];
|
|
56
|
-
config:
|
|
56
|
+
config: T;
|
|
57
57
|
integrationId?: string;
|
|
58
58
|
}
|
|
59
59
|
export interface IWFNProcessor extends IWorkflowNode {
|
|
@@ -78,6 +78,9 @@ export interface IWFNUnderstanding extends IWorkflowNode {
|
|
|
78
78
|
}
|
|
79
79
|
export interface IWFNKnowledgeBase extends IWorkflowNode {
|
|
80
80
|
type: WorkflowNodeTypeEnum.KNOWLEDGE_BASE;
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated
|
|
83
|
+
*/
|
|
81
84
|
structure?: KnowledgeStructureEnum;
|
|
82
85
|
/**
|
|
83
86
|
* Documents input variables
|
|
@@ -91,6 +94,10 @@ export interface IWFNKnowledgeBase extends IWorkflowNode {
|
|
|
91
94
|
* (optional) Rerank model
|
|
92
95
|
*/
|
|
93
96
|
rerankModel?: ICopilotModel;
|
|
97
|
+
/**
|
|
98
|
+
* (optional) Vision model
|
|
99
|
+
*/
|
|
100
|
+
visionModel?: ICopilotModel;
|
|
94
101
|
documents?: string[];
|
|
95
102
|
}
|
|
96
103
|
export declare function genPipelineSourceKey(): string;
|
|
@@ -2,6 +2,7 @@ import { IBasePerTenantAndOrganizationEntityModel } from '../base-entity.model';
|
|
|
2
2
|
import { IChatConversation } from './chat.model';
|
|
3
3
|
import { IKnowledgeDocument } from './knowledge-doc.model';
|
|
4
4
|
import { IKnowledgebase } from './knowledgebase.model';
|
|
5
|
+
import { IXpertAgentExecution } from './xpert-agent-execution.model';
|
|
5
6
|
/**
|
|
6
7
|
* Task executions of a knowledgebase
|
|
7
8
|
*/
|
|
@@ -10,6 +11,8 @@ export interface IKnowledgebaseTask extends IBasePerTenantAndOrganizationEntityM
|
|
|
10
11
|
knowledgebase?: IKnowledgebase;
|
|
11
12
|
conversationId?: string;
|
|
12
13
|
conversation?: IChatConversation;
|
|
14
|
+
executionId?: string;
|
|
15
|
+
execution?: IXpertAgentExecution;
|
|
13
16
|
taskType: string;
|
|
14
17
|
status?: 'pending' | 'running' | 'success' | 'failed' | 'cancelled';
|
|
15
18
|
steps: TaskStep[];
|
|
@@ -4,6 +4,7 @@ import { IBasePerWorkspaceEntityModel } from './xpert-workspace.model';
|
|
|
4
4
|
import { IKnowledgeDocument } from './knowledge-doc.model';
|
|
5
5
|
import { IXpert } from './xpert.model';
|
|
6
6
|
import { IIntegration } from '../integration.model';
|
|
7
|
+
import { IDocChunkMetadata } from './knowledge-doc-chunk.model';
|
|
7
8
|
/**
|
|
8
9
|
* Non-internal types should remain the same as IntegrationEnum.
|
|
9
10
|
*/
|
|
@@ -80,6 +81,7 @@ export type TKnowledgebase = {
|
|
|
80
81
|
parserConfig?: KnowledgebaseParserConfig;
|
|
81
82
|
/**
|
|
82
83
|
* Index structure determines how the knowledge base organizes and indexes your document content.
|
|
84
|
+
* @deprecated
|
|
83
85
|
*/
|
|
84
86
|
structure?: KnowledgeStructureEnum;
|
|
85
87
|
/**
|
|
@@ -139,7 +141,7 @@ export type TKBRecallParams = {
|
|
|
139
141
|
*/
|
|
140
142
|
weight?: number;
|
|
141
143
|
};
|
|
142
|
-
export type DocumentMetadata = {
|
|
144
|
+
export type DocumentMetadata = IDocChunkMetadata & {
|
|
143
145
|
score?: number;
|
|
144
146
|
relevanceScore?: number;
|
|
145
147
|
} & Record<string, any>;
|
|
@@ -154,7 +156,7 @@ export declare const KnowledgeTask = "task_id";
|
|
|
154
156
|
/**
|
|
155
157
|
* Specify the data source to run
|
|
156
158
|
*/
|
|
157
|
-
export declare const
|
|
158
|
-
export declare const
|
|
159
|
-
export declare const
|
|
159
|
+
export declare const KNOWLEDGE_SOURCES_NAME = "sources";
|
|
160
|
+
export declare const KNOWLEDGE_DOCUMENTS_NAME = "documents";
|
|
161
|
+
export declare const KNOWLEDGE_FOLDER_ID_NAME = "folder_id";
|
|
160
162
|
export declare const KNOWLEDGE_STAGE_NAME = "stage";
|
|
@@ -355,6 +355,7 @@ export interface IWFNTask extends IWorkflowNode {
|
|
|
355
355
|
descriptionPrefix?: string;
|
|
356
356
|
descriptionSuffix?: string;
|
|
357
357
|
}
|
|
358
|
+
export declare function genXpertTriggerKey(): string;
|
|
358
359
|
export declare function genListOperatorKey(): string;
|
|
359
360
|
export declare function genVariableAggregatorKey(): string;
|
|
360
361
|
export declare function isAgentKey(key: string): boolean;
|
package/src/ai/xpert.model.d.ts
CHANGED
|
@@ -61,13 +61,34 @@ export type TXpertFeatures = {
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
export type TXpert = {
|
|
64
|
+
/**
|
|
65
|
+
* Unique slug identifier, generated from name
|
|
66
|
+
*/
|
|
64
67
|
slug: string;
|
|
68
|
+
/**
|
|
69
|
+
* Expert name
|
|
70
|
+
*/
|
|
65
71
|
name: string;
|
|
72
|
+
/**
|
|
73
|
+
* Expert type
|
|
74
|
+
*/
|
|
66
75
|
type: XpertTypeEnum;
|
|
67
76
|
title?: string;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated use title
|
|
79
|
+
*/
|
|
68
80
|
titleCN?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Expert description
|
|
83
|
+
*/
|
|
69
84
|
description?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Is active
|
|
87
|
+
*/
|
|
70
88
|
active?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Avatar Object
|
|
91
|
+
*/
|
|
71
92
|
avatar?: TAvatar;
|
|
72
93
|
/**
|
|
73
94
|
* Conversation starters
|
|
@@ -103,15 +124,20 @@ export type TXpert = {
|
|
|
103
124
|
*/
|
|
104
125
|
releaseNotes?: string;
|
|
105
126
|
/**
|
|
106
|
-
* Draft on current version
|
|
107
127
|
* Draft on current version
|
|
108
128
|
*/
|
|
109
129
|
draft?: TXpertTeamDraft;
|
|
130
|
+
/**
|
|
131
|
+
* Published graph
|
|
132
|
+
*/
|
|
110
133
|
graph?: TXpertGraph;
|
|
111
134
|
api?: TChatApi;
|
|
112
135
|
app?: TChatApp;
|
|
113
136
|
userId?: string;
|
|
114
137
|
user?: IUser;
|
|
138
|
+
/**
|
|
139
|
+
* Primary agent for this expert
|
|
140
|
+
*/
|
|
115
141
|
agent?: IXpertAgent;
|
|
116
142
|
copilotModel?: ICopilotModel;
|
|
117
143
|
copilotModelId?: string;
|
|
@@ -460,7 +486,13 @@ export type TChatRequest = {
|
|
|
460
486
|
};
|
|
461
487
|
export type TChatOptions = {
|
|
462
488
|
conversationId?: string;
|
|
489
|
+
/**
|
|
490
|
+
* @deprecated
|
|
491
|
+
*/
|
|
463
492
|
knowledgebases?: string[];
|
|
493
|
+
/**
|
|
494
|
+
* @deprecated
|
|
495
|
+
*/
|
|
464
496
|
toolsets?: string[];
|
|
465
497
|
/**
|
|
466
498
|
* The language used by the current browser page
|
|
@@ -11,7 +11,7 @@ export interface IIntegration<T = any> extends IBasePerTenantAndOrganizationEnti
|
|
|
11
11
|
*/
|
|
12
12
|
avatar?: TAvatar;
|
|
13
13
|
slug: string;
|
|
14
|
-
provider: IntegrationEnum;
|
|
14
|
+
provider: string | IntegrationEnum;
|
|
15
15
|
/**
|
|
16
16
|
* Integration features: ['knowledge', 'agent', ...]
|
|
17
17
|
*/
|
|
@@ -81,6 +81,10 @@ export type TIntegrationProvider = {
|
|
|
81
81
|
schema?: TParameterSchema;
|
|
82
82
|
features?: IntegrationFeatureEnum[];
|
|
83
83
|
helpUrl?: string;
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Webhook URL generator, for example:
|
|
86
|
+
* `{{apiBaseUrl}}/api/integration/webhook/{{integrationId}}`
|
|
87
|
+
*/
|
|
88
|
+
webhookUrl?: string;
|
|
85
89
|
pro?: boolean;
|
|
86
90
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface IPasswordReset extends
|
|
1
|
+
import { IBasePerTenantEntityModel } from './base-entity.model';
|
|
2
|
+
export interface IPasswordReset extends IBasePerTenantEntityModel {
|
|
3
3
|
email: string;
|
|
4
4
|
token: string;
|
|
5
5
|
expired?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface IPasswordResetFindInput extends
|
|
7
|
+
export interface IPasswordResetFindInput extends IBasePerTenantEntityModel {
|
|
8
8
|
email?: string;
|
|
9
9
|
token?: string;
|
|
10
10
|
}
|
package/src/plugin.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface PluginMeta {
|
|
|
4
4
|
name: PluginName;
|
|
5
5
|
version: string;
|
|
6
6
|
icon?: IconDefinition;
|
|
7
|
-
category: 'set' | 'doc-source' | 'agent' | 'tools' | 'model' | 'vlm' | 'vector-store' | 'integration';
|
|
7
|
+
category: 'set' | 'doc-source' | 'agent' | 'tools' | 'model' | 'vlm' | 'vector-store' | 'integration' | 'datasource';
|
|
8
8
|
displayName: string;
|
|
9
9
|
description: string;
|
|
10
10
|
keywords?: string[];
|
package/src/types.d.ts
CHANGED
package/src/user.model.d.ts
CHANGED
|
@@ -40,6 +40,9 @@ export interface IEmailVerification extends IBasePerTenantEntityModel {
|
|
|
40
40
|
user?: IUser;
|
|
41
41
|
validUntil: Date;
|
|
42
42
|
}
|
|
43
|
+
export interface IUserEmailInput {
|
|
44
|
+
email: string;
|
|
45
|
+
}
|
|
43
46
|
export interface IUserFindInput {
|
|
44
47
|
thirdPartyId?: string;
|
|
45
48
|
firstName?: string;
|
|
File without changes
|