@petercatai/whisker-client 0.1.202505300705 → 0.1.202506111244-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 +215 -10
  2. package/dist/api.js +70 -4
  3. package/package.json +4 -4
package/dist/api.d.ts CHANGED
@@ -21,20 +21,81 @@ export declare enum IResource {
21
21
  Rule = "rule",
22
22
  Public = "public"
23
23
  }
24
+ /**
25
+ * Language
26
+ * Enum of the programming languages.
27
+ */
28
+ export declare enum ILanguage {
29
+ Cpp = "cpp",
30
+ Go = "go",
31
+ Java = "java",
32
+ Kotlin = "kotlin",
33
+ Js = "js",
34
+ Ts = "ts",
35
+ Php = "php",
36
+ Proto = "proto",
37
+ Python = "python",
38
+ Rst = "rst",
39
+ Ruby = "ruby",
40
+ Rust = "rust",
41
+ Scala = "scala",
42
+ Swift = "swift",
43
+ Markdown = "markdown",
44
+ Latex = "latex",
45
+ Html = "html",
46
+ Sol = "sol",
47
+ Csharp = "csharp",
48
+ Cobol = "cobol",
49
+ C = "c",
50
+ Lua = "lua",
51
+ Perl = "perl",
52
+ Haskell = "haskell",
53
+ Elixir = "elixir",
54
+ Powershell = "powershell"
55
+ }
24
56
  /**
25
57
  * KnowledgeTypeEnum
26
- * mime type of the knowledge. If multiple files are included and require a decomposer, please set the type to 'folder'
58
+ * mime type of the knowledge. The type is used to determine how to process the knowledge and
59
+ * is also used to determine the type of the knowledge resource.
60
+ * different types of knowledge will be processed differently and have different load、split configurations.
61
+ * For example, text will be processed by splitter, while code will be processed by language parser.
27
62
  */
28
63
  export declare enum IKnowledgeTypeEnum {
29
64
  Text = "text",
30
65
  Image = "image",
31
66
  Markdown = "markdown",
67
+ Latex = "latex",
32
68
  Json = "json",
33
69
  Docx = "docx",
34
70
  Pdf = "pdf",
35
71
  Qa = "qa",
36
72
  Yuquedoc = "yuquedoc",
37
- Folder = "folder"
73
+ YuqueBook = "yuque_book",
74
+ GithubRepo = "github_repo",
75
+ Cpp = "cpp",
76
+ Go = "go",
77
+ Java = "java",
78
+ Kotlin = "kotlin",
79
+ Js = "js",
80
+ Ts = "ts",
81
+ Php = "php",
82
+ Proto = "proto",
83
+ Python = "python",
84
+ Rst = "rst",
85
+ Ruby = "ruby",
86
+ Rust = "rust",
87
+ Scala = "scala",
88
+ Swift = "swift",
89
+ Html = "html",
90
+ Sol = "sol",
91
+ Csharp = "csharp",
92
+ Cobol = "cobol",
93
+ C = "c",
94
+ Lua = "lua",
95
+ Perl = "perl",
96
+ Haskell = "haskell",
97
+ Elixir = "elixir",
98
+ Powershell = "powershell"
38
99
  }
39
100
  /**
40
101
  * KnowledgeSourceEnum
@@ -213,6 +274,33 @@ export interface IBaseCharSplitConfig {
213
274
  */
214
275
  split_regex?: string | null;
215
276
  }
277
+ /**
278
+ * BaseCodeSplitConfig
279
+ * Code document split configuration
280
+ */
281
+ export interface IBaseCodeSplitConfig {
282
+ /**
283
+ * Type
284
+ * @default "base_code"
285
+ */
286
+ type?: "base_code";
287
+ /** The programming language of the code. */
288
+ language: ILanguage;
289
+ /**
290
+ * Chunk Size
291
+ * chunk max size for code
292
+ * @min 1
293
+ * @default 1500
294
+ */
295
+ chunk_size?: number;
296
+ /**
297
+ * Chunk Overlap
298
+ * chunk overlap size for code, must be less than chunk_size
299
+ * @min 0
300
+ * @default 150
301
+ */
302
+ chunk_overlap?: number;
303
+ }
216
304
  /** Chunk */
