@petercatai/whisker-client 0.1.202505220227-dev → 0.1.202505281015-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 +294 -40
  2. package/dist/api.js +99 -1
  3. package/package.json +2 -2
package/dist/api.d.ts CHANGED
@@ -9,6 +9,18 @@ export declare enum ITaskStatus {
9
9
  PendingRetry = "pending_retry",
10
10
  Deleted = "deleted"
11
11
  }
12
+ /** Resource */
13
+ export declare enum IResource {
14
+ Retrieval = "retrieval",
15
+ Tenant = "tenant",
16
+ Space = "space",
17
+ Knowledge = "knowledge",
18
+ Chunk = "chunk",
19
+ ApiKey = "api_key",
20
+ Task = "task",
21
+ Rule = "rule",
22
+ Public = "public"
23
+ }
12
24
  /**
13
25
  * KnowledgeTypeEnum
14
26
  * mime type of the knowledge. If multiple files are included and require a decomposer, please set the type to 'folder'
@@ -44,6 +56,123 @@ export declare enum IEmbeddingModelEnum {
44
56
  SentenceTransformersParaphraseMultilingualMiniLML12V2 = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
45
57
  Shibing624Text2VecBaseChinese = "shibing624/text2vec-base-chinese"
46
58
  }
59
+ /** Action */
60
+ export declare enum IAction {
61
+ Create = "create",
62
+ Read = "read",
63
+ Update = "update",
64
+ Delete = "delete",
65
+ Value = "*"
66
+ }
67
+ /** APIKey */
68
+ export interface IAPIKey {
69
+ /**
70
+ * Gmt Create
71
+ * creation time
72
+ */
73
+ gmt_create?: string;
74
+ /**
75
+ * Gmt Modified
76
+ * update time
77
+ */
78
+ gmt_modified?: string;
79
+ /**
80
+ * Key Id
81
+ * key id
82
+ */
83
+ key_id?: string;
84
+ /**
85
+ * Tenant Id
86
+ * tenant id
87
+ */
88
+ tenant_id: string;
89
+ /**
90
+ * Key Name
91
+ * key name
92
+ * @default ""
93
+ */
94
+ key_name?: string;
95
+ /**
96
+ * Key Value
97
+ * key value
98
+ */
99
+ key_value: string;
100
+ /**
101
+ * Permissions
102
+ * permissions config
103
+ */
104
+ permissions?: IPermission[];
105
+ /**
106
+ * Rate Limit
107
+ * rate limit per minute
108
+ * @min 0
109
+ * @default 0
110
+ */
111
+ rate_limit?: number;
112
+ /**
113
+ * Expires At
114
+ * expire time
115
+ */
116
+ expires_at?: string | null;
117
+ /**
118
+ * Is Active
119
+ * key status
120
+ * @default true
121
+ */
122
+ is_active?: boolean;
123
+ /**
124
+ * Metadata
125
+ * key metadata
126
+ */
127
+ metadata?: Record<string, any> | null;
128
+ }
129
+ /** APIKeyCreate */
130
+ export interface IAPIKeyCreate {
131
+ /**
132
+ * Key Name
133
+ * @default ""
134
+ */
135
+ key_name?: string;
136
+ /** Description */
137
+ description?: string | null;
138
+ /** Permissions */
139
+ permissions?: IPermission[];
140
+ /**
141
+ * Rate Limit
142
+ * @default 0
143
+ */
144
+ rate_limit?: number | null;
145
+ /** Expires At */
146
+ expires_at?: string | null;
147
+ /** Metadata */
148
+ metadata?: Record<string, any> | null;
149
+ }
150
+ /** APIKeyUpdate */
151
+ export interface IAPIKeyUpdate {
152
+ /** Key Id */
153
+ key_id: string;
154
+ /** Key Name */
155
+ key_name?: string | null;
156
+ /** Description */
157
+ description?: string | null;
158
+ /** Permissions */
159
+ permissions?: IPermission[];
160
+ /** Rate Limit */
161
+ rate_limit?: number | null;
162
+ /** Expires At */
163
+ expires_at?: string | null;
164
+ /** Is Active */
165
+ is_active?: boolean | null;
166
+ /** Metadata */
167
+ metadata?: Record<string, any> | null;
168
+ }
169
+ /** ActiveStatusUpdate */
170
+ export interface IActiveStatusUpdate {
171
+ /** Key Id */
172
+ key_id: string;
173
+ /** Status */
174
+ status: boolean;
175
+ }
47
176
  /**
48
177
  * BaseCharSplitConfig
49
178
  * Base char split configuration class
@@ -216,11 +345,6 @@ export interface IGithubRepoCreate {
216
345
  * the space of knowledge, example: petercat bot id, github repo name
217
346
  */
