Skip to content

Commit dcdc380

Browse files
authored
Merge pull request #393 from seatable/fix-embedding-collection-api
fix: embedding collection api
2 parents 5a12011 + 807145a commit dcdc380

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dtable-web-api",
3-
"version": "3.5.7",
3+
"version": "3.5.8",
44
"description": "an interface for dtable-web",
55
"main": "lib/dtable-web-api.js",
66
"scripts": {

src/dtable-web-api.js

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,41 +2649,51 @@ class DTableWebAPI {
26492649
return this.req.delete(url);
26502650
}
26512651

2652+
// embedding collections
26522653
listEmbeddingCollections(dtableUuid) {
26532654
const url = this.server + '/api/v2.1/embedding-collections/?dtable_uuid=' + dtableUuid;
26542655
return this.req.get(url);
26552656
}
26562657

2657-
createEmbeddingCollection(dtableUuid, tableId) {
2658+
createEmbeddingCollection(dtableUuid, tableIds) {
26582659
let url = this.server + '/api/v2.1/embedding-collections/';
26592660
let data = {
26602661
'dtable_uuid': dtableUuid,
2661-
'table_id': tableId,
2662+
'table_ids': tableIds,
26622663
};
2663-
return this._sendPostRequest(url, data, {headers: {'Content-Type': 'application/json'}});
2664+
return this._sendPostRequest(url, data, { headers: {'Content-Type': 'application/json' }});
2665+
}
2666+
2667+
deleteEmbeddingCollection(collectionId) {
2668+
const url = this.server + '/api/v2.1/embedding-collections/' + collectionId + '/';
2669+
return this.req.delete(url);
26642670
}
26652671

2666-
semanticSearch(dtableUuid, tableId, query) {
2672+
updateEmbeddingCollection(collectionId) {
2673+
const url = this.server + '/api/v2.1/embedding-collections/' + collectionId + '/';
2674+
return this.req.put(url);
2675+
}
2676+
2677+
queryEmbeddingCollectionStatus(taskId) {
2678+
const url = this.server + '/api/v2.1/embedding-collections/task-status/?task_id=' + taskId;
2679+
return this.req.get(url);
2680+
}
2681+
2682+
semanticSearch(dtableUuid, query, { tableIds, count } = {}) {
26672683
let url = this.server + '/api/v2.1/similarity-search/';
26682684
let params = {
26692685
'dtable_uuid': dtableUuid,
2670-
'table_id': tableId,
2671-
'query': query
2686+
'query': query,
26722687
};
2688+
if (tableIds) {
2689+
params['table_ids'] = tableIds;
2690+
}
2691+
if (count) {
2692+
params['count'] = count;
2693+
}
26732694
return this._sendPostRequest(url, params, {headers: {'Content-Type': 'application/json'}});
26742695
}
26752696

2676-
deleteEmbeddingCollection(dtableUuid, collectionId) {
2677-
const url = this.server + '/api/v2.1/embedding-collections/' + collectionId + '/?dtable_uuid=' + dtableUuid;
2678-
return this.req.delete(url);
2679-
}
2680-
2681-
updateEmbeddingCollection(dtableUuid, collectionId) {
2682-
const url = this.server + '/api/v2.1/embedding-collections/' + collectionId + '/';
2683-
let params = { dtable_uuid: dtableUuid };
2684-
return this.req.put(url, params);
2685-
}
2686-
26872697
// org admin api
26882698
orgAdminUpdateOrgInfo(newOrgName) {
26892699
let url = this.server + '/api/v2.1/org/admin/info/';

0 commit comments

Comments
 (0)