@kevisual/ai 0.0.20 → 0.0.21

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.
@@ -464,6 +464,30 @@ declare class Kevisual extends BaseChat {
464
464
  constructor(options: KevisualOptions);
465
465
  }
466
466
 
467
+ type CNBOptions = Partial<BaseChatOptions>;
468
+ declare class CNBChat extends BaseChat {
469
+ static BASE_URL: string;
470
+ constructor(options: CNBOptions & {
471
+ repo: string;
472
+ });
473
+ query({ repo, ...rest }: CNBQueryParam & {
474
+ repo: string;
475
+ }): void;
476
+ }
477
+ type CNBQueryParam = {
478
+ query: string;
479
+ metadata_filtering_conditions?: {
480
+ conditions: Array<{
481
+ name: 'position' | 'path' | 'type';
482
+ value: string;
483
+ comparison_operator: 'is' | 'is not' | 'contains' | 'not contains' | 'starts with' | 'ends with' | 'is empty' | 'is not empty';
484
+ }>;
485
+ logical_operator: 'and' | 'or';
486
+ };
487
+ score_threshold?: number;
488
+ top_k?: number;
489
+ };
490
+
467
491
  declare class OllamaProvider extends Ollama {
468
492
  }
469
493
  declare class SiliconFlowProvider extends SiliconFlow {
@@ -709,5 +733,5 @@ declare class AIConfigParser {
709
733
  };
710
734
  }
711
735
 
712
- export { AIConfigParser, AIUtils, BailianChat, BailianProvider, BaseChat, ChatProviderMap, Custom, CustomProvider, DeepSeek, DeepSeekProvider, Kevisual, KevisualProvider, Kimi, KimiProvider, KnowledgeBase, ModelScope, ModelScopeProvider, Ollama, OllamaProvider, ProviderManager, SiliconFlow, SiliconFlowKnowledge, SiliconFlowProvider, Volces, VolcesProvider, Zhipu, ZhipuProvider, decryptAES, encryptAES, readStream };
736
+ export { AIConfigParser, AIUtils, BailianChat, BailianProvider, BaseChat, CNBChat, ChatProviderMap, Custom, CustomProvider, DeepSeek, DeepSeekProvider, Kevisual, KevisualProvider, Kimi, KimiProvider, KnowledgeBase, ModelScope, ModelScopeProvider, Ollama, OllamaProvider, ProviderManager, SiliconFlow, SiliconFlowKnowledge, SiliconFlowProvider, Volces, VolcesProvider, Zhipu, ZhipuProvider, decryptAES, encryptAES, readStream };
713
737
  export type { AIConfig, AIModel, BaseChatInterface, BaseChatOptions, ChatMessage, ChatMessageComplete, ChatMessageOptions, ChatStream, EmbeddingMessage, EmbeddingMessageComplete, EmbeddingObject, GetProviderOpts, KnowledgeOptions, ProviderResult, RerankOptions, SecretKey, Usage };
@@ -19731,6 +19731,21 @@ class Kevisual extends BaseChat {
19731
19731
  }
19732
19732
  }
19733
19733
 
19734
+ // src/provider/chat-adapter/cnb.ts
19735
+ class CNBChat extends BaseChat {
19736
+ static BASE_URL = "https://api.cnb.cool/{repo}/-/ai";
19737
+ constructor(options) {
19738
+ const baseURL = CNBChat.BASE_URL.replace("{repo}", options.repo);
19739
+ super({ ...options, baseURL });
19740
+ }
19741
+ query({ repo, ...rest }) {
19742
+ const baseURL = "https://api.cnb.cool/{repo}/-/knowledge/base/query".replace("{repo}", repo);
19743
+ this.post(baseURL, {
19744
+ data: rest
19745
+ });
19746
+ }
19747
+ }
19748
+
19734
19749
  // src/provider/chat.ts
19735
19750
  class OllamaProvider extends Ollama {
19736
19751
  }