218
347
  space_id: string;
219
- /**
220
- * Knowledge Id
221
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
222
- */
223
- knowledge_id?: string | null;
224
348
  /**
225
349
  * Knowledge Type
226
350
  * type of knowledge resource
@@ -297,11 +421,6 @@ export interface IImageCreate {
297
421
  * the space of knowledge, example: petercat bot id, github repo name
298
422
  */
299
423
  space_id: string;
300
- /**
301
- * Knowledge Id
302
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
303
- */
304
- knowledge_id?: string | null;
305
424
  /**
306
425
  * Knowledge Type
307
426
  * type of knowledge resource
@@ -364,11 +483,6 @@ export interface IJSONCreate {
364
483
  * the space of knowledge, example: petercat bot id, github repo name
365
484
  */
366
485
  space_id: string;
367
- /**
368
- * Knowledge Id
369
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
370
- */
371
- knowledge_id?: string | null;
372
486
  /**
373
487
  * Knowledge Type
374
488
  * type of knowledge resource
@@ -623,11 +737,6 @@ export interface IMarkdownCreate {
623
737
  * the space of knowledge, example: petercat bot id, github repo name
624
738
  */
625
739
  space_id: string;
626
- /**
627
- * Knowledge Id
628
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
629
- */
630
- knowledge_id?: string | null;
631
740
  /**
632
741
  * Knowledge Type
633
742
  * type of knowledge resource
@@ -739,11 +848,6 @@ export interface IPDFCreate {
739
848
  * the space of knowledge, example: petercat bot id, github repo name
740
849
  */
741
850
  space_id: string;
742
- /**
743
- * Knowledge Id
744
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
745
- */
746
- knowledge_id?: string | null;
747
851
  /**
748
852
  * Knowledge Type
749
853
  * type of knowledge resource
@@ -825,6 +929,40 @@ export interface IPDFSplitConfig {
825
929
  */
826
930
  table_extract_mode?: string;
827
931
  }
932
+ /** PageQueryParams[APIKey] */
933
+ export interface IPageQueryParamsAPIKey {
934
+ /**
935
+ * Order By
936
+ * order by field
937
+ */
938
+ order_by?: string | null;
939
+ /**
940
+ * Order Direction
941
+ * asc or desc
942
+ * @default "asc"
943
+ */
944
+ order_direction?: string | null;
945
+ /**
946
+ * Eq Conditions
947
+ * list of equality conditions, each as a dict with key and value
948
+ */
949
+ eq_conditions?: Record<string, any> | null;
950
+ /**
951
+ * Page
952
+ * page number
953
+ * @min 1
954
+ * @default 1
955
+ */
956
+ page?: number;
957
+ /**
958
+ * Page Size
959
+ * page size
960
+ * @min 1
961
+ * @max 1000
962
+ * @default 10
963
+ */
964
+ page_size?: number;
965
+ }
828
966
  /** PageQueryParams[Chunk] */
829
967
  export interface IPageQueryParamsChunk {
830
968
  /**
@@ -961,6 +1099,19 @@ export interface IPageQueryParamsTask {
961
1099
  */
962
1100
  page_size?: number;
963
1101
  }
