Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
export const dbCreateCollection = async (newCollectionName) => {
console.log("dbCreateCollection");
let result = await fetch(
"http://127.0.0.1:5000/api/v1/create_collection",
{
method: "POST", // or 'PUT'
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(
{
"authenticate":{"username":"test_user","password":"12345"},
"collection_info":{"collection_name": newCollectionName}
}
),
}
)
.then((response) => response.json())
.then((response) => {
if (response["status"] == "success") {
console.log("dbCreateCollection Success")
return response["collection_id"];
}
});
return result
};
export const dbGetCollection = async (collection_id) => {
console.log("dbGetCollection");
let result = await fetch("http://127.0.0.1:5000//api/v1/get_collection?collection=" + collection_id,)
.then((response) => response.json())
.then((response) => {
console.log(response)
if (response["status"] == "success") {
return response["collection"]
}
});
return result;
};
export const dbGetItems = async (collection_id,item_type) => {
console.log("dbGetItems");
let result = await fetch(`http://127.0.0.1:5000//api/v1/get_items?collection=${collection_id}&type=${item_type}`)
.then((response) => response.json())
.then((response) => {
console.log(response)
if (response["status"] == "success") {
return response["files"]
}
});
return result;
};
export const dbGetCollections = async (user_id) => {
let result = await fetch("http://127.0.0.1:5000//api/v1/get_collections?user=" + user_id,)
.then((response) => response.json())
.then((response) => {
console.log("dbGetCollections",response);
if (response["status"] == "success") {
return response["collections"]
} else {
return []
}
});
return result;
};
export const dbUpdateCollectionGlob = async (collection_id,glob) => {
console.log("dbUpdateCollection",collection_id);
let result = await fetch(
"http://127.0.0.1:5000/api/v1/update_collection_glob",
{
method: "POST", // or 'PUT'
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(
{
"authenticate":{"username":"test_user","password":"12345"},
"collection_info":{
"collection_id": collection_id,
"glob":glob
}
}
),
}
)
.then((response) => response.json())
.then((response) => {
if (response["status"] == "success") {
return response;
}
});
return result
};
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
export const dbUpdateCollectionSummary = async (collection_id) => {
console.log("dbUpdateCollectionSummary",collection_id);
let result = await fetch(
"http://127.0.0.1:5000/api/v1/summarize/t5",
{
method: "POST", // or 'PUT'
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(
{
"collection_info":{
"collection_id": collection_id,
}
}
),
}
)
.then((response) => response.json())
.then((response) => {
if (response["status"] == "success") {
return response;
}
});
return result
};
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
export const dbUpdateCollectionSummaryNLTK = async (collection_id) => {
let result = await fetch(
"http://127.0.0.1:5000/api/v1/summarize/nltk",
{
method: "POST", // or 'PUT'
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(
{
"collection_info":{
"collection_id": collection_id,
}
}
),
}
)
.then((response) => response.json())
.then((response) => {
if (response["status"] == "success") {
return response;
}
});
return result
};
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
export const dbUpdateCollectionSummaryBERT = async (collection_id) => {
let result = await fetch(
"http://127.0.0.1:5000/api/v1/summarize/bert",
{
method: "POST", // or 'PUT'
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(
{
"collection_info":{
"collection_id": collection_id,
}
}
),
}
)
.then((response) => response.json())
.then((response) => {
if (response["status"] == "success") {
return response;
}
});
return result
};