@@ -20004,6 +20019,7 @@ export {
20004
20019
  CustomProvider,
20005
20020
  Custom,
20006
20021
  ChatProviderMap,
20022
+ CNBChat,
20007
20023
  BaseChat,
20008
20024
  BailianProvider,
20009
20025
  BailianChat,
@@ -464,6 +464,30 @@ declare class Kevisual extends BaseChat {
464
464
  constructor(options: KevisualOptions);
465
465
  }
466
466
 
467
+ type CNBOptions = Partial<BaseChatOptions>;
468
+ declare class CNBChat extends BaseChat {
469
+ static BASE_URL: string;
470
+ constructor(options: CNBOptions & {
471
+ repo: string;
472
+ });
473
+ query({ repo, ...rest }: CNBQueryParam & {
474
+ repo: string;
475
+ }): void;
476
+ }
477
+ type CNBQueryParam = {
478
+ query: string;
479
+ metadata_filtering_conditions?: {
480
+ conditions: Array<{
481
+ name: 'position' | 'path' | 'type';
482
+ value: string;
483
+ comparison_operator: 'is' | 'is not' | 'contains' | 'not contains' | 'starts with' | 'ends with' | 'is empty' | 'is not empty';
484
+ }>;
485
+ logical_operator: 'and' | 'or';
486
+ };
487
+ score_threshold?: number;
488
+ top_k?: number;
489
+ };
490
+
467
491
  declare class OllamaProvider extends Ollama {
468
492
  }
469
493
  declare class SiliconFlowProvider extends SiliconFlow {
@@ -709,5 +733,5 @@ declare class AIConfigParser {
709
733
  };
710
734
  }
711
735
 
712
- export { AIConfigParser, AIUtils, BailianChat, BailianProvider, BaseChat, ChatProviderMap, Custom, CustomProvider, DeepSeek, DeepSeekProvider, Kevisual, KevisualProvider, Kimi, KimiProvider, KnowledgeBase, ModelScope, ModelScopeProvider, Ollama, OllamaProvider, ProviderManager, SiliconFlow, SiliconFlowKnowledge, SiliconFlowProvider, Volces, VolcesProvider, Zhipu, ZhipuProvider, decryptAES, encryptAES, readStream };
736
+ export { AIConfigParser, AIUtils, BailianChat, BailianProvider, BaseChat, CNBChat, ChatProviderMap, Custom, CustomProvider, DeepSeek, DeepSeekProvider, Kevisual, KevisualProvider, Kimi, KimiProvider, KnowledgeBase, ModelScope, ModelScopeProvider, Ollama, OllamaProvider, ProviderManager, SiliconFlow, SiliconFlowKnowledge, SiliconFlowProvider, Volces, VolcesProvider, Zhipu, ZhipuProvider, decryptAES, encryptAES, readStream };
713
737
  export type { AIConfig, AIModel, BaseChatInterface, BaseChatOptions, ChatMessage, ChatMessageComplete, ChatMessageOptions, ChatStream, EmbeddingMessage, EmbeddingMessageComplete, EmbeddingObject, GetProviderOpts, KnowledgeOptions, ProviderResult, RerankOptions, SecretKey, Usage };
@@ -1616,6 +1616,21 @@ class Kevisual extends BaseChat {
1616
1616
  }
1617
1617
  }
1618
1618
 
1619
+ // src/provider/chat-adapter/cnb.ts
1620
+ class CNBChat extends BaseChat {
1621
+ static BASE_URL = "https://api.cnb.cool/{repo}/-/ai";
1622
+ constructor(options) {
1623
+ const baseURL = CNBChat.BASE_URL.replace("{repo}", options.repo);
1624
+ super({ ...options, baseURL });
1625
+ }
1626
+ query({ repo, ...rest }) {
1627
+ const baseURL = "https://api.cnb.cool/{repo}/-/knowledge/base/query".replace("{repo}", repo);
1628
+ this.post(baseURL, {
1629
+ data: rest
1630
+ });
1631
+ }
1632
+ }
1633
+
1619
1634
  // src/provider/chat.ts
