@petercatai/whisker-client 0.1.202504091941-dev

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.
Files changed (3) hide show
  1. package/dist/api.d.ts +1577 -0
  2. package/dist/api.js +283 -0
  3. package/package.json +23 -0
package/dist/api.js ADDED
@@ -0,0 +1,283 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ /* tslint:disable */
4
+ // @ts-nocheck
5
+ /*
6
+ * ---------------------------------------------------------------
7
+ * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
8
+ * ## ##
9
+ * ## AUTHOR: acacode ##
10
+ * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
11
+ * ---------------------------------------------------------------
12
+ */
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Api = exports.HttpClient = exports.ContentType = exports.ITaskStatus = exports.IKnowledgeTypeEnum = exports.IKnowledgeSourceEnum = exports.IEmbeddingModelEnum = void 0;
29
+ /** EmbeddingModelEnum */
30
+ var IEmbeddingModelEnum;
31
+ (function (IEmbeddingModelEnum) {
32
+ IEmbeddingModelEnum["Openai"] = "openai";
33
+ IEmbeddingModelEnum["SentenceTransformersAllMiniLML6V2"] = "sentence-transformers/all-MiniLM-L6-v2";
34
+ IEmbeddingModelEnum["SentenceTransformersAllMpnetBaseV2"] = "sentence-transformers/all-mpnet-base-v2";
35
+ IEmbeddingModelEnum["SentenceTransformersParaphraseMultilingualMiniLML12V2"] = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2";
36
+ IEmbeddingModelEnum["Shibing624Text2VecBaseChinese"] = "shibing624/text2vec-base-chinese";
37
+ })(IEmbeddingModelEnum || (exports.IEmbeddingModelEnum = IEmbeddingModelEnum = {}));
38
+ /** KnowledgeSourceEnum */
39
+ var IKnowledgeSourceEnum;
40
+ (function (IKnowledgeSourceEnum) {
41
+ IKnowledgeSourceEnum["GithubRepo"] = "github_repo";
42
+ IKnowledgeSourceEnum["GithubFile"] = "github_file";
43
+ IKnowledgeSourceEnum["UserInputText"] = "user_input_text";
44
+ IKnowledgeSourceEnum["UserUploadFile"] = "user_upload_file";
45
+ })(IKnowledgeSourceEnum || (exports.IKnowledgeSourceEnum = IKnowledgeSourceEnum = {}));
46
+ /**
47
+ * KnowledgeTypeEnum
48
+ * mime type of the knowledge
49
+ */
50
+ var IKnowledgeTypeEnum;
51
+ (function (IKnowledgeTypeEnum) {
52
+ IKnowledgeTypeEnum["Text"] = "text";
53
+ IKnowledgeTypeEnum["Image"] = "image";
54
+ IKnowledgeTypeEnum["Markdown"] = "markdown";
55
+ IKnowledgeTypeEnum["Json"] = "json";
56
+ IKnowledgeTypeEnum["Docx"] = "docx";
57
+ IKnowledgeTypeEnum["Pdf"] = "pdf";
58
+ IKnowledgeTypeEnum["Qa"] = "qa";
59
+ IKnowledgeTypeEnum["Folder"] = "folder";
60
+ })(IKnowledgeTypeEnum || (exports.IKnowledgeTypeEnum = IKnowledgeTypeEnum = {}));
61
+ /** TaskStatus */
62
+ var ITaskStatus;
63
+ (function (ITaskStatus) {
64
+ ITaskStatus["Pending"] = "pending";
65
+ ITaskStatus["Running"] = "running";
66
+ ITaskStatus["Success"] = "success";
67
+ ITaskStatus["Failed"] = "failed";
68
+ ITaskStatus["Skipped"] = "skipped";
69
+ ITaskStatus["Canceled"] = "canceled";
70
+ ITaskStatus["PendingRetry"] = "pending_retry";
71
+ })(ITaskStatus || (exports.ITaskStatus = ITaskStatus = {}));
72
+ const axios_1 = __importDefault(require("axios"));
73
+ var ContentType;
74
+ (function (ContentType) {
75
+ ContentType["Json"] = "application/json";
76
+ ContentType["FormData"] = "multipart/form-data";
77
+ ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
78
+ ContentType["Text"] = "text/plain";
79
+ })(ContentType || (exports.ContentType = ContentType = {}));
80
+ class HttpClient {
81
+ constructor(_a = {}) {
82
+ var { securityWorker, secure, format } = _a, axiosConfig = __rest(_a, ["securityWorker", "secure", "format"]);
83
+ this.securityData = null;
84
+ this.setSecurityData = (data) => {
85
+ this.securityData = data;
86
+ };
87
+ this.request = async (_a) => {
88
+ var { secure, path, type, query, format, body } = _a, params = __rest(_a, ["secure", "path", "type", "query", "format", "body"]);
89
+ const secureParams = ((typeof secure === "boolean" ? secure : this.secure) &&
90
+ this.securityWorker &&
91
+ (await this.securityWorker(this.securityData))) ||
92
+ {};
93
+ const requestParams = this.mergeRequestParams(params, secureParams);
94
+ const responseFormat = format || this.format || undefined;
95
+ if (type === ContentType.FormData && body && body !== null && typeof body === "object") {
96
+ body = this.createFormData(body);
97
+ }
98
+ if (type === ContentType.Text && body && body !== null && typeof body !== "string") {
99
+ body = JSON.stringify(body);
100
+ }
101
+ return this.instance
102
+ .request(Object.assign(Object.assign({}, requestParams), { headers: Object.assign(Object.assign({}, (requestParams.headers || {})), (type ? { "Content-Type": type } : {})), params: query, responseType: responseFormat, data: body, url: path }))
103
+ .then((response) => response.data);
104
+ };
105
+ this.instance = axios_1.default.create(Object.assign(Object.assign({}, axiosConfig), { baseURL: axiosConfig.baseURL || "" }));
106
+ this.secure = secure;
107
+ this.format = format;
108
+ this.securityWorker = securityWorker;
109
+ }
110
+ mergeRequestParams(params1, params2) {
111
+ const method = params1.method || (params2 && params2.method);
112
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, this.instance.defaults), params1), (params2 || {})), { headers: Object.assign(Object.assign(Object.assign({}, ((method && this.instance.defaults.headers[method.toLowerCase()]) || {})), (params1.headers || {})), ((params2 && params2.headers) || {})) });
113
+ }
114
+ stringifyFormItem(formItem) {
115
+ if (typeof formItem === "object" && formItem !== null) {
116
+ return JSON.stringify(formItem);
117
+ }
118
+ else {
119
+ return `${formItem}`;
120
+ }
121
+ }
122
+ createFormData(input) {
123
+ if (input instanceof FormData) {
124
+ return input;
125
+ }
126
+ return Object.keys(input || {}).reduce((formData, key) => {
127
+ const property = input[key];
128
+ const propertyContent = property instanceof Array ? property : [property];
129
+ for (const formItem of propertyContent) {
130
+ const isFileType = formItem instanceof Blob || formItem instanceof File;
131
+ formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
132
+ }
133
+ return formData;
134
+ }, new FormData());
135
+ }
136
+ }
137
+ exports.HttpClient = HttpClient;
138
+ /**
139
+ * @title whisker rag server
140
+ * @version 1.0.2
141
+ */
142
+ class Api extends HttpClient {
143
+ constructor() {
144
+ super(...arguments);
145
+ /**
146
+ * No description
147
+ *
148
+ * @name HomePageGet
149
+ * @summary Home Page
150
+ * @request GET:/
151
+ */
152
+ this.homePageGet = (params = {}) => this.request(Object.assign({ path: `/`, method: "GET", format: "json" }, params));
153
+ this.knowledge = {
154
+ /**
155
+ * @description Duplicate file_sha entries are prohibited. Any modifications to split_config or embedding model_name parameters must be performed using dedicated API endpoints."
156
+ *
157
+ * @tags knowledge
158
+ * @name AddKnowledge
159
+ * @summary Add Knowledge
160
+ * @request POST:/api/knowledge/add
161
+ */
162
+ addKnowledge: (data, params = {}) => this.request(Object.assign({ path: `/api/knowledge/add`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
163
+ /**
164
+ * No description
165
+ *
166
+ * @tags knowledge
167
+ * @name GetKnowledgeList
168
+ * @summary Get Knowledge List
169
+ * @request POST:/api/knowledge/list
170
+ */
171
+ getKnowledgeList: (data, params = {}) => this.request(Object.assign({ path: `/api/knowledge/list`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
172
+ /**
173
+ * No description
174
+ *
175
+ * @tags knowledge
176
+ * @name GetKnowledgeById
177
+ * @summary Get Knowledge By Id
178
+ * @request GET:/api/knowledge/detail
179
+ */
180
+ getKnowledgeById: (query, params = {}) => this.request(Object.assign({ path: `/api/knowledge/detail`, method: "GET", query: query, format: "json" }, params)),
181
+ /**
182
+ * @description Deletes a knowledge entry by its ID.
183
+ *
184
+ * @tags knowledge
185
+ * @name DeleteKnowledge
186
+ * @summary Delete Knowledge
187
+ * @request DELETE:/api/knowledge/delete
188
+ */
189
+ deleteKnowledge: (query, params = {}) => this.request(Object.assign({ path: `/api/knowledge/delete`, method: "DELETE", query: query, format: "json" }, params)),
190
+ };
191
+ this.retrieval = {
192
+ /**
193
+ * @description Retrieve certain chunks within a knowledge_id, for example, within a specific PDF file.
194
+ *
195
+ * @tags retrieval
196
+ * @name RetrieveKnowledgeContent
197
+ * @summary Retrieve Knowledge Content
198
+ * @request POST:/api/retrieval/knowledge
199
+ */
200
+ retrieveKnowledgeContent: (data, params = {}) => this.request(Object.assign({ path: `/api/retrieval/knowledge`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
201
+ /**
202
+ * @description Retrieve chunks within a space_id, for example, given a petercat bot_id, retrieve all chunks under that bot_id.
203
+ *
204
+ * @tags retrieval
205
+ * @name RetrieveSpaceContent
206
+ * @summary Retrieve Space Content
207
+ * @request POST:/api/retrieval/space
208
+ */
209
+ retrieveSpaceContent: (data, params = {}) => this.request(Object.assign({ path: `/api/retrieval/space`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
210
+ };
211
+ this.task = {
212
+ /**
213
+ * No description
214
+ *
215
+ * @tags task
216
+ * @name RestartTask
217
+ * @summary Restart Task
218
+ * @request POST:/api/task/restart
219
+ */
220
+ restartTask: (data, params = {}) => this.request(Object.assign({ path: `/api/task/restart`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
221
+ /**
222
+ * No description
223
+ *
224
+ * @tags task
225
+ * @name GetTaskList
226
+ * @summary Get Task List
227
+ * @request POST:/api/task/list
228
+ */
229
+ getTaskList: (data, params = {}) => this.request(Object.assign({ path: `/api/task/list`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
230
+ /**
231
+ * No description
232
+ *
233
+ * @tags task
234
+ * @name GetTaskDetail
235
+ * @summary Get Task Detail
236
+ * @request GET:/api/task/detail
237
+ */
238
+ getTaskDetail: (query, params = {}) => this.request(Object.assign({ path: `/api/task/detail`, method: "GET", query: query, format: "json" }, params)),
239
+ };
240
+ this.chunk = {
241
+ /**
242
+ * No description
243
+ *
244
+ * @tags chunk
245
+ * @name GetChunkList
246
+ * @summary Get Chunk List
247
+ * @request POST:/api/chunk/list
248
+ */
249
+ getChunkList: (data, params = {}) => this.request(Object.assign({ path: `/api/chunk/list`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
250
+ };
251
+ this.tenant = {
252
+ /**
253
+ * No description
254
+ *
255
+ * @tags tenant
256
+ * @name CreateTenant
257
+ * @summary Create Tenant
258
+ * @request POST:/api/tenant/create
259
+ */
260
+ createTenant: (data, params = {}) => this.request(Object.assign({ path: `/api/tenant/create`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
261
+ /**
262
+ * No description
263
+ *
264
+ * @tags tenant
265
+ * @name GetTenant
266
+ * @summary Get Tenant
267
+ * @request GET:/api/tenant/me
268
+ */
269
+ getTenant: (params = {}) => this.request(Object.assign({ path: `/api/tenant/me`, method: "GET", format: "json" }, params)),
270
+ };
271
+ this.healthChecker = {
272
+ /**
273
+ * No description
274
+ *
275
+ * @name HealthCheckerApiHealthCheckerGet
276
+ * @summary Health Checker
277
+ * @request GET:/api/health_checker
278
+ */
279
+ healthCheckerApiHealthCheckerGet: (params = {}) => this.request(Object.assign({ path: `/api/health_checker`, method: "GET", format: "json" }, params)),
280
+ };
281
+ }
282
+ }
283
+ exports.Api = Api;
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@petercatai/whisker-client",
3
+ "version": "0.1.202504091941-dev",
4
+ "description": "Generated API client (Preview)",
5
+ "main": "dist/api.js",
6
+ "types": "dist/api.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "prepare": "npm run build"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "tag": "dev"
17
+ },
18
+ "devDependencies": {
19
+ "@types/node": "^22.14.0",
20
+ "axios": "^1.8.4",
21
+ "typescript": "^5.8.3"
22
+ }
23
+ }