@amaster.ai/client 1.1.51 → 1.1.52-beta.1
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/dist/index.cjs +283 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -3
- package/dist/index.d.ts +135 -3
- package/dist/index.js +283 -0
- package/dist/index.js.map +1 -1
- package/package.json +14 -11
- package/types/index.d.ts +36 -0
- package/types/knowledge.d.ts +160 -0
package/types/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* - **Entity Operations**: {@link ./entity.d.ts}
|
|
31
31
|
* - **BPM (Business Process)**: {@link ./bpm.d.ts}
|
|
32
32
|
* - **Workflow Execution**: {@link ./workflow.d.ts}
|
|
33
|
+
* - **Knowledge Base**: {@link ./knowledge.d.ts}
|
|
33
34
|
*
|
|
34
35
|
* ## AI-Friendly Type Structure
|
|
35
36
|
* This package provides modular type definitions optimized for AI tools and large language models.
|
|
@@ -48,6 +49,7 @@ import type { AuthClientAPI } from "./auth/index";
|
|
|
48
49
|
import type { EntityClientAPI } from "./entity";
|
|
49
50
|
import type { BpmClientAPI } from "./bpm";
|
|
50
51
|
import type { WorkflowClientAPI } from "./workflow";
|
|
52
|
+
import type { KnowledgeClientAPI } from "./knowledge";
|
|
51
53
|
import type { ASRClientConfig, ASRClient, ASRHttpClientConfig, ASRHttpClient } from "./asr";
|
|
52
54
|
import type { CopilotClientAPI } from "./copilot";
|
|
53
55
|
import type { FunctionClientAPI } from "./function";
|
|
@@ -206,6 +208,16 @@ export interface AmasterClient {
|
|
|
206
208
|
*/
|
|
207
209
|
workflow: WorkflowClientAPI;
|
|
208
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Knowledge base document management module
|
|
213
|
+
*
|
|
214
|
+
* Provides methods for resolving the current organization knowledge base,
|
|
215
|
+
* listing documents, uploading documents, polling indexing status, and deleting documents.
|
|
216
|
+
*
|
|
217
|
+
* For detailed documentation, see {@link ./knowledge.d.ts}
|
|
218
|
+
*/
|
|
219
|
+
knowledge: KnowledgeClientAPI;
|
|
220
|
+
|
|
209
221
|
/**
|
|
210
222
|
* ASR (Automatic Speech Recognition) module
|
|
211
223
|
*
|
|
@@ -414,6 +426,30 @@ export type {
|
|
|
414
426
|
WorkflowInputValue,
|
|
415
427
|
WorkflowFile,
|
|
416
428
|
} from "./workflow";
|
|
429
|
+
export type {
|
|
430
|
+
KnowledgeClientAPI,
|
|
431
|
+
KnowledgeClientAPI as KnowledgeClient,
|
|
432
|
+
KnowledgeDatasetIdResponse,
|
|
433
|
+
KnowledgeDeleteDocumentOptions,
|
|
434
|
+
KnowledgeDocument,
|
|
435
|
+
KnowledgeDocumentListResponse,
|
|
436
|
+
KnowledgeDocumentListStatus,
|
|
437
|
+
KnowledgeDocumentStatus,
|
|
438
|
+
KnowledgeGetDatasetIdOptions,
|
|
439
|
+
KnowledgeIndexingStatus,
|
|
440
|
+
KnowledgeIndexingStatusOptions,
|
|
441
|
+
KnowledgeIndexingStatusResponse,
|
|
442
|
+
KnowledgeListDocumentsOptions,
|
|
443
|
+
KnowledgeMetadataField,
|
|
444
|
+
KnowledgeMetadataOperation,
|
|
445
|
+
KnowledgeMetadataUpdateRequest,
|
|
446
|
+
KnowledgeResolveOptions,
|
|
447
|
+
KnowledgeRoles,
|
|
448
|
+
KnowledgeUpdateDocumentsMetadataOptions,
|
|
449
|
+
KnowledgeUploadDocumentOptions,
|
|
450
|
+
KnowledgeUploadResponse,
|
|
451
|
+
KnowledgeWaitForIndexingOptions,
|
|
452
|
+
} from "./knowledge";
|
|
417
453
|
export type {
|
|
418
454
|
ASRClient,
|
|
419
455
|
ASRClientConfig,
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge base document management types.
|
|
3
|
+
*
|
|
4
|
+
* @module knowledge
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ClientResult } from "./common";
|
|
8
|
+
|
|
9
|
+
export type KnowledgeDocumentStatus = "completed" | "indexing" | "error" | "paused";
|
|
10
|
+
export type KnowledgeDocumentListStatus = KnowledgeDocumentStatus | "all";
|
|
11
|
+
export type KnowledgeRoles = string | string[];
|
|
12
|
+
|
|
13
|
+
export interface KnowledgeDatasetIdResponse {
|
|
14
|
+
dataset_id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface KnowledgeDocument {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
data_source_type?: string;
|
|
21
|
+
doc_type?: string | null;
|
|
22
|
+
doc_form?: string | null;
|
|
23
|
+
indexing_status?: string;
|
|
24
|
+
display_status?: string;
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
archived?: boolean;
|
|
27
|
+
word_count?: number;
|
|
28
|
+
hit_count?: number;
|
|
29
|
+
position?: number;
|
|
30
|
+
created_at?: number;
|
|
31
|
+
updated_at?: number;
|
|
32
|
+
completed_segments?: number;
|
|
33
|
+
total_segments?: number;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface KnowledgeDocumentListResponse {
|
|
38
|
+
data: KnowledgeDocument[];
|
|
39
|
+
total: number;
|
|
40
|
+
page: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
has_more: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface KnowledgeIndexingStatus {
|
|
46
|
+
id: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
indexing_status?: string;
|
|
49
|
+
processing_started_at?: number | null;
|
|
50
|
+
parsing_completed_at?: number | null;
|
|
51
|
+
cleaning_completed_at?: number | null;
|
|
52
|
+
splitting_completed_at?: number | null;
|
|
53
|
+
completed_at?: number | null;
|
|
54
|
+
paused_at?: number | null;
|
|
55
|
+
stopped_at?: number | null;
|
|
56
|
+
completed_segments?: number;
|
|
57
|
+
total_segments?: number;
|
|
58
|
+
error?: string | null;
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface KnowledgeIndexingStatusResponse {
|
|
63
|
+
data: KnowledgeIndexingStatus[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface KnowledgeUploadResponse {
|
|
67
|
+
document: KnowledgeDocument;
|
|
68
|
+
batch: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface KnowledgeMetadataField {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
type?: "string" | "number" | "time" | string;
|
|
75
|
+
value: unknown;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface KnowledgeMetadataOperation {
|
|
79
|
+
document_id: string;
|
|
80
|
+
metadata_list: KnowledgeMetadataField[];
|
|
81
|
+
partial_update?: boolean;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface KnowledgeMetadataUpdateRequest {
|
|
85
|
+
operation_data: KnowledgeMetadataOperation[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type KnowledgeResolveOptions =
|
|
89
|
+
| {
|
|
90
|
+
datasetId: string;
|
|
91
|
+
orgCode?: string;
|
|
92
|
+
refresh?: boolean;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
datasetId?: string;
|
|
96
|
+
orgCode: string;
|
|
97
|
+
refresh?: boolean;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export interface KnowledgeGetDatasetIdOptions {
|
|
101
|
+
orgCode: string;
|
|
102
|
+
refresh?: boolean;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type KnowledgeListDocumentsOptions = KnowledgeResolveOptions & {
|
|
106
|
+
page?: number;
|
|
107
|
+
limit?: number;
|
|
108
|
+
keyword?: string;
|
|
109
|
+
status?: KnowledgeDocumentListStatus;
|
|
110
|
+
sort?: string;
|
|
111
|
+
fetch?: boolean | string;
|
|
112
|
+
appCode?: string;
|
|
113
|
+
roles?: KnowledgeRoles;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export type KnowledgeUploadDocumentOptions = KnowledgeResolveOptions & {
|
|
117
|
+
file: File | Blob;
|
|
118
|
+
fileName?: string;
|
|
119
|
+
appCode?: string;
|
|
120
|
+
config?: Record<string, unknown>;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type KnowledgeIndexingStatusOptions = KnowledgeResolveOptions & {
|
|
124
|
+
batch: string;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export type KnowledgeWaitForIndexingOptions = KnowledgeIndexingStatusOptions & {
|
|
128
|
+
intervalMs?: number;
|
|
129
|
+
timeoutMs?: number;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type KnowledgeDeleteDocumentOptions = KnowledgeResolveOptions & {
|
|
133
|
+
documentId: string;
|
|
134
|
+
appCode?: string;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type KnowledgeUpdateDocumentsMetadataOptions = KnowledgeResolveOptions &
|
|
138
|
+
KnowledgeMetadataUpdateRequest;
|
|
139
|
+
|
|
140
|
+
export interface KnowledgeClientAPI {
|
|
141
|
+
getDatasetId(
|
|
142
|
+
options: KnowledgeGetDatasetIdOptions
|
|
143
|
+
): Promise<ClientResult<KnowledgeDatasetIdResponse>>;
|
|
144
|
+
listDocuments(
|
|
145
|
+
options: KnowledgeListDocumentsOptions
|
|
146
|
+
): Promise<ClientResult<KnowledgeDocumentListResponse>>;
|
|
147
|
+
uploadDocument(
|
|
148
|
+
options: KnowledgeUploadDocumentOptions
|
|
149
|
+
): Promise<ClientResult<KnowledgeUploadResponse>>;
|
|
150
|
+
getIndexingStatus(
|
|
151
|
+
options: KnowledgeIndexingStatusOptions
|
|
152
|
+
): Promise<ClientResult<KnowledgeIndexingStatusResponse>>;
|
|
153
|
+
waitForIndexing(
|
|
154
|
+
options: KnowledgeWaitForIndexingOptions
|
|
155
|
+
): Promise<ClientResult<KnowledgeIndexingStatusResponse>>;
|
|
156
|
+
deleteDocument(options: KnowledgeDeleteDocumentOptions): Promise<ClientResult<null>>;
|
|
157
|
+
updateDocumentsMetadata(
|
|
158
|
+
options: KnowledgeUpdateDocumentsMetadataOptions
|
|
159
|
+
): Promise<ClientResult<{ result: string }>>;
|
|
160
|
+
}
|