217
305
  export interface IChunk {
218
306
  /**
@@ -261,6 +349,36 @@ export interface IChunk {
261
349
  * Arbitrary metadata associated with the content.
262
350
  */
263
351
  metadata?: Record<string, any> | null;
352
+ /**
353
+ * Tags
354
+ * Tags from knowledge.metadata._tags
355
+ */
356
+ tags?: string[] | null;
357
+ /**
358
+ * F1
359
+ * Field 1 from knowledge.metadata._f1
360
+ */
361
+ f1?: string | null;
362
+ /**
363
+ * F2
364
+ * Field 2 from knowledge.metadata._f2
365
+ */
366
+ f2?: string | null;
367
+ /**
368
+ * F3
369
+ * Field 3 from knowledge.metadata._f3
370
+ */
371
+ f3?: string | null;
372
+ /**
373
+ * F4
374
+ * Field 4 from knowledge.metadata._f4
375
+ */
376
+ f4?: string | null;
377
+ /**
378
+ * F5
379
+ * Field 5 from knowledge.metadata._f5
380
+ */
381
+ f5?: string | null;
264
382
  /**
265
383
  * Gmt Create
266
384
  * creation time
@@ -327,6 +445,12 @@ export interface IGithubFileSourceConfig {
327
445
  * github repo url
328
446
  */
329
447
  repo_name: string;
448
+ /**
449
+ * Url
450
+ * remote origin of the repo, must start with http:// or https://
451
+ * @default "https://github.com"
452
+ */
453
+ url?: string;
330
454
  /**
331
455
  * Branch
332
456
  * branch name of the repo
@@ -358,9 +482,9 @@ export interface IGithubRepoCreate {
358
482
  /**
359
483
  * Knowledge Type
360
484
  * type of knowledge resource
361
- * @default "folder"
485
+ * @default "github_repo"
362
486
  */
363
- knowledge_type?: "folder";
487
+ knowledge_type?: "github_repo";
364
488
  /**
365
489
  * Knowledge Name
366
490
  * name of the knowledge resource
@@ -394,7 +518,51 @@ export interface IGithubRepoCreate {
394
518
  /** source config of the knowledge */
395
519
  source_config: IGithubRepoSourceConfig;
396
520
  /** split config of the knowledge */
397
- split_config: IBaseCharSplitConfig;
521
+ split_config: IGithubRepoParseConfig;
522
+ }
523
+ /** GithubRepoParseConfig */
524
+ export interface IGithubRepoParseConfig {
525
+ /**
526
+ * Chunk Size
527
+ * chunk max size
528
+ * @min 1
529
+ * @default 1500
530
+ */
531
+ chunk_size?: number;
532
+ /**
533
+ * Chunk Overlap
534
+ * chunk overlap size, must be less than chunk_size
535
+ * @min 0
536
+ * @default 150
537
+ */
538
+ chunk_overlap?: number;
539
+ /**
540
+ * Type
541
+ * @default "github_repo"
542
+ */
543
+ type?: "github_repo";
544
+ /**
545
+ * Include Patterns
546
+ * List of include patterns (comma-separated) to filter files in the repo.Only files matching these patterns will be included, unless excluded by ignore_patterns or .gitignore. Lower priority than ignore_patterns and .gitignore.
547
+ */
548
+ include_patterns?: string[] | null;
549
+ /**
550
+ * Ignore Patterns
551
+ * Additional ignore patterns (comma-separated) to exclude files in the repo. Highest priority, overrides include_patterns and .gitignore.
552
+ */
553
+ ignore_patterns?: string[] | null;
554
+ /**
555
+ * Use Gitignore
556
+ * Whether to respect .gitignore rules when filtering files. Priority is lower than ignore_patterns, higher than include_patterns.
557
+ * @default true
558
+ */
559
+ use_gitignore?: boolean | null;
560
+ /**
561
+ * Use Default Ignore
562
+ * Whether to use default ignore patterns (e.g. .git/*, *.pyc, etc). Lowest priority.
563
+ * @default true
564
+ */
565
+ use_default_ignore?: boolean | null;
398
566
  }
