@petercatai/whisker-client 5.0.202604071229 → 6.0.1

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 +196 -33
  2. package/dist/api.js +19 -1
  3. package/package.json +2 -2
package/dist/api.d.ts CHANGED
@@ -1091,6 +1091,100 @@ export interface IBatchQueryRequest {
1091
1091
  /** Knowledge Names */
1092
1092
  knowledge_names: string[];
1093
1093
  }
1094
+ /**
1095
+ * BindMemoryConsolidationRequest
1096
+ * 批量绑定记忆巩固 scheduler job 请求
1097
+ *
1098
+ * 调度配置字段与 SchedulerJobCreate 保持一致,
1099
+ * job_type / target_type / target_id 由接口自动填充。
1100
+ */
1101
+ export interface IBindMemoryConsolidationRequest {
1102
+ /**
1103
+ * Tenant Id Prefix
1104
+ * 租户 ID 前缀,只对匹配的活跃租户绑定
1105
+ * @default "personal"
1106
+ */
1107
+ tenant_id_prefix?: string;
1108
+ /**
1109
+ * Dry Run
1110
+ * 预演模式:仅列出将被绑定的租户,不实际创建
1111
+ * @default false
1112
+ */
1113
+ dry_run?: boolean;
1114
+ /**
1115
+ * Enabled
1116
+ * 是否启用
1117
+ * @default true
1118
+ */
1119
+ enabled?: boolean;
1120
+ /** 调度类型:cron / interval */
1121
+ interval_type: ISchedulerIntervalType;
1122
+ /**
1123
+ * Cron Expression
1124
+ * Cron 表达式,interval_type=cron 时必填
1125
+ */
1126
+ cron_expression?: string | null;
1127
+ /**
1128
+ * Cron 时区
1129
+ * @default "UTC"
1130
+ */
1131
+ cron_timezone?: ISchedulerCronTimezone;
1132
+ /**
1133
+ * Interval Seconds
1134
+ * 间隔秒数,interval_type=interval 时必填
1135
+ */
1136
+ interval_seconds?: number | null;
1137
+ /** Payload Ext */
1138
+ payload_ext?: Record<string, any>;
1139
+ /** Policy Ext */
1140
+ policy_ext?: Record<string, any>;
1141
+ }
1142
+ /**
1143
+ * BindMemoryConsolidationResponse
1144
+ * 批量绑定记忆巩固 scheduler job 响应
1145
+ */
1146
+ export interface IBindMemoryConsolidationResponse {
1147
+ /** Tenant Id Prefix */
1148
+ tenant_id_prefix: string;
1149
+ /**
1150
+ * Matched Count
1151
+ * 匹配到的租户数量
1152
+ */
1153
+ matched_count: number;
1154
+ /**
1155
+ * Created Count
1156
+ * @default 0
1157
+ */
1158
+ created_count?: number;
1159
+ /**
1160
+ * Updated Count
1161
+ * @default 0
1162
+ */
1163
+ updated_count?: number;
1164
+ /**
1165
+ * Failed Count
1166
+ * @default 0
1167
+ */
1168
+ failed_count?: number;
1169
+ /**
1170
+ * Dry Run
1171
+ * @default false
1172
+ */
1173
+ dry_run?: boolean;
1174
+ /** Details */
1175
+ details?: IBindResultItem[];
1176
+ }
1177
+ /** BindResultItem */
1178
+ export interface IBindResultItem {
1179
+ /** Tenant Id */
1180
+ tenant_id: string;
1181
+ /** Status */
1182
+ status: "created" | "updated" | "failed";
1183
+ /** Job Id */
1184
+ job_id?: string | null;
1185
+ /** Error */
1186
+ error?: string | null;
1187
+ }
1094
1188
  /**
1095
1189
  * Blob
1096
1190
  * Raw data abstraction for document loading and file processing.
@@ -1499,6 +1593,63 @@ export interface IEnableStatusUpdate {
1499
1593
  /** Status */
