@blueking/ai-ui-sdk 0.0.14 → 0.0.15-beta.2

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 (55) hide show
  1. package/dist/common/chart-helper.d.ts +1 -1
  2. package/dist/common/chart-helper.js +173 -0
  3. package/dist/common/util.d.ts +21 -0
  4. package/dist/common/util.js +143 -0
  5. package/dist/css/fonts/iconcool.eot +0 -0
  6. package/dist/css/fonts/iconcool.svg +53 -0
  7. package/dist/css/fonts/iconcool.ttf +0 -0
  8. package/dist/css/fonts/iconcool.woff +0 -0
  9. package/dist/css/iconcool.js +10 -0
  10. package/dist/css/style.css +43 -0
  11. package/dist/event/index.d.ts +4 -0
  12. package/dist/event/index.js +17 -0
  13. package/dist/hooks/use-chat.d.ts +843 -18
  14. package/dist/hooks/use-chat.js +533 -0
  15. package/dist/hooks/use-click-proxy.js +77 -0
  16. package/dist/hooks/use-http.d.ts +15 -0
  17. package/dist/hooks/use-http.js +48 -0
  18. package/dist/hooks/use-reference-doc.d.ts +1 -1
  19. package/dist/hooks/use-reference-doc.js +185 -0
  20. package/dist/hooks/use-style.js +11 -0
  21. package/dist/hooks/use-summary.d.ts +1 -1
  22. package/dist/hooks/use-summary.js +55 -0
  23. package/dist/hooks/use-think.js +135 -0
  24. package/dist/http/fetch/error-interceptor.d.ts +3 -0
  25. package/dist/http/fetch/error-interceptor.js +7 -0
  26. package/dist/http/fetch/index.d.ts +25 -0
  27. package/dist/http/fetch/index.js +182 -0
  28. package/dist/http/fetch/request-error.d.ts +6 -0
  29. package/dist/http/fetch/request-error.js +25 -0
  30. package/dist/http/fetch/success-interceptor.d.ts +3 -0
  31. package/dist/http/fetch/success-interceptor.js +92 -0
  32. package/dist/http/helper/knowledge.d.ts +43 -0
  33. package/dist/http/helper/knowledge.js +227 -0
  34. package/dist/http/helper/permission.d.ts +7 -0
  35. package/dist/http/helper/permission.js +28 -0
  36. package/dist/http/helper/session.d.ts +31 -0
  37. package/dist/http/helper/session.js +147 -0
  38. package/dist/http/helper/tool.d.ts +13 -0
  39. package/dist/http/helper/tool.js +49 -0
  40. package/dist/main.d.ts +13 -2
  41. package/dist/main.js +24 -239
  42. package/dist/types/enum.d.ts +39 -0
  43. package/dist/types/enum.js +105 -0
  44. package/dist/types/file.d.ts +13 -0
  45. package/dist/types/file.js +1 -0
  46. package/dist/types/knowledge.d.ts +133 -0
  47. package/dist/types/knowledge.js +1 -0
  48. package/dist/types/permission.d.ts +48 -0
  49. package/dist/types/permission.js +1 -0
  50. package/dist/types/{type.d.ts → session.d.ts} +84 -23
  51. package/dist/types/session.js +1 -0
  52. package/dist/types/tool.d.ts +60 -0
  53. package/dist/types/tool.js +1 -0
  54. package/package.json +3 -3
  55. package/dist/common/type-transform.d.ts +0 -7