1620
1635
  class OllamaProvider extends Ollama {
1621
1636
  }
@@ -1889,6 +1904,7 @@ export {
1889
1904
  CustomProvider,
1890
1905
  Custom,
1891
1906
  ChatProviderMap,
1907
+ CNBChat,
1892
1908
  BaseChat,
1893
1909
  BailianProvider,
1894
1910
  BailianChat,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/ai",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "AI Center Services",
5
5
  "main": "index.js",
6
6
  "basename": "/root/ai-center-services",
@@ -53,13 +53,13 @@
53
53
  }
54
54
  },
55
55
  "devDependencies": {
56
- "@kevisual/router": "0.0.52",
57
- "@kevisual/types": "^0.0.10",
58
- "@kevisual/use-config": "^1.0.21",
59
- "@types/bun": "^1.3.5",
56
+ "@kevisual/router": "0.0.55",
57
+ "@kevisual/types": "^0.0.11",
58
+ "@kevisual/use-config": "^1.0.28",
59
+ "@types/bun": "^1.3.6",
60
60
  "@types/crypto-js": "^4.2.2",
61
61
  "@types/formidable": "^3.4.6",
62
- "@types/node": "^25.0.5",
62
+ "@types/node": "^25.0.9",
63
63
  "cross-env": "^10.1.0",
64
64
  "crypto-js": "^4.2.0",
65
65
  "dayjs": "^1.11.19",
@@ -0,0 +1,34 @@
1
+ import { BaseChat, BaseChatOptions } from '../core/chat.ts';
2
+
3
+ export type CNBOptions = Partial<BaseChatOptions>;
4
+ export class CNBChat extends BaseChat {
5
+ static BASE_URL = 'https://api.cnb.cool/{repo}/-/ai';
6
+ constructor(options: CNBOptions & { repo: string }) {
7
+ const baseURL = CNBChat.BASE_URL.replace('{repo}', options.repo);
8
+ super({ ...(options as BaseChatOptions), baseURL: baseURL });
9
+ }
10
+ query({ repo, ...rest }: CNBQueryParam & { repo: string }) {
11
+ const baseURL = 'https://api.cnb.cool/{repo}/-/knowledge/base/query'
12
+ .replace('{repo}', repo);
13
+ this.post(baseURL, {
14
+ data: rest,
15
+ });
16
+ }
17
+ }
18
+
19
+ export type CNBQueryParam = {
20
+ query: string;
21
+ metadata_filtering_conditions?: {
22
+ conditions: Array<{
23
+ // "position", "path", "type"
24
+ name: 'position' | 'path' | 'type';
25
+ value: string;
26
+ // "is", "is not", "contains", "not contains", "starts with", "ends with", "is empty", "is not empty"
27
+ comparison_operator: 'is' | 'is not' | 'contains' | 'not contains' | 'starts with' | 'ends with' | 'is empty' | 'is not empty';
28
+ }>;
29
+ // "and" 或 "or",默认 "and"
30
+ logical_operator: 'and' | 'or';
31
+ },
32
+ score_threshold?: number;
33
+ top_k?: number;
34
+ }
@@ -11,6 +11,7 @@ import { BailianChat } from './chat-adapter/dashscope.ts';
11
11
  import { Zhipu } from './chat-adapter/zhipu.ts';
12
12
  import { Kimi } from './chat-adapter/kimi.ts';
13
13
  import { Kevisual } from './chat-adapter/kevisual.ts';
14
+ import { CNBChat } from './chat-adapter/cnb.ts';
14
15
 
15
16
  import { ChatMessage } from './core/type.ts';
16
17
 
@@ -27,6 +28,7 @@ export {
27
28
  Kimi,
28
29
  ChatMessage,
29
30
  Kevisual,
31
+ CNBChat,
30
32
  }
31
33
  export class OllamaProvider extends Ollama { }
32
34
  export class SiliconFlowProvider extends SiliconFlow { }