1500
1594
  status: boolean;
1501
1595
  }
1596
+ /**
1597
+ * FileUploadCreate
1598
+ * 通过文件上传信息创建知识的简化 DTO。
1599
+ *
1600
+ * 系统根据 file_ext 自动推导 knowledge_type、source_type、source_config、split_config,
1601
+ * 调用方无需了解内部配置细节。
1602
+ */
1603
+ export interface IFileUploadCreate {
1604
+ /**
1605
+ * Space Id
1606
+ * 空间 ID
1607
+ */
1608
+ space_id: string;
1609
+ /**
1610
+ * File Name
1611
+ * 文件名(含扩展名),同时作为 knowledge_name
1612
+ * @maxLength 255
1613
+ */
1614
+ file_name: string;
1615
+ /**
1616
+ * File Ext
1617
+ * 文件扩展名(不含 '.'),如 pdf / md / xlsx
1618
+ */
1619
+ file_ext: string;
1620
+ /**
1621
+ * File Url
1622
+ * 文件下载地址
1623
+ */
1624
+ file_url: string;
1625
+ /**
1626
+ * File Sha
1627
+ * 文件 MD5 摘要
1628
+ */
1629
+ file_sha: string;
1630
+ /**
1631
+ * File Size
1632
+ * 文件大小(字节)
1633
+ * @min 0
1634
+ */
1635
+ file_size: number;
1636
+ /**
1637
+ * Embedding Model Name
1638
+ * embedding 模型名
1639
+ */
1640
+ embedding_model_name: string;
1641
+ /**
1642
+ * Metadata
1643
+ * 附加元数据
1644
+ * @default {}
1645
+ */
1646
+ metadata?: Record<string, any>;
1647
+ /**
1648
+ * Parent Id
1649
+ * 父级知识 ID
1650
+ */
1651
+ parent_id?: string | null;
1652
+ }
1502
1653
  /**
1503
1654
  * FileUploadResponse
1504
1655
  * 文件上传响应
@@ -2178,10 +2329,11 @@ export interface IKnowledgeInput {
2178
2329
  */
2179
2330
  tenant_id: string;
2180
2331
  /**
2332
+ * Knowledge Type
2181
2333
  * type of knowledge resource
2182
2334
  * @default "text"
2183
2335
  */
2184
- knowledge_type?: IKnowledgeTypeEnum;
2336
+ knowledge_type?: IKnowledgeTypeEnum | string;
2185
2337
  /**
2186
2338
  * Knowledge Name
2187
2339
  * name of the knowledge resource
@@ -2207,7 +2359,7 @@ export interface IKnowledgeInput {
2207
2359
  * Split Config
2208
2360
  * configuration for splitting the knowledge
2209
2361
  */
2210
- split_config: IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IYuqueSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig | IImageSplitConfig | INodePackageParseConfig | IMemorySplitConfig | IFolderSplitConfig | IBaseCharSplitConfig;
2362
+ split_config: IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IYuqueSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig | IImageSplitConfig | INodePackageParseConfig | IMemorySplitConfig | IFolderSplitConfig | IBaseCharSplitConfig | Record<string, any>;
2211
2363
  /**
2212
2364
  * File Sha
2213
2365
  * SHA of the file
@@ -2279,7 +2431,10 @@ export interface IKnowledgeOutput {
2279
2431
  * tenant id
2280
2432
  */
2281
2433
  tenant_id: string;
2282
- /** type of knowledge resource */
2434
+ /**
2435
+ * Knowledge Type
2436
+ * type of knowledge resource
2437
+ */
2283
2438
  knowledge_type?: string;
2284
2439
  /**
2285
2440
  * Knowledge Name
@@ -2303,7 +2458,7 @@ export interface IKnowledgeOutput {
2303
2458
  * Split Config
2304
2459
  * configuration for splitting the knowledge
2305
2460
  */