399
567
  /** GithubRepoSourceConfig */
400
568
  export interface IGithubRepoSourceConfig {
@@ -403,6 +571,12 @@ export interface IGithubRepoSourceConfig {
403
571
  * github repo url
404
572
  */
405
573
  repo_name: string;
574
+ /**
575
+ * Url
576
+ * remote origin of the repo, must start with http:// or https://
577
+ * @default "https://github.com"
578
+ */
579
+ url?: string;
406
580
  /**
407
581
  * Branch
408
582
  * branch name of the repo
@@ -620,7 +794,7 @@ export interface IKnowledgeInput {
620
794
  * Split Config
621
795
  * configuration for splitting the knowledge
622
796
  */
623
- split_config: IBaseCharSplitConfig | IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IPDFSplitConfig | IGeaGraphSplitConfig;
797
+ split_config: IBaseCharSplitConfig | IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IPDFSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig;
624
798
  /**
625
799
  * File Sha
626
800
  * SHA of the file
@@ -706,7 +880,7 @@ export interface IKnowledgeOutput {
706
880
  * Split Config
707
881
  * configuration for splitting the knowledge
708
882
  */
709
- split_config: IBaseCharSplitConfig | IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IPDFSplitConfig | IGeaGraphSplitConfig;
883
+ split_config: IBaseCharSplitConfig | IMarkdownSplitConfig | ITextSplitConfig | IJSONSplitConfig | IPDFSplitConfig | IGeaGraphSplitConfig | IGithubRepoParseConfig | IBaseCodeSplitConfig;
710
884
  /**
711
885
  * File Sha
712
886
  * SHA of the file
@@ -721,7 +895,7 @@ export interface IKnowledgeOutput {
721
895
  * Metadata
722
896
  * additional metadata, user can update it
723
897
  */
724
- metadata?: Record<string, any> | null;
898
+ metadata?: Record<string, any>;
725
899
  /**
726
900
  * Retrieval Count
727
901
  * count of the retrieval
@@ -1538,6 +1712,36 @@ export interface IRetrievalChunk {
1538
1712
  * Arbitrary metadata associated with the content.
1539
1713
  */
1540
1714
  metadata?: Record<string, any> | null;
1715
+ /**
1716
+ * Tags
1717
+ * Tags from knowledge.metadata._tags
1718
+ */
1719
+ tags?: string[] | null;
1720
+ /**
1721
+ * F1
1722
+ * Field 1 from knowledge.metadata._f1
1723
+ */
1724
+ f1?: string | null;
1725
+ /**
1726
+ * F2
1727
+ * Field 2 from knowledge.metadata._f2
1728
+ */
1729
+ f2?: string | null;
1730
+ /**
1731
+ * F3
1732
+ * Field 3 from knowledge.metadata._f3
1733
+ */
1734
+ f3?: string | null;
1735
+ /**
1736
+ * F4
1737
+ * Field 4 from knowledge.metadata._f4
1738
+ */
1739
+ f4?: string | null;
1740
+ /**
1741
+ * F5
1742
+ * Field 5 from knowledge.metadata._f5
1743
+ */
1744
+ f5?: string | null;
1541
1745
  /**
1542
1746
  * Gmt Create
1543
1747
  * creation time
@@ -1999,7 +2203,7 @@ export interface IYuqueCreate {
1999
2203
  * type of knowledge resource
2000
2204
  * @default "yuquedoc"
2001
2205
  */
2002
- knowledge_type?: "yuquedoc" | "folder";
2206
+ knowledge_type?: "yuquedoc" | "github_repo";
2003
2207
  /**
2004
2208
  * Knowledge Name
2005
2209
  * name of the knowledge resource
@@ -2137,6 +2341,7 @@ export interface HttpResponse<D extends unknown, E extends unknown = unknown> ex
2137
2341
  type CancelToken = Symbol | string | number;
2138
2342
  export declare enum ContentType {
2139
2343
  Json = "application/json",
2344
+ JsonApi = "application/vnd.api+json",
2140
2345
  FormData = "multipart/form-data",
2141
2346
  UrlEncoded = "application/x-www-form-urlencoded",
2142
2347
  Text = "text/plain"
@@ -2163,7 +2368,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
2163
2368
  }
2164
2369
  /**
2165
2370
  * @title whisker rag server
2166
- * @version 1.0.5
2371
+ * @version 1.0.6
2167
2372
  */
2168
2373
  export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
2169
2374
  /**
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.IAction = exports.IEmbeddingModelEnum = exports.IKnowledgeSourceEnum = exports.IKnowledgeTypeEnum = exports.IResource = exports.ITaskStatus = void 0;
25
+ exports.Api = exports.HttpClient = exports.ContentType = exports.IAction = exports.IEmbeddingModelEnum = exports.IKnowledgeSourceEnum = exports.IKnowledgeTypeEnum = exports.ILanguage = exports.IResource = exports.ITaskStatus = void 0;
26
26
  /** TaskStatus */
27
27
  var ITaskStatus;
28
28
  (function (ITaskStatus) {
@@ -48,21 +48,83 @@ var IResource;
48
48
  IResource["Rule"] = "rule";
49
49
  IResource["Public"] = "public";
50
50
  })(IResource || (exports.IResource = IResource = {}));
51
+ /**
52
+ * Language
53
+ * Enum of the programming languages.
54
+ */
55
+ var ILanguage;
56
+ (function (ILanguage) {
57
+ ILanguage["Cpp"] = "cpp";
58
+ ILanguage["Go"] = "go";
59
+ ILanguage["Java"] = "java";
60
+ ILanguage["Kotlin"] = "kotlin";
61
+ ILanguage["Js"] = "js";
62
+ ILanguage["Ts"] = "ts";
63
+ ILanguage["Php"] = "php";
64
+ ILanguage["Proto"] = "proto";
65
+ ILanguage["Python"] = "python";
66
+ ILanguage["Rst"] = "rst";
67
+ ILanguage["Ruby"] = "ruby";
68
+ ILanguage["Rust"] = "rust";
69
+ ILanguage["Scala"] = "scala";
70
+ ILanguage["Swift"] = "swift";
71
+ ILanguage["Markdown"] = "markdown";
72
+ ILanguage["Latex"] = "latex";
73
+ ILanguage["Html"] = "html";
74
+ ILanguage["Sol"] = "sol";
75
+ ILanguage["Csharp"] = "csharp";
76
+ ILanguage["Cobol"] = "cobol";
77
+ ILanguage["C"] = "c";
78
+ ILanguage["Lua"] = "lua";
79
+ ILanguage["Perl"] = "perl";
80
+ ILanguage["Haskell"] = "haskell";
81
+ ILanguage["Elixir"] = "elixir";
82
+ ILanguage["Powershell"] = "powershell";
83
+ })(ILanguage || (exports.ILanguage = ILanguage = {}));
51
84
  /**
52
85
  * KnowledgeTypeEnum
53
- * mime type of the knowledge. If multiple files are included and require a decomposer, please set the type to 'folder'
86
+ * mime type of the knowledge. The type is used to determine how to process the knowledge and
87
+ * is also used to determine the type of the knowledge resource.
88
+ * different types of knowledge will be processed differently and have different load、split configurations.
89
+ * For example, text will be processed by splitter, while code will be processed by language parser.
54
90
  */
55
91
  var IKnowledgeTypeEnum;
56
92
  (function (IKnowledgeTypeEnum) {
57
93
  IKnowledgeTypeEnum["Text"] = "text";
58
94
  IKnowledgeTypeEnum["Image"] = "image";
59
95
  IKnowledgeTypeEnum["Markdown"] = "markdown";
96
+ IKnowledgeTypeEnum["Latex"] = "latex";
60
97
  IKnowledgeTypeEnum["Json"] = "json";
61
98
  IKnowledgeTypeEnum["Docx"] = "docx";
62
99
  IKnowledgeTypeEnum["Pdf"] = "pdf";
63
100
  IKnowledgeTypeEnum["Qa"] = "qa";
64
101
  IKnowledgeTypeEnum["Yuquedoc"] = "yuquedoc";
65
- IKnowledgeTypeEnum["Folder"] = "folder";
102
+ IKnowledgeTypeEnum["YuqueBook"] = "yuque_book";
103
+ IKnowledgeTypeEnum["GithubRepo"] = "github_repo";
104
+ IKnowledgeTypeEnum["Cpp"] = "cpp";
105
+ IKnowledgeTypeEnum["Go"] = "go";
106
+ IKnowledgeTypeEnum["Java"] = "java";
107
+ IKnowledgeTypeEnum["Kotlin"] = "kotlin";
108
+ IKnowledgeTypeEnum["Js"] = "js";
109
+ IKnowledgeTypeEnum["Ts"] = "ts";
110
+ IKnowledgeTypeEnum["Php"] = "php";
111
+ IKnowledgeTypeEnum["Proto"] = "proto";
112
+ IKnowledgeTypeEnum["Python"] = "python";
113
+ IKnowledgeTypeEnum["Rst"] = "rst";
114
+ IKnowledgeTypeEnum["Ruby"] = "ruby";
115
+ IKnowledgeTypeEnum["Rust"] = "rust";
116
+ IKnowledgeTypeEnum["Scala"] = "scala";
117
+ IKnowledgeTypeEnum["Swift"] = "swift";
118
+ IKnowledgeTypeEnum["Html"] = "html";
119
+ IKnowledgeTypeEnum["Sol"] = "sol";
120
+ IKnowledgeTypeEnum["Csharp"] = "csharp";
121
+ IKnowledgeTypeEnum["Cobol"] = "cobol";
122
+ IKnowledgeTypeEnum["C"] = "c";
123
+ IKnowledgeTypeEnum["Lua"] = "lua";
124
+ IKnowledgeTypeEnum["Perl"] = "perl";
125
+ IKnowledgeTypeEnum["Haskell"] = "haskell";
126
+ IKnowledgeTypeEnum["Elixir"] = "elixir";
127
+ IKnowledgeTypeEnum["Powershell"] = "powershell";
66
128
  })(IKnowledgeTypeEnum || (exports.IKnowledgeTypeEnum = IKnowledgeTypeEnum = {}));
67
129
  /**
68
130
  * KnowledgeSourceEnum
@@ -98,6 +160,7 @@ var IAction;
98
160
  var ContentType;
99
161
  (function (ContentType) {
100
162
  ContentType["Json"] = "application/json";
163
+ ContentType["JsonApi"] = "application/vnd.api+json";
101
164
  ContentType["FormData"] = "multipart/form-data";
102
165
  ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
103
166
  ContentType["Text"] = "text/plain";
@@ -121,6 +184,9 @@ class HttpClient {
121
184
  [ContentType.Json]: (input) => input !== null && (typeof input === "object" || typeof input === "string")
122
185
  ? JSON.stringify(input)
123
186
  : input,
187
+ [ContentType.JsonApi]: (input) => input !== null && (typeof input === "object" || typeof input === "string")
188
+ ? JSON.stringify(input)
189
+ : input,
124
190
  [ContentType.Text]: (input) => input !== null && typeof input !== "string"
125
191
  ? JSON.stringify(input)
126
192
  : input,
@@ -231,7 +297,7 @@ class HttpClient {
231
297
  exports.HttpClient = HttpClient;
232
298
  /**
233
299
  * @title whisker rag server
234
- * @version 1.0.5
300
+ * @version 1.0.6
235
301
  */
236
302
  class Api extends HttpClient {
237
303
  constructor() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@petercatai/whisker-client",
3
- "version": "0.1.202505300705",
4
- "description": "Generated API client (Production)",
3
+ "version": "0.1.202506111244-dev",
4
+ "description": "Generated API client (preview)",
5
5
  "main": "dist/api.js",
6
6
  "types": "dist/api.d.ts",
7
7
  "files": [
@@ -13,10 +13,10 @@
13
13
  },
14
14
  "publishConfig": {
15
15
  "access": "public",
16
- "tag": "latest"
16
+ "tag": "dev"
17
17
  },
18
18
  "devDependencies": {
19
- "@types/node": "^22.15.27",
19
+ "@types/node": "^24.0.0",
20
20
  "axios": "^1.9.0",
21
21
  "typescript": "^5.8.3"
22
22
  }