@amaster.ai/client 1.1.52 → 1.1.54-beta.0
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 +403 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +202 -3
- package/dist/index.d.ts +202 -3
- package/dist/index.js +403 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/types/index.d.ts +36 -0
- package/types/knowledge.d.ts +235 -0
|
@@ -0,0 +1,235 @@
|
|
|
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
|
+
tenant_id?: string;
|
|
16
|
+
workspace_id?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface KnowledgeDocument {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
data_source_type?: string;
|
|
23
|
+
doc_type?: string | null;
|
|
24
|
+
doc_form?: string | null;
|
|
25
|
+
indexing_status?: string;
|
|
26
|
+
display_status?: string;
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
archived?: boolean;
|
|
29
|
+
word_count?: number;
|
|
30
|
+
hit_count?: number;
|
|
31
|
+
position?: number;
|
|
32
|
+
created_at?: number;
|
|
33
|
+
updated_at?: number;
|
|
34
|
+
completed_segments?: number;
|
|
35
|
+
total_segments?: number;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface KnowledgeDocumentListResponse {
|
|
40
|
+
data: KnowledgeDocument[];
|
|
41
|
+
total: number;
|
|
42
|
+
page: number;
|
|
43
|
+
limit: number;
|
|
44
|
+
has_more: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface KnowledgeChildChunk {
|
|
48
|
+
id: string;
|
|
49
|
+
segment_id: string;
|
|
50
|
+
content: string;
|
|
51
|
+
position: number;
|
|
52
|
+
word_count?: number;
|
|
53
|
+
type?: string;
|
|
54
|
+
created_at?: number;
|
|
55
|
+
updated_at?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface KnowledgeSegmentAttachment {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
size?: number;
|
|
62
|
+
extension?: string;
|
|
63
|
+
mime_type?: string;
|
|
64
|
+
source_url?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface KnowledgeSegment {
|
|
68
|
+
id: string;
|
|
69
|
+
position: number;
|
|
70
|
+
document_id: string;
|
|
71
|
+
content: string;
|
|
72
|
+
answer?: string | null;
|
|
73
|
+
word_count?: number;
|
|
74
|
+
tokens?: number;
|
|
75
|
+
keywords?: string[];
|
|
76
|
+
hit_count?: number;
|
|
77
|
+
enabled?: boolean;
|
|
78
|
+
status?: string;
|
|
79
|
+
created_at?: number;
|
|
80
|
+
updated_at?: number;
|
|
81
|
+
indexing_at?: number | null;
|
|
82
|
+
completed_at?: number | null;
|
|
83
|
+
error?: string | null;
|
|
84
|
+
child_chunks?: KnowledgeChildChunk[];
|
|
85
|
+
attachments?: KnowledgeSegmentAttachment[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface KnowledgeSegmentListResponse {
|
|
89
|
+
data: KnowledgeSegment[];
|
|
90
|
+
total: number;
|
|
91
|
+
total_pages: number;
|
|
92
|
+
page: number;
|
|
93
|
+
limit: number;
|
|
94
|
+
has_more: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface KnowledgeIndexingStatus {
|
|
98
|
+
id: string;
|
|
99
|
+
name?: string;
|
|
100
|
+
indexing_status?: string;
|
|
101
|
+
processing_started_at?: number | null;
|
|
102
|
+
parsing_completed_at?: number | null;
|
|
103
|
+
cleaning_completed_at?: number | null;
|
|
104
|
+
splitting_completed_at?: number | null;
|
|
105
|
+
completed_at?: number | null;
|
|
106
|
+
paused_at?: number | null;
|
|
107
|
+
stopped_at?: number | null;
|
|
108
|
+
completed_segments?: number;
|
|
109
|
+
total_segments?: number;
|
|
110
|
+
error?: string | null;
|
|
111
|
+
[key: string]: unknown;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface KnowledgeIndexingStatusResponse {
|
|
115
|
+
data: KnowledgeIndexingStatus[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface KnowledgeUploadResponse {
|
|
119
|
+
document: KnowledgeDocument;
|
|
120
|
+
batch: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface KnowledgeMetadataField {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
type?: "string" | "number" | "time" | string;
|
|
127
|
+
value: unknown;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface KnowledgeMetadataOperation {
|
|
131
|
+
document_id: string;
|
|
132
|
+
metadata_list: KnowledgeMetadataField[];
|
|
133
|
+
partial_update?: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface KnowledgeMetadataUpdateRequest {
|
|
137
|
+
operation_data: KnowledgeMetadataOperation[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export type KnowledgeResolveOptions =
|
|
141
|
+
| {
|
|
142
|
+
datasetId: string;
|
|
143
|
+
orgCode?: string;
|
|
144
|
+
refresh?: boolean;
|
|
145
|
+
workspaceId?: string;
|
|
146
|
+
tenantId?: string;
|
|
147
|
+
}
|
|
148
|
+
| {
|
|
149
|
+
datasetId?: string;
|
|
150
|
+
orgCode: string;
|
|
151
|
+
refresh?: boolean;
|
|
152
|
+
workspaceId?: string;
|
|
153
|
+
tenantId?: string;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export interface KnowledgeGetDatasetIdOptions {
|
|
157
|
+
orgCode: string;
|
|
158
|
+
refresh?: boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export type KnowledgeListDocumentsOptions = KnowledgeResolveOptions & {
|
|
162
|
+
page?: number;
|
|
163
|
+
limit?: number;
|
|
164
|
+
keyword?: string;
|
|
165
|
+
status?: KnowledgeDocumentListStatus;
|
|
166
|
+
sort?: string;
|
|
167
|
+
fetch?: boolean | string;
|
|
168
|
+
appCode?: string;
|
|
169
|
+
roles?: KnowledgeRoles;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export type KnowledgeGetDocumentOptions = KnowledgeResolveOptions & {
|
|
173
|
+
documentId: string;
|
|
174
|
+
appCode?: string;
|
|
175
|
+
roles?: KnowledgeRoles;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type KnowledgeListSegmentsOptions = KnowledgeGetDocumentOptions & {
|
|
179
|
+
page?: number;
|
|
180
|
+
limit?: number;
|
|
181
|
+
keyword?: string;
|
|
182
|
+
enabled?: boolean | "all";
|
|
183
|
+
status?: string;
|
|
184
|
+
hitCountGte?: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type KnowledgeUploadDocumentOptions = KnowledgeResolveOptions & {
|
|
188
|
+
file: File | Blob;
|
|
189
|
+
fileName?: string;
|
|
190
|
+
appCode?: string;
|
|
191
|
+
config?: Record<string, unknown>;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export type KnowledgeIndexingStatusOptions = KnowledgeResolveOptions & {
|
|
195
|
+
batch: string;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export type KnowledgeWaitForIndexingOptions = KnowledgeIndexingStatusOptions & {
|
|
199
|
+
intervalMs?: number;
|
|
200
|
+
timeoutMs?: number;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export type KnowledgeDeleteDocumentOptions = KnowledgeResolveOptions & {
|
|
204
|
+
documentId: string;
|
|
205
|
+
appCode?: string;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export type KnowledgeUpdateDocumentsMetadataOptions = KnowledgeResolveOptions &
|
|
209
|
+
KnowledgeMetadataUpdateRequest;
|
|
210
|
+
|
|
211
|
+
export interface KnowledgeClientAPI {
|
|
212
|
+
getDatasetId(
|
|
213
|
+
options: KnowledgeGetDatasetIdOptions
|
|
214
|
+
): Promise<ClientResult<KnowledgeDatasetIdResponse>>;
|
|
215
|
+
listDocuments(
|
|
216
|
+
options: KnowledgeListDocumentsOptions
|
|
217
|
+
): Promise<ClientResult<KnowledgeDocumentListResponse>>;
|
|
218
|
+
getDocument(options: KnowledgeGetDocumentOptions): Promise<ClientResult<KnowledgeDocument>>;
|
|
219
|
+
listSegments(
|
|
220
|
+
options: KnowledgeListSegmentsOptions
|
|
221
|
+
): Promise<ClientResult<KnowledgeSegmentListResponse>>;
|
|
222
|
+
uploadDocument(
|
|
223
|
+
options: KnowledgeUploadDocumentOptions
|
|
224
|
+
): Promise<ClientResult<KnowledgeUploadResponse>>;
|
|
225
|
+
getIndexingStatus(
|
|
226
|
+
options: KnowledgeIndexingStatusOptions
|
|
227
|
+
): Promise<ClientResult<KnowledgeIndexingStatusResponse>>;
|
|
228
|
+
waitForIndexing(
|
|
229
|
+
options: KnowledgeWaitForIndexingOptions
|
|
230
|
+
): Promise<ClientResult<KnowledgeIndexingStatusResponse>>;
|
|
231
|
+
deleteDocument(options: KnowledgeDeleteDocumentOptions): Promise<ClientResult<null>>;
|
|
232
|
+
updateDocumentsMetadata(
|
|
233
|
+
options: KnowledgeUpdateDocumentsMetadataOptions
|
|
234
|
+
): Promise<ClientResult<{ result: string }>>;
|
|
235
|
+
}
|