2306
- split_config: IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IYuqueSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig | IImageSplitConfig | INodePackageParseConfig | IMemorySplitConfig | IFolderSplitConfig | IBaseCharSplitConfig;
2461
+ split_config: IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IYuqueSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig | IImageSplitConfig | INodePackageParseConfig | IMemorySplitConfig | IFolderSplitConfig | IBaseCharSplitConfig | Record<string, any>;
2307
2462
  /**
2308
2463
  * File Sha
2309
2464
  * SHA of the file
@@ -2541,7 +2696,10 @@ export interface IKnowledgeResponse {
2541
2696
  * tenant id
2542
2697
  */
2543
2698
  tenant_id: string;
2544
- /** type of knowledge resource */
2699
+ /**
2700
+ * Knowledge Type
2701
+ * type of knowledge resource
2702
+ */
2545
2703
  knowledge_type?: string;
2546
2704
  /**
2547
2705
  * Knowledge Name
@@ -2565,7 +2723,7 @@ export interface IKnowledgeResponse {
2565
2723
  * Split Config
2566
2724
  * configuration for splitting the knowledge
2567
2725
  */
2568
- split_config: IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IYuqueSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig | IImageSplitConfig | INodePackageParseConfig | IMemorySplitConfig | IFolderSplitConfig | IBaseCharSplitConfig;
2726
+ split_config: IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IYuqueSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig | IImageSplitConfig | INodePackageParseConfig | IMemorySplitConfig | IFolderSplitConfig | IBaseCharSplitConfig | Record<string, any>;
2569
2727
  /**
2570
2728
  * File Sha
2571
2729
  * SHA of the file
@@ -2651,19 +2809,6 @@ export interface ILongTermMemoryCreate {
2651
2809
  * @default []
2652
2810
  */
2653
2811
  tags?: string[];
2654
- /**
2655
- * Confidence
2656
- * Memory confidence (0-1) for dedup and merge decisions
2657
- * @min 0
2658
- * @max 1
2659
- * @default 1
2660
- */
2661
- confidence?: number;
2662
- /**
2663
- * Expires At
2664
- * Expiration time (UTC), None means never expires
2665
- */
2666
- expires_at?: string | null;
2667
2812
  /**
2668
2813
  * Metadata
2669
2814
  * Additional metadata following MemoryKnowledgeMetadata constraints
@@ -2677,6 +2822,11 @@ export interface ILongTermMemoryCreate {
2677
2822
  embedding_model_name?: string | null;
2678
2823
  /** Target cortex region for long-term memory storage */
2679
2824
  cortex_region: IMemoryCortexEnum;
2825
+ /**
2826
+ * Expires At
2827
+ * Expiration time (UTC), None means never expires
2828
+ */
2829
+ expires_at?: string | null;
2680
2830
  }
2681
2831
  /** MarkdownCreate */