1102
+ /** PageResponse[APIKey] */
1103
+ export interface IPageResponseAPIKey {
1104
+ /** Items */
1105
+ items: IAPIKey[];
1106
+ /** Total */
1107
+ total: number;
1108
+ /** Page */
1109
+ page: number;
1110
+ /** Page Size */
1111
+ page_size: number;
1112
+ /** Total Pages */
1113
+ total_pages: number;
1114
+ }
964
1115
  /** PageResponse[Chunk] */
965
1116
  export interface IPageResponseChunk {
966
1117
  /** Items */
@@ -1013,6 +1164,14 @@ export interface IPageResponseTenant {
1013
1164
  /** Total Pages */
1014
1165
  total_pages: number;
1015
1166
  }
1167
+ /** Permission */
1168
+ export interface IPermission {
1169
+ resource: IResource;
1170
+ /** Actions */
1171
+ actions: IAction[];
1172
+ /** Conditions */
1173
+ conditions?: Record<string, any> | null;
1174
+ }
1016
1175
  /** QACreate */
1017
1176
  export interface IQACreate {
1018
1177
  /**
@@ -1020,11 +1179,6 @@ export interface IQACreate {
1020
1179
  * the space of knowledge, example: petercat bot id, github repo name
1021
1180
  */
1022
1181
  space_id: string;
1023
- /**
1024
- * Knowledge Id
1025
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
1026
- */
1027
- knowledge_id?: string | null;
1028
1182
  /**
1029
1183
  * Knowledge Type
1030
1184
  * type of knowledge resource
@@ -1089,6 +1243,14 @@ export interface IResponseModel {
1089
1243
  /** Message */
1090
1244
  message?: string | null;
1091
1245
  }
1246
+ /** ResponseModel[APIKey] */
1247
+ export interface IResponseModelAPIKey {
1248
+ /** Success */
1249
+ success: boolean;
1250
+ data?: IAPIKey | null;
1251
+ /** Message */
1252
+ message?: string | null;
1253
+ }
1092
1254
  /** ResponseModel[Chunk] */
1093
1255
  export interface IResponseModelChunk {
1094
1256
  /** Success */
@@ -1105,6 +1267,15 @@ export interface IResponseModelKnowledge {
1105
1267
  /** Message */
1106
1268
  message?: string | null;
1107
1269
  }
1270
+ /** ResponseModel[List[APIKey]] */
1271
+ export interface IResponseModelListAPIKey {
1272
+ /** Success */
1273
+ success: boolean;
1274
+ /** Data */
1275
+ data?: IAPIKey[] | null;
1276
+ /** Message */
1277
+ message?: string | null;
1278
+ }
1108
1279
  /** ResponseModel[List[Knowledge]] */
1109
1280
  export interface IResponseModelListKnowledge {
1110
1281
  /** Success */
@@ -1141,6 +1312,14 @@ export interface IResponseModelNoneType {
1141
1312
  /** Message */
1142
1313
  message?: string | null;
1143
1314
  }
1315
+ /** ResponseModel[PageResponse[APIKey]] */
1316
+ export interface IResponseModelPageResponseAPIKey {
1317
+ /** Success */
1318
+ success: boolean;
1319
+ data?: IPageResponseAPIKey | null;
1320
+ /** Message */
1321
+ message?: string | null;
1322
+ }
1144
1323
  /** ResponseModel[PageResponse[Chunk]] */
1145
1324
  export interface IResponseModelPageResponseChunk {
1146
1325
  /** Success */
@@ -1214,6 +1393,15 @@ export interface IResponseModelObject {
1214
1393
  /** Message */
1215
1394
  message?: string | null;
1216
1395
  }
1396
+ /** ResponseModel[str] */
1397
+ export interface IResponseModelStr {
1398
+ /** Success */
1399
+ success: boolean;
1400
+ /** Data */
1401
+ data?: string | null;
1402
+ /** Message */
1403
+ message?: string | null;
1404
+ }
1217
1405
  /** RetrievalByKnowledgeRequest */
1218
1406
  export interface IRetrievalByKnowledgeRequest {
1219
1407
  /**
@@ -1679,11 +1867,6 @@ export interface ITextCreate {
1679
1867
  * the space of knowledge, example: petercat bot id, github repo name
1680
1868
  */
1681
1869
  space_id: string;
1682
- /**
1683
- * Knowledge Id
1684
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
1685
- */
1686
- knowledge_id?: string | null;
1687
1870
  /**
1688
1871
  * Knowledge Type
1689
1872
  * type of knowledge resource
@@ -1801,11 +1984,6 @@ export interface IYuqueCreate {
1801
1984
  * the space of knowledge, example: petercat bot id, github repo name
1802
1985
  */
1803
1986
  space_id: string;
1804
- /**
1805
- * Knowledge Id
1806
- * id of the knowledge resource (letters, numbers, hyphens and underscores allowed, max 36 chars)
1807
- */
1808
- knowledge_id?: string | null;
1809
1987
  /**
1810
1988
  * Knowledge Type
1811
1989
  * type of knowledge resource
@@ -2300,6 +2478,82 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
2300
2478
  */
2301
2479
  getSpaceById: (spaceId: string, params?: RequestParams) => Promise<HttpResponse<IResponseModelSpaceResponse, void | IHTTPValidationError>>;
2302
2480
  };
2481
+ rule: {
2482
+ /**
2483
+ * No description
2484
+ *
2485
+ * @tags rule
2486
+ * @name GetGlobalRule
2487
+ * @summary Get Global Rule
2488
+ * @request GET:/api/rule/global
2489
+ */
2490
+ getGlobalRule: (params?: RequestParams) => Promise<HttpResponse<IResponseModelStr, void | IHTTPValidationError>>;
2491
+ /**
2492
+ * No description
2493
+ *
2494
+ * @tags rule
2495
+ * @name GetSpaceRule
2496
+ * @summary Get Space Rule
2497
+ * @request GET:/api/rule/space/{space_id}
2498
+ */
2499
+ getSpaceRule: (spaceId: string, params?: RequestParams) => Promise<HttpResponse<IResponseModelStr, void | IHTTPValidationError>>;
2500
+ };
2501
+ apiKey: {
2502
+ /**
2503
+ * No description
2504
+ *
2505
+ * @tags api key
2506
+ * @name CreateApiKey
2507
+ * @summary Create Api Key
2508
+ * @request POST:/api/api_key/create
2509
+ */
2510
+ createApiKey: (data: IAPIKeyCreate, params?: RequestParams) => Promise<HttpResponse<IResponseModelAPIKey, void | IHTTPValidationError>>;
2511
+ /**
2512
+ * No description
2513
+ *
2514
+ * @tags api key
2515
+ * @name UpdateApiKey
2516
+ * @summary Update Api Key
2517
+ * @request POST:/api/api_key/update
2518
+ */
2519
+ updateApiKey: (data: IAPIKeyUpdate, params?: RequestParams) => Promise<HttpResponse<IResponseModelAPIKey, void | IHTTPValidationError>>;
2520
+ /**
2521
+ * No description
2522
+ *
2523
+ * @tags api key
2524
+ * @name GetApiKeyList
2525
+ * @summary Get Api Key List
2526
+ * @request POST:/api/api_key/list
2527
+ */
2528
+ getApiKeyList: (data: IPageQueryParamsAPIKey, params?: RequestParams) => Promise<HttpResponse<IResponseModelPageResponseAPIKey, void | IHTTPValidationError>>;
2529
+ /**
2530
+ * No description
2531
+ *
2532
+ * @tags api key
2533
+ * @name DeleteApiKey
2534
+ * @summary Delete Api Key
2535
+ * @request DELETE:/api/api_key/delete/{key_id}
2536
+ */
2537
+ deleteApiKey: (keyId: string, params?: RequestParams) => Promise<HttpResponse<IResponseModelNoneType, void | IHTTPValidationError>>;
2538
+ /**
2539
+ * No description
2540
+ *
2541
+ * @tags api key
2542
+ * @name DeactivateApiKey
2543
+ * @summary Change Api Key Status
2544
+ * @request POST:/api/api_key/deactivate/{key_id}
2545
+ */
2546
+ deactivateApiKey: (keyId: string, data: IActiveStatusUpdate, params?: RequestParams) => Promise<HttpResponse<IResponseModelNoneType, void | IHTTPValidationError>>;
2547
+ /**
2548
+ * No description
2549
+ *
2550
+ * @tags api key
2551
+ * @name GetAllExpiredApiKeys
2552
+ * @summary Get All Expired Api Keys
2553
+ * @request GET:/api/api_key/expired
2554
+ */
2555
+ getAllExpiredApiKeys: (params?: RequestParams) => Promise<HttpResponse<IResponseModelListAPIKey, void | IHTTPValidationError>>;
2556
+ };
2303
2557
  healthChecker: {
2304
2558
  /**
2305
2559
  * No description
package/dist/api.js CHANGED
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  return t;
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.Api = exports.HttpClient = exports.ContentType = exports.IEmbeddingModelEnum = exports.IKnowledgeSourceEnum = exports.IKnowledgeTypeEnum = exports.ITaskStatus = void 0;
25
+ exports.Api = exports.HttpClient = exports.ContentType = exports.IAction = exports.IEmbeddingModelEnum = exports.IKnowledgeSourceEnum = exports.IKnowledgeTypeEnum = exports.IResource = exports.ITaskStatus = void 0;
26
26
  /** TaskStatus */
27
27
  var ITaskStatus;
28
28
  (function (ITaskStatus) {
@@ -35,6 +35,19 @@ var ITaskStatus;
35
35
  ITaskStatus["PendingRetry"] = "pending_retry";
36
36
  ITaskStatus["Deleted"] = "deleted";
37
37
  })(ITaskStatus || (exports.ITaskStatus = ITaskStatus = {}));
38
+ /** Resource */
39
+ var IResource;
40
+ (function (IResource) {
41
+ IResource["Retrieval"] = "retrieval";
42
+ IResource["Tenant"] = "tenant";
43
+ IResource["Space"] = "space";
44
+ IResource["Knowledge"] = "knowledge";
45
+ IResource["Chunk"] = "chunk";
46
+ IResource["ApiKey"] = "api_key";
47
+ IResource["Task"] = "task";
48
+ IResource["Rule"] = "rule";
49
+ IResource["Public"] = "public";
50
+ })(IResource || (exports.IResource = IResource = {}));
38
51
  /**
39
52
  * KnowledgeTypeEnum
40
53
  * mime type of the knowledge. If multiple files are included and require a decomposer, please set the type to 'folder'
@@ -73,6 +86,15 @@ var IEmbeddingModelEnum;
73
86
  IEmbeddingModelEnum["SentenceTransformersParaphraseMultilingualMiniLML12V2"] = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2";
74
87
  IEmbeddingModelEnum["Shibing624Text2VecBaseChinese"] = "shibing624/text2vec-base-chinese";
75
88
  })(IEmbeddingModelEnum || (exports.IEmbeddingModelEnum = IEmbeddingModelEnum = {}));
89
+ /** Action */
90
+ var IAction;
91
+ (function (IAction) {
92
+ IAction["Create"] = "create";
93
+ IAction["Read"] = "read";
94
+ IAction["Update"] = "update";
95
+ IAction["Delete"] = "delete";
96
+ IAction["Value"] = "*";
97
+ })(IAction || (exports.IAction = IAction = {}));
76
98
  var ContentType;
77
99
  (function (ContentType) {
78
100
  ContentType["Json"] = "application/json";
@@ -513,6 +535,82 @@ class Api extends HttpClient {
513
535
  */
514
536
  getSpaceById: (spaceId, params = {}) => this.request(Object.assign({ path: `/api/space/${spaceId}`, method: "GET", format: "json" }, params)),
515
537
  };
538
+ this.rule = {
539
+ /**
540
+ * No description
541
+ *
542
+ * @tags rule
543
+ * @name GetGlobalRule
544
+ * @summary Get Global Rule
545
+ * @request GET:/api/rule/global
546
+ */
547
+ getGlobalRule: (params = {}) => this.request(Object.assign({ path: `/api/rule/global`, method: "GET", format: "json" }, params)),
548
+ /**
549
+ * No description
550
+ *
551
+ * @tags rule
552
+ * @name GetSpaceRule
553
+ * @summary Get Space Rule
554
+ * @request GET:/api/rule/space/{space_id}
555
+ */
556
+ getSpaceRule: (spaceId, params = {}) => this.request(Object.assign({ path: `/api/rule/space/${spaceId}`, method: "GET", format: "json" }, params)),
557
+ };
558
+ this.apiKey = {
559
+ /**
560
+ * No description
561
+ *
562
+ * @tags api key
563
+ * @name CreateApiKey
564
+ * @summary Create Api Key
565
+ * @request POST:/api/api_key/create
566
+ */
567
+ createApiKey: (data, params = {}) => this.request(Object.assign({ path: `/api/api_key/create`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
568
+ /**
569
+ * No description
570
+ *
571
+ * @tags api key
572
+ * @name UpdateApiKey
573
+ * @summary Update Api Key
574
+ * @request POST:/api/api_key/update
575
+ */
576
+ updateApiKey: (data, params = {}) => this.request(Object.assign({ path: `/api/api_key/update`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
577
+ /**
578
+ * No description
579
+ *
580
+ * @tags api key
581
+ * @name GetApiKeyList
582
+ * @summary Get Api Key List
583
+ * @request POST:/api/api_key/list
584
+ */
585
+ getApiKeyList: (data, params = {}) => this.request(Object.assign({ path: `/api/api_key/list`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
586
+ /**
587
+ * No description
588
+ *
589
+ * @tags api key
590
+ * @name DeleteApiKey
591
+ * @summary Delete Api Key
592
+ * @request DELETE:/api/api_key/delete/{key_id}
593
+ */
594
+ deleteApiKey: (keyId, params = {}) => this.request(Object.assign({ path: `/api/api_key/delete/${keyId}`, method: "DELETE", format: "json" }, params)),
595
+ /**
596
+ * No description
597
+ *
598
+ * @tags api key
599
+ * @name DeactivateApiKey
600
+ * @summary Change Api Key Status
601
+ * @request POST:/api/api_key/deactivate/{key_id}
602
+ */
603
+ deactivateApiKey: (keyId, data, params = {}) => this.request(Object.assign({ path: `/api/api_key/deactivate/${keyId}`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
604
+ /**
605
+ * No description
606
+ *
607
+ * @tags api key
608
+ * @name GetAllExpiredApiKeys
609
+ * @summary Get All Expired Api Keys
610
+ * @request GET:/api/api_key/expired
611
+ */
612
+ getAllExpiredApiKeys: (params = {}) => this.request(Object.assign({ path: `/api/api_key/expired`, method: "GET", format: "json" }, params)),
613
+ };
516
614
  this.healthChecker = {
517
615
  /**
518
616
  * No description
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petercatai/whisker-client",
3
- "version": "0.1.202505220227-dev",
3
+ "version": "0.1.202505281015-dev",
4
4
  "description": "Generated API client (preview)",
5
5
  "main": "dist/api.js",
6
6
  "types": "dist/api.d.ts",
@@ -16,7 +16,7 @@
16
16
  "tag": "dev"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/node": "^22.15.21",
19
+ "@types/node": "^22.15.23",
20
20
  "axios": "^1.9.0",
21
21
  "typescript": "^5.8.3"
22
22
  }