@@ -0,0 +1,48 @@
1
+ export interface IResourcePermissionApi {
2
+ access_model?: boolean;
3
+ access_model_strategy?: boolean;
4
+ view_space?: boolean;
5
+ manage_space?: boolean;
6
+ view_agent?: boolean;
7
+ create_agent?: boolean;
8
+ manage_agent?: boolean;
9
+ view_prompt?: boolean;
10
+ create_prompt?: boolean;
11
+ manage_prompt?: boolean;
12
+ view_collection?: boolean;
13
+ create_collection?: boolean;
14
+ manage_collection?: boolean;
15
+ view_tool?: boolean;
16
+ create_tool?: boolean;
17
+ manage_tool?: boolean;
18
+ view_knowledgebase?: boolean;
19
+ create_knowledgebase?: boolean;
20
+ manage_knowledgebase?: boolean;
21
+ view_query_template?: boolean;
22
+ create_query_template?: boolean;
23
+ manage_query_template?: boolean;
24
+ }
25
+ export interface IResourcePermission {
26
+ accessModel?: boolean;
27
+ accessModelStrategy?: boolean;
28
+ viewSpace?: boolean;
29
+ manageSpace?: boolean;
30
+ viewAgent?: boolean;
31
+ createAgent?: boolean;
32
+ manageAgent?: boolean;
33
+ viewPrompt?: boolean;
34
+ createPrompt?: boolean;
35
+ managePrompt?: boolean;
36
+ viewCollection?: boolean;
37
+ createCollection?: boolean;
38
+ manageCollection?: boolean;
39
+ viewTool?: boolean;
40
+ createTool?: boolean;
41
+ manageTool?: boolean;
42
+ viewKnowledgebase?: boolean;
43
+ createKnowledgebase?: boolean;
44
+ manageKnowledgebase?: boolean;
45
+ viewQueryTemplate?: boolean;
46
+ createQueryTemplate?: boolean;
47
+ manageQueryTemplate?: boolean;
48
+ }
@@ -0,0 +1 @@
1
+ export { };
@@ -1,27 +1,36 @@
1
- import { SessionContentRole, SessionPromptRole, SessionContentStatus } from './enum';
2
- export type Document = {
3
- metadata: {
4
- file_path: string;
5
- path: string;
6
- preview_path: string;
7
- display_name: string;
8
- };
9
- };
10
- export interface ISession<IVariable = object, ISessionProperty = object, ITool = object, IAnchorPathResources = object> {
11
- sessionCode: string;
12
- sessionName: string;
13
- model: string;
14
- roleInfo?: {
15
- collectionId: number;
16
- collectionName: string;
17
- content: ISessionPrompt[];
18
- variables: IVariable[];
1
+ import type { ITool, IToolApi } from './tool';
2
+ import type { IKnowledge, IKnowledgeApi, IKnowledgebase, IKnowledgebaseApi } from './knowledge';
3
+ import { SessionContentRole, SessionContentStatus, SessionPromptRole } from './enum';
4
+ export interface IAnchorPathResources {
5
+ knowledges?: IKnowledge[];
6
+ knowledgebases?: IKnowledgebase[];
7
+ knowledgeFolders?: IKnowledgebase[];
8
+ }
9
+ export interface ISessionContentApi {
10
+ id?: number;
11
+ created_at?: string;
12
+ created_by?: string;
13
+ updated_at?: string;
14
+ updated_by?: string;
15
+ space_id?: string;
16
+ liked?: boolean;
17
+ role: SessionContentRole;
18
+ content: string;
19
+ rate?: number;
20
+ status?: SessionContentStatus;
21
+ session_code: string;
22
+ property?: {
23
+ extra?: {
24
+ tools?: IToolApi[];
25
+ anchor_path_resources?: {
26
+ knowledges?: IKnowledgeApi[];
27
+ knowledgebases?: IKnowledgebaseApi[];
28
+ knowledge_folders?: IKnowledgeApi[];
29
+ };
30
+ };
19
31
  };
20
- sessionProperty?: ISessionProperty;
21
- tools?: ITool[];
22
- anchorPathResources?: IAnchorPathResources;
23
32
  }
24
- export interface ISessionContent<ITool = object, IAnchorPathResources = object> {
33
+ export interface ISessionContent {
25
34
  id?: number;
26
35
  createdAt?: string;
27
36
  createdBy?: string;
@@ -47,6 +56,58 @@ export interface ISessionPrompt {
47
56
  content: string;
48
57
  role: SessionPromptRole;
49
58
  }
59
+ export interface ISessionApi {
60
+ session_code: string;
61
+ session_name: string;
62
+ model: string;
63
+ role_info?: {
64
+ collection_id: number;
65
+ collection_name: string;
66
+ content: ISessionPrompt[];
67
+ variables: {
68
+ name: string;
69
+ value: string;
70
+ }[];
71
+ };
72
+ session_property: {
73
+ is_auto_clear?: boolean;
74
+ is_auto_clac_prompt?: boolean;
75
+ };
76
+ tools?: IToolApi[];
77
+ anchor_path_resources?: {
78
+ knowledges: IKnowledgeApi[];
79
+ knowledgebases: IKnowledgebaseApi[];
80
+ knowledge_folders: IKnowledgeApi[];
81
+ };
82
+ }
83
+ export interface ISession {
84
+ sessionCode: string;
85
+ sessionName: string;
86
+ model: string;
87
+ roleInfo?: {
88
+ collectionId: number;
89
+ collectionName: string;
90
+ content: ISessionPrompt[];
91
+ variables: {
92
+ name: string;
93
+ value: string;
94
+ }[];
95
+ };
96
+ sessionProperty?: {
97
+ isAutoClear?: boolean;
98
+ isAutoCalcPrompt?: boolean;
99
+ };
100
+ tools?: ITool[];
101
+ anchorPathResources?: IAnchorPathResources;
102
+ }
103
+ export type Document = {
104
+ metadata: {
105
+ file_path: string;
106
+ path: string;
107
+ preview_path: string;
108
+ display_name: string;
109
+ };
110
+ };
50
111
  export interface ChatCallbacks<T extends ISessionContent = ISessionContent> {
51
112
  handleStart?: (sessionCode: string, sessionContent: T) => void;
52
113
  handleText?: (sessionCode: string, sessionContent: T) => void;
@@ -54,7 +115,7 @@ export interface ChatCallbacks<T extends ISessionContent = ISessionContent> {
54
115
  handleThink?: (sessionCode: string, sessionContent: T) => void;
55
116
  handleEnd?: (sessionCode: string, sessionContent: T) => void;
56
117
  handleError?: (sessionCode: string, sessionContent: T, code: string | undefined) => void;
57
- requestOptions?: {
118
+ requestOptions: {
58
119
  url: string;
59
120
  headers?: Record<string, string>;
60
121
  };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,60 @@
1
+ import { ApiValueType, EnumCharacter } from './enum';
2
+ import type { IResourcePermission, IResourcePermissionApi } from './permission';
3
+ export interface IToolRule {
4
+ func: string;
5
+ message: string;
6
+ value: string;
7
+ }
8
+ export interface IToolParam {
9
+ name: string;
10
+ required: boolean;
11
+ type: ApiValueType;
12
+ default: string | number | boolean;
13
+ description: string;
14
+ validate: {
15
+ enable: boolean;
16
+ rules: IToolRule[];
17
+ };
18
+ }
19
+ export interface IToolApi {
20
+ property: {
21
+ header: IToolParam[];
22
+ query?: IToolParam[];
23
+ body?: IToolParam[];
24
+ };
25
+ space_id?: string;
26
+ created_by: string;
27
+ created_at: string;
28
+ updated_at: string;
29
+ tool_code: string;
30
+ tool_name: string;
31
+ icon: string;
32
+ description: string;
33
+ method: string;
34
+ url: string;
35
+ generate_type: EnumCharacter;
36
+ tool_id?: number;
37
+ status?: string;
38
+ is_sensitive?: boolean;
39
+ permission?: IResourcePermissionApi;
40
+ }
41
+ export interface ITool {
42
+ spaceId?: string;
43
+ header: IToolParam[];
44
+ query?: IToolParam[];
45
+ body?: IToolParam[];
46
+ creator: string;
47
+ createTime: string;
48
+ updateTime: string;
49
+ toolCode: string;
50
+ toolName: string;
51
+ icon: string;
52
+ description: string;
53
+ method: string;
54
+ url: string;
55
+ generateType: EnumCharacter;
56
+ id?: number;
57
+ status?: string;
58
+ isSensitive?: boolean;
59
+ permission?: IResourcePermission;
60
+ }
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@blueking/ai-ui-sdk",
3
- "version": "0.0.14",
3
+ "version": "0.0.15-beta.2",
4
4
  "description": "蓝鲸AI UI SDK",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
7
7
  "scripts": {
8
- "build": "bk-cli-service-webpack build && tsc --emitDeclarationOnly"
8
+ "build": "bk-cli-service build && tsc --emitDeclarationOnly"
9
9
  },
10
10
  "files": [
11
11
  "dist"
@@ -14,7 +14,7 @@
14
14
  "author": "",
15
15
  "license": "ISC",
16
16
  "dependencies": {
17
- "@blueking/cli-service-webpack": "0.0.7-beta.1",
17
+ "@blueking/cli-service": "0.1.0-beta.5",
18
18
  "bkui-vue": "^2.0.1-beta.100",
19
19
  "vue": "^3.5.13"
20
20
  },
@@ -1,7 +0,0 @@
1
- import type { ISessionContent, ISessionPrompt } from '../types/type';
2
- /**
3
- * 将 sessionContent 转换为 sessionPrompt
4
- * @param sessionContent sessionContent
5
- * @returns sessionPrompt
6
- */
7
- export declare const transferSessionContent2SessionPrompt: (sessionContent: ISessionContent) => ISessionPrompt;