2682
2832
  export interface IMarkdownCreate {
@@ -4183,6 +4333,14 @@ export interface IResponseModelArtifactIndex {
4183
4333
  /** Message */
4184
4334
  message?: string | null;
4185
4335
  }
4336
+ /** ResponseModel[BindMemoryConsolidationResponse] */
4337
+ export interface IResponseModelBindMemoryConsolidationResponse {
4338
+ /** Success */
4339
+ success: boolean;
4340
+ data?: IBindMemoryConsolidationResponse | null;
4341
+ /** Message */
4342
+ message?: string | null;
4343
+ }
4186
4344
  /** ResponseModel[Chunk] */
4187
4345
  export interface IResponseModelChunk {
4188
4346
  /** Success */
@@ -6287,19 +6445,6 @@ export interface IWorkingMemoryCreate {
6287
6445
  * @default []
6288
6446
  */
6289
6447
  tags?: string[];
6290
- /**
6291
- * Confidence
6292
- * Memory confidence (0-1) for dedup and merge decisions
6293
- * @min 0
6294
- * @max 1
6295
- * @default 1
6296
- */
6297
- confidence?: number;
6298
- /**
6299
- * Expires At
6300
- * Expiration time (UTC), None means never expires
6301
- */
6302
- expires_at?: string | null;
6303
6448
  /**
6304
6449
  * Metadata
6305
6450
  * Additional metadata following MemoryKnowledgeMetadata constraints
@@ -6572,6 +6717,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6572
6717
  * @request POST:/api/knowledge/add
6573
6718
  */
6574
6719
  addKnowledge: (data: (ITextCreate | IImageCreate | IJSONCreate | IMarkdownCreate | IPDFCreate | IDocxCreate | IPowerPointCreate | IWebpageCreate | IGithubRepoCreate | IQACreate | IYuqueCreate | IHituNodePackageCreate | IHituNodePackageElementCreate | IFolderCreate)[], params?: RequestParams) => Promise<HttpResponse<IResponseModelListKnowledge, void | IHTTPValidationError>>;
6720
+ /**
6721
+ * @description 通过文件信息批量添加知识(简化接口) 仅需提供文件基础信息(名称、扩展名、URL、MD5、大小),系统根据扩展名自动推导 knowledge_type、source_type、source_config、split_config 等配置。 - 扩展名可映射到已知类型(md/txt/json/image/docx/pdf/pptx 等):自动组装配置并创建处理任务 - 扩展名不可映射:以扩展名原值作为 knowledge_type 存储,不创建处理任务
6722
+ *
6723
+ * @tags knowledge
6724
+ * @name AddKnowledgeByFile
6725
+ * @summary Add Knowledge By File
6726
+ * @request POST:/api/knowledge/add_by_file
6727
+ */
6728
+ addKnowledgeByFile: (data: IFileUploadCreate[], params?: RequestParams) => Promise<HttpResponse<IResponseModelListKnowledge, void | IHTTPValidationError>>;
6575
6729
  /**
6576
6730
  * @description 更新知识(全量更新) 更新知识的完整信息,支持以下字段变更: - 元数据(metadata)变更:同步更新对应 chunk 的 metadata - 启用状态(enabled)变更:同步更新对应 chunk 的启用状态 - 嵌入模型/分片配置/来源配置变更:自动触发重新入库任务 注意:knowledge_type、source_type 等核心字段不可变更。 Args: knowledge: 完整的知识对象,需包含 knowledge_id Returns: 更新后的知识对象(auth_info 字段已脱敏)
6577
6731
  *
@@ -6933,7 +7087,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6933
7087
  */
6934
7088
  checkTenantName: (data: ITenantNameCheckRequest, params?: RequestParams) => Promise<HttpResponse<IResponseModelTenantNameCheckResponse, void | IHTTPValidationError>>;
6935
7089
  /**
6936
- * @description 创建租户 创建新租户并自动生成认证密钥(secret_key): - tenant_id 可自定义或由系统自动生成 - secret_key 由系统自动生成,仅在创建时返回一次 - 创建成功后根据 notify 参数决定是否发送通知邮件 - 如果 metadata.default_space_id 存在,则自动创建默认空间 Args: params.tenant_name: 租户名称,必须唯一 params.email: 联系邮箱,用于接收通知 params.metadata: 自定义元数据(可选),可包含 default_space_id params.notify: 是否发送邮件通知,默认 true params.default_spaces_config: 默认知识库配置(可选) params.tenant_id: 自定义租户ID(可选),支持字母、数字、下划线、中划线 Returns: 创建的租户信息,包含 secret_key(仅此一次) Raises: 400: 租户名称或ID已存在
7090
+ * @description 创建租户 创建新租户并自动生成认证密钥(secret_key): - tenant_id 可自定义或由系统自动生成 - secret_key 由系统自动生成,仅在创建时返回一次 - 创建成功后根据 notify 参数决定是否发送通知邮件 - 如果 metadata.default_space_id 存在,则自动创建默认空间 Args: params.tenant_name: 租户名称,必须唯一 params.email: 联系邮箱,用于接收通知 params.metadata: 自定义元数据(可选),可包含 default_space_id params.notify: 是否发送邮件通知,默认 true params.default_spaces_config: 默认知识库配置(可选) params.tenant_id: 自定义租户ID(可选),支持字母、数字、下划线、中划线 Returns: 创建的租户信息,包含 secret_key(仅此一次) Raises: 400: 租户名称或ID已存在 403: 无权使用 personal_ 前缀的自定义租户ID
6937
7091
  *
6938
7092
  * @tags tenant
6939
7093
  * @name CreateTenant
@@ -7563,6 +7717,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7563
7717
  * @request POST:/api/admin/scheduler/manage
7564
7718
  */
7565
7719
  adminManageSchedulerByFilter: (data: IAdminManageSchedulerRequest, params?: RequestParams) => Promise<HttpResponse<IResponseModelAdminManageSchedulerResponse, void | IHTTPValidationError>>;
7720
+ /**
7721
+ * @description 批量为指定前缀的租户绑定记忆巩固 scheduler job。 对每个匹配的活跃租户,使用 upsert 语义创建或更新 job_type=memory_consolidation / target_type=space / target_id=mem_hippocampus 的定时任务。
7722
+ *
7723
+ * @tags admin
7724
+ * @name AdminBindMemoryConsolidationJobs
7725
+ * @summary Admin Bind Memory Consolidation Jobs
7726
+ * @request POST:/api/admin/scheduler/bind-memory-consolidation
7727
+ */
7728
+ adminBindMemoryConsolidationJobs: (data: IBindMemoryConsolidationRequest, params?: RequestParams) => Promise<HttpResponse<IResponseModelBindMemoryConsolidationResponse, void | IHTTPValidationError>>;
7566
7729
  /**
7567
7730
  * @description 管理员接口:校验 tenant 下 chunk 与 knowledge 的存在一致性。 使用 ES 聚合(composite terms)获取 distinct knowledge_id 集合; 以 DB 校验知识是否存在;对缺失 knowledge_id 对应 chunk 做物理删除。
7568
7731
  *
package/dist/api.js CHANGED
@@ -556,6 +556,15 @@ class Api extends HttpClient {
556
556
  * @request POST:/api/knowledge/add
557
557
  */
558
558
  addKnowledge: (data, params = {}) => this.request(Object.assign({ path: `/api/knowledge/add`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
559
+ /**
560
+ * @description 通过文件信息批量添加知识(简化接口) 仅需提供文件基础信息(名称、扩展名、URL、MD5、大小),系统根据扩展名自动推导 knowledge_type、source_type、source_config、split_config 等配置。 - 扩展名可映射到已知类型(md/txt/json/image/docx/pdf/pptx 等):自动组装配置并创建处理任务 - 扩展名不可映射:以扩展名原值作为 knowledge_type 存储,不创建处理任务
561
+ *
562
+ * @tags knowledge
563
+ * @name AddKnowledgeByFile
564
+ * @summary Add Knowledge By File
565
+ * @request POST:/api/knowledge/add_by_file
566
+ */
567
+ addKnowledgeByFile: (data, params = {}) => this.request(Object.assign({ path: `/api/knowledge/add_by_file`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
559
568
  /**
560
569
  * @description 更新知识(全量更新) 更新知识的完整信息,支持以下字段变更: - 元数据(metadata)变更:同步更新对应 chunk 的 metadata - 启用状态(enabled)变更:同步更新对应 chunk 的启用状态 - 嵌入模型/分片配置/来源配置变更:自动触发重新入库任务 注意:knowledge_type、source_type 等核心字段不可变更。 Args: knowledge: 完整的知识对象,需包含 knowledge_id Returns: 更新后的知识对象(auth_info 字段已脱敏)
561
570
  *
@@ -891,7 +900,7 @@ class Api extends HttpClient {
891
900
  */
892
901
  checkTenantName: (data, params = {}) => this.request(Object.assign({ path: `/api/tenant/check-name`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
893
902
  /**
894
- * @description 创建租户 创建新租户并自动生成认证密钥(secret_key): - tenant_id 可自定义或由系统自动生成 - secret_key 由系统自动生成,仅在创建时返回一次 - 创建成功后根据 notify 参数决定是否发送通知邮件 - 如果 metadata.default_space_id 存在,则自动创建默认空间 Args: params.tenant_name: 租户名称,必须唯一 params.email: 联系邮箱,用于接收通知 params.metadata: 自定义元数据(可选),可包含 default_space_id params.notify: 是否发送邮件通知,默认 true params.default_spaces_config: 默认知识库配置(可选) params.tenant_id: 自定义租户ID(可选),支持字母、数字、下划线、中划线 Returns: 创建的租户信息,包含 secret_key(仅此一次) Raises: 400: 租户名称或ID已存在
903
+ * @description 创建租户 创建新租户并自动生成认证密钥(secret_key): - tenant_id 可自定义或由系统自动生成 - secret_key 由系统自动生成,仅在创建时返回一次 - 创建成功后根据 notify 参数决定是否发送通知邮件 - 如果 metadata.default_space_id 存在,则自动创建默认空间 Args: params.tenant_name: 租户名称,必须唯一 params.email: 联系邮箱,用于接收通知 params.metadata: 自定义元数据(可选),可包含 default_space_id params.notify: 是否发送邮件通知,默认 true params.default_spaces_config: 默认知识库配置(可选) params.tenant_id: 自定义租户ID(可选),支持字母、数字、下划线、中划线 Returns: 创建的租户信息,包含 secret_key(仅此一次) Raises: 400: 租户名称或ID已存在 403: 无权使用 personal_ 前缀的自定义租户ID
895
904
  *
896
905
  * @tags tenant
897
906
  * @name CreateTenant
@@ -1478,6 +1487,15 @@ class Api extends HttpClient {
1478
1487
  * @request POST:/api/admin/scheduler/manage
1479
1488
  */
1480
1489
  adminManageSchedulerByFilter: (data, params = {}) => this.request(Object.assign({ path: `/api/admin/scheduler/manage`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1490
+ /**
1491
+ * @description 批量为指定前缀的租户绑定记忆巩固 scheduler job。 对每个匹配的活跃租户,使用 upsert 语义创建或更新 job_type=memory_consolidation / target_type=space / target_id=mem_hippocampus 的定时任务。
1492
+ *
1493
+ * @tags admin
1494
+ * @name AdminBindMemoryConsolidationJobs
1495
+ * @summary Admin Bind Memory Consolidation Jobs
1496
+ * @request POST:/api/admin/scheduler/bind-memory-consolidation
1497
+ */
1498
+ adminBindMemoryConsolidationJobs: (data, params = {}) => this.request(Object.assign({ path: `/api/admin/scheduler/bind-memory-consolidation`, method: "POST", body: data, type: ContentType.Json, format: "json" }, params)),
1481
1499
  /**
1482
1500
  * @description 管理员接口:校验 tenant 下 chunk 与 knowledge 的存在一致性。 使用 ES 聚合(composite terms)获取 distinct knowledge_id 集合; 以 DB 校验知识是否存在;对缺失 knowledge_id 对应 chunk 做物理删除。
1483
1501
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@petercatai/whisker-client",
3
- "version": "5.0.202604071229",
3
+ "version": "6.0.1",
4
4
  "description": "Generated API client (Production)",
5
5
  "main": "dist/api.js",
6
6
  "types": "dist/api.d.ts",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^25.5.2",
20
- "axios": "^1.14.0",
20
+ "axios": "^1.15.0",
21
21
  "typescript": "^6.0.2"
22
22
  }
23
23
  }