@glodon-aiot/apis 2.4.7

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 (64) hide show
  1. package/README.git.md +73 -0
  2. package/README.lib.md +135 -0
  3. package/dist/es/aecpilot/cosntant.mjs +5 -0
  4. package/dist/es/aecpilot/index.mjs +510 -0
  5. package/dist/es/aecpilot/model.mjs +9 -0
  6. package/dist/es/aecpilotui/index.mjs +607 -0
  7. package/dist/es/agentcliui/index.mjs +418 -0
  8. package/dist/es/aishop/index.mjs +97 -0
  9. package/dist/es/aishop/model.mjs +5 -0
  10. package/dist/es/auth/index.mjs +52 -0
  11. package/dist/es/base/index.mjs +158 -0
  12. package/dist/es/contralyze/index.mjs +91 -0
  13. package/dist/es/cvforce/index.mjs +431 -0
  14. package/dist/es/cvforce/model.mjs +12 -0
  15. package/dist/es/cvforce-datahub/index.mjs +435 -0
  16. package/dist/es/cvforce-datahub/model.mjs +8 -0
  17. package/dist/es/cvforce-modelservice/index.mjs +114 -0
  18. package/dist/es/cvforce-modelservice/model.mjs +4 -0
  19. package/dist/es/index.mjs +62 -0
  20. package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
  21. package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
  22. package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
  23. package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
  24. package/dist/es/panorama/index.mjs +136 -0
  25. package/dist/es/panorama/model.mjs +5 -0
  26. package/dist/es/pluginmgr/index.mjs +85 -0
  27. package/dist/es/user/index.mjs +193 -0
  28. package/dist/es/utils/fetchEventSource/fetch.mjs +112 -0
  29. package/dist/es/utils/fetchEventSource/parse.mjs +97 -0
  30. package/dist/es/utils/index.mjs +9 -0
  31. package/dist/lib/index.js +3 -0
  32. package/dist/src/aecpilot/cosntant.d.ts +8 -0
  33. package/dist/src/aecpilot/index.d.ts +79 -0
  34. package/dist/src/aecpilot/model.d.ts +350 -0
  35. package/dist/src/aecpilotui/index.d.ts +72 -0
  36. package/dist/src/aecpilotui/model.d.ts +63 -0
  37. package/dist/src/agentcliui/index.d.ts +72 -0
  38. package/dist/src/agentcliui/model.d.ts +39 -0
  39. package/dist/src/aishop/index.d.ts +26 -0
  40. package/dist/src/aishop/model.d.ts +111 -0
  41. package/dist/src/auth/index.d.ts +17 -0
  42. package/dist/src/auth/model.d.ts +24 -0
  43. package/dist/src/base/index.d.ts +41 -0
  44. package/dist/src/base/model.d.ts +20 -0
  45. package/dist/src/contralyze/index.d.ts +24 -0
  46. package/dist/src/contralyze/model.d.ts +75 -0
  47. package/dist/src/cvforce/index.d.ts +130 -0
  48. package/dist/src/cvforce/model.d.ts +519 -0
  49. package/dist/src/cvforce-datahub/index.d.ts +186 -0
  50. package/dist/src/cvforce-datahub/model.d.ts +438 -0
  51. package/dist/src/cvforce-modelservice/index.d.ts +23 -0
  52. package/dist/src/cvforce-modelservice/model.d.ts +156 -0
  53. package/dist/src/index.d.ts +19 -0
  54. package/dist/src/panorama/index.d.ts +42 -0
  55. package/dist/src/panorama/model.d.ts +263 -0
  56. package/dist/src/pluginmgr/index.d.ts +28 -0
  57. package/dist/src/pluginmgr/model.d.ts +48 -0
  58. package/dist/src/user/index.d.ts +42 -0
  59. package/dist/src/user/model.d.ts +247 -0
  60. package/dist/src/utils/fetchEventSource/fetch.d.ts +44 -0
  61. package/dist/src/utils/fetchEventSource/index.d.ts +1 -0
  62. package/dist/src/utils/fetchEventSource/parse.d.ts +36 -0
  63. package/dist/src/utils/index.d.ts +1 -0
  64. package/package.json +88 -0
@@ -0,0 +1,72 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ApiErrorHandler, BaseApi } from '../base';
3
+ import { IApplication, ICommentParam, IAecFile as IFile, IAecFileDataParam as IFileDataParam, IFileParams, IHistory, IKnowledge, IKnowledgeFileParams, IAecPrompt as IPrompt, IAecPromptParam as IPromptParam, IPromptType, IQuestion, IAecSessionParam as ISessionParam, IAecSession as ISession, KnowledgeFileMetadata, KnowledgeFileMetadataParams } from '../aecpilot/model';
4
+ import { IBaseModel, IGeneques, IPromptVariables, ISessionPrompt, IUploadParam, IUploadTicket, MinioConfig } from './model';
5
+ export declare class AecpilotUIApi extends BaseApi {
6
+ private axiosInstance;
7
+ private getToken;
8
+ constructor(axiosInstance: AxiosInstance, getToken: () => string, errorHandler?: ApiErrorHandler);
9
+ getBaseModelInfo(serviceId: string): Promise<IBaseModel>;
10
+ postGeneques(params: {
11
+ content: string;
12
+ }): Promise<IGeneques>;
13
+ getApplicationId(id: string): Promise<IApplication>;
14
+ getApplicationIdSessions(appId: string, params?: any): Promise<ISession[]>;
15
+ postApplicationIdSession(params: ISessionParam): Promise<ISession>;
16
+ getApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
17
+ patchApplicationIdSessionsId(appId: string, id: string, params: ISessionParam): Promise<ISession>;
18
+ delApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
19
+ getApplicationIdPromptVariables(appId: string, params?: {
20
+ status: number;
21
+ }): Promise<IPromptVariables[]>;
22
+ getApplicationIdSessionIdPromptVariables(appId: string, sessionId: string): Promise<ISessionPrompt[]>;
23
+ patchApplicationIdSessionpromptVariablesId(appId: string, sid: string, id: string, params: Partial<ISessionPrompt>): Promise<IPrompt[]>;
24
+ deleteSessionKnowledgeFiles(sessionId: string, params: {
25
+ files: IFileParams[];
26
+ }): Promise<any>;
27
+ getRecommendQues(appId: string): Promise<IQuestion[]>;
28
+ postRecommendQues(appId: string, params: IQuestion): Promise<unknown>;
29
+ delRecommendQues(appId: string, id: string): Promise<unknown>;
30
+ getChatHistorySessionId(appId: string, sessionId: string): Promise<IHistory[]>;
31
+ postPrompts(appId: string, params: IPromptParam): Promise<{
32
+ id: string;
33
+ }>;
34
+ listPrompt(appId: string, params?: {
35
+ title?: string;
36
+ type?: IPromptType;
37
+ }): Promise<IPrompt[]>;
38
+ getPrompt(appId: string, id: string): Promise<IPrompt>;
39
+ updatePrompt(appId: string, id: string, params: IPromptParam): Promise<string>;
40
+ deletePrompt(appId: string, id: string): Promise<string>;
41
+ patchApplicationIdSessionsIdContext(id: string, sid: string): Promise<unknown>;
42
+ getApplicationIdSessionKnowledgeFiles(appId: string, sessionId: string, params?: {
43
+ enabled: number;
44
+ }): Promise<KnowledgeFileMetadata[]>;
45
+ postApplicationIdSessionKnowledgeFile(appId: string, sessionId: string, params: KnowledgeFileMetadataParams): Promise<string>;
46
+ postApplicationIdSessionKnowledgeSessionFile(appId: string, sessionId: string, params: KnowledgeFileMetadataParams): Promise<string>;
47
+ delApplicationIdSessionKnowledgeFile(appId: string, sessionId: string, params: {
48
+ files: IFileParams[];
49
+ }): Promise<any>;
50
+ getApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string, params?: any, errInvisable?: boolean): Promise<KnowledgeFileMetadata>;
51
+ delApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string): Promise<string>;
52
+ patchApplicationIdKnowledgeIdFileId(appId: string, sessionId: string, fid: string, params: IKnowledgeFileParams): Promise<IFile>;
53
+ checkFileReady(appId: string, sessionId: string, fileId?: string, shouldContinueFunc?: () => boolean, interval?: number, upateFileFn?: any): Promise<KnowledgeFileMetadata | null>;
54
+ uploadFile(path: string, file: File): Promise<string>;
55
+ postUploadTicket(params: IUploadParam): Promise<IUploadTicket>;
56
+ uploadMinioFile(minioConfig: MinioConfig, file: File): Promise<string>;
57
+ postComments(id: string, sid: string, params: ICommentParam): Promise<unknown>;
58
+ getKnowledgeId(id: string): Promise<IKnowledge>;
59
+ getKnowledgeIdFileId(id: string, fid: string): Promise<IFile>;
60
+ getKnowledgeIdFileIdData(id: string, fid: string, did: string): Promise<IFileDataParam[]>;
61
+ postChatV2EventSource(appId: string, sessionId: string, params: any, signal: AbortSignal, options: {
62
+ onopen?: any;
63
+ onmessage?: any;
64
+ onerror?: any;
65
+ onclose?: any;
66
+ }): Promise<void>;
67
+ postChat(params: any, query: {
68
+ sessionId: string;
69
+ geneQues: boolean;
70
+ applicationId: string;
71
+ }): Promise<IHistory>;
72
+ }
@@ -0,0 +1,63 @@
1
+ export interface IFileData {
2
+ key: string;
3
+ name: string;
4
+ values: {
5
+ keyhwdSyyIdCode: string;
6
+ content: string;
7
+ did: string;
8
+ enabled: number;
9
+ }[];
10
+ }
11
+ export interface IBaseModel {
12
+ id: string;
13
+ name: string;
14
+ baseModelName: string;
15
+ maxModelLength: number;
16
+ }
17
+ export interface IUploadTicket {
18
+ minio: {
19
+ accessKey: string;
20
+ secretKey: string;
21
+ bucket: string;
22
+ expiredAt: number;
23
+ prefix: string;
24
+ endpoints: string[];
25
+ region: string;
26
+ useSSL: boolean;
27
+ fileKeys: string[];
28
+ };
29
+ }
30
+ export interface IUploadParam {
31
+ files: string[];
32
+ isv: string;
33
+ knowledgeId: string;
34
+ }
35
+ export interface MinioConfig {
36
+ accessKey: string;
37
+ secretKey: string;
38
+ bucket: string;
39
+ expiredAt: number;
40
+ prefix: string;
41
+ endpoints: string[];
42
+ region: string;
43
+ useSSL: boolean;
44
+ fileKeys: string[];
45
+ }
46
+ export interface IPromptVariables {
47
+ id: string;
48
+ key: string;
49
+ name: string;
50
+ status?: number;
51
+ }
52
+ export interface ISessionPrompt {
53
+ id: string;
54
+ key: string;
55
+ name: string;
56
+ value: string;
57
+ }
58
+ export interface IGeneques {
59
+ content: string;
60
+ llmModel: string;
61
+ messageId: string;
62
+ messageTime: string;
63
+ }
@@ -0,0 +1,72 @@
1
+ import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
+ import { ApiErrorHandler, BaseApi } from '../base';
3
+ import { IApplication, ICommentParam, IAecFile as IFile, IAecFileDataParam as IFileDataParam, IHistory, IKnowledge, IAecPrompt as IPrompt, IAecPromptParam as IPromptParam, IPromptType, IQuestion, IAecSessionParam as ISessionParam, IAecSession as ISession, KnowledgeFileMetadata, KnowledgeFileMetadataParams, IFileParams, IKnowledgeFileParams } from '../aecpilot/model';
4
+ import { IBaseModel, IUploadParam, IUploadTicket, MinioConfig } from './model';
5
+ import { IGeneques, IPromptVariables, ISessionPrompt } from '../aecpilotui/model';
6
+ export declare class AgentClientUIApi extends BaseApi {
7
+ private axiosInstance;
8
+ private getToken;
9
+ constructor(axiosInstance: AxiosInstance, getToken: () => string, errorHandler?: ApiErrorHandler);
10
+ getApplicationIdSessions(appId: string): Promise<ISession[]>;
11
+ getApplicationId(id: string): Promise<IApplication>;
12
+ postApplicationIdSession(params: ISessionParam): Promise<ISession>;
13
+ getApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
14
+ patchApplicationIdSessionsId(appId: string, id: string, params: ISessionParam): Promise<ISession>;
15
+ patchApplicationIdSessionsIdContext(id: string, sid: string): Promise<unknown>;
16
+ delApplicationIdSessionsId(appId: string, id: string): Promise<ISession>;
17
+ postComments(id: string, sid: string, params: ICommentParam): Promise<unknown>;
18
+ getChatHistorySessionId(appId: string, sessionId: string): Promise<IHistory[]>;
19
+ postChatV2EventSource(applicationId: string, sessionId: string, params: any, signal: AbortSignal, options: {
20
+ onopen?: any;
21
+ onmessage?: any;
22
+ onerror?: any;
23
+ onclose?: any;
24
+ }, onAppStatusError?: (error: any) => void): Promise<void>;
25
+ getKnowledgeIdFileIdData(id: string, fid: string, did: string): Promise<IFileDataParam[]>;
26
+ getKnowledgeIdFileId(id: string, fid: string): Promise<IFile>;
27
+ getKnowledgeId(id: string): Promise<IKnowledge>;
28
+ getSessionKnowledgeFile(sessionId: string, fileId: string): Promise<KnowledgeFileMetadata>;
29
+ sleep(ms: number): Promise<unknown>;
30
+ getBaseModelInfo(serviceId: string): Promise<IBaseModel>;
31
+ uploadFiles(path: string, files: File[]): Promise<string[]>;
32
+ postFile(path: string, file: File, type?: number): Promise<string>;
33
+ postTicket(params: IUploadParam): Promise<IUploadTicket>;
34
+ uploadFile(path: string, file: File): Promise<string>;
35
+ uploadMinioFile(minioConfig: MinioConfig, file: File): Promise<string>;
36
+ getRecommendQues(appId: string): Promise<IQuestion[]>;
37
+ postPrompts(appId: string, params: IPromptParam): Promise<{
38
+ id: string;
39
+ }>;
40
+ listPrompt(appId: string, params?: {
41
+ title?: string;
42
+ type?: IPromptType;
43
+ }): Promise<IPrompt[]>;
44
+ getPrompt(appId: string, id: string): Promise<IPrompt>;
45
+ updatePrompt(appId: string, id: string, params: IPromptParam): Promise<string>;
46
+ deletePrompt(appId: string, id: string): Promise<string>;
47
+ postGeneques(params: {
48
+ content: string;
49
+ }, config?: AxiosRequestConfig): Promise<IGeneques>;
50
+ getApplicationIdSessionKnowledgeFiles(appId: string, sessionId: string, params?: {
51
+ enabled: number;
52
+ }): Promise<KnowledgeFileMetadata[]>;
53
+ checkFileReady(appId: string, sessionId: string, fileId?: string, shouldContinueFunc?: () => boolean, interval?: number, upateFileFn?: any): Promise<KnowledgeFileMetadata | null>;
54
+ getApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string, params?: any, errInvisable?: boolean): Promise<KnowledgeFileMetadata>;
55
+ delApplicationIdSessionKnowledgeFileId(appId: string, sessionId: string, fileId: string): Promise<string>;
56
+ postApplicationIdSessionKnowledgeSessionFile(appId: string, sessionId: string, data: KnowledgeFileMetadataParams, params?: any, config?: AxiosRequestConfig): Promise<string>;
57
+ delApplicationIdSessionKnowledgeFile(appId: string, sessionId: string, params: {
58
+ files: IFileParams[];
59
+ }): Promise<any>;
60
+ deleteSessionKnowledgeFiles(sessionId: string, params: {
61
+ files: IFileParams[];
62
+ }): Promise<any>;
63
+ patchApplicationIdKnowledgeIdFileId(appId: string, sessionId: string, fid: string, params: IKnowledgeFileParams): Promise<IFile>;
64
+ getApplicationIdSessionIdPromptVariables(appId: string, sessionId: string): Promise<ISessionPrompt[]>;
65
+ getApplicationIdPromptVariables(appId: string, params?: {
66
+ status: number;
67
+ }): Promise<IPromptVariables[]>;
68
+ patchApplicationIdSessionpromptVariablesId(appId: string, sid: string, id: string, params: Partial<ISessionPrompt>): Promise<IPrompt[]>;
69
+ updateSession(appId: any, sid: string, params: ISessionParam): Promise<string>;
70
+ getSession(appId: string, sid: string): Promise<ISession>;
71
+ }
72
+ export * from './model';
@@ -0,0 +1,39 @@
1
+ export interface IBaseModel {
2
+ id: string;
3
+ name: string;
4
+ baseModelName: string;
5
+ maxModelLength: number;
6
+ }
7
+ export interface IUploadTicket {
8
+ minio: {
9
+ accessKey: string;
10
+ secretKey: string;
11
+ bucket: string;
12
+ expiredAt: number;
13
+ prefix: string;
14
+ endpoints: string[];
15
+ region: string;
16
+ useSSL: boolean;
17
+ fileKeys: string[];
18
+ };
19
+ }
20
+ export interface IUploadParam {
21
+ files: string[];
22
+ isv: string;
23
+ knowledgeId: string;
24
+ }
25
+ export interface MinioConfig {
26
+ accessKey: string;
27
+ secretKey: string;
28
+ bucket: string;
29
+ expiredAt: number;
30
+ prefix: string;
31
+ endpoints: string[];
32
+ region: string;
33
+ useSSL: boolean;
34
+ fileKeys: string[];
35
+ }
36
+ export interface ISessionParams {
37
+ name?: string;
38
+ netOpen?: number;
39
+ }
@@ -0,0 +1,26 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { OCRMinioParams, OCRResult, IChatCompletion, DetectionParam, IDetectionResult, OCRPvcBatchParams, OCRBatchResult, IEmbedding } from './model';
3
+ import { ApiErrorHandler, BaseApi } from '../base';
4
+ import { IBaseModel } from '../aecpilotui/model';
5
+ export declare class AIShopApi extends BaseApi {
6
+ constructor(axiosInstance?: AxiosInstance, errorHandler?: ApiErrorHandler);
7
+ ocr(serviceId: string, params: OCRMinioParams): Promise<{
8
+ box: [x: number, y: number][];
9
+ }[]>;
10
+ convertToBatchParams(params: OCRMinioParams): {
11
+ pages: {
12
+ image: string | undefined;
13
+ }[];
14
+ };
15
+ convertToMinioResult(batchResult: OCRBatchResult): {
16
+ box: [x: number, y: number][];
17
+ }[];
18
+ ocrMinio(serviceId: string, params: OCRMinioParams): Promise<OCRResult[]>;
19
+ ocrPvcBatch(serviceId: string, params: OCRPvcBatchParams): Promise<OCRBatchResult>;
20
+ getSleep(second: number): Promise<unknown>;
21
+ postChatCompletions(param: IChatCompletion): Promise<any>;
22
+ detection(serviceId: string, params: DetectionParam): Promise<IDetectionResult>;
23
+ getBaseModel(serviceId: string): Promise<IBaseModel>;
24
+ postEmbeddings(params: IEmbedding): Promise<any>;
25
+ }
26
+ export * from './model';
@@ -0,0 +1,111 @@
1
+ export declare enum OCRServiceId {
2
+ common = "A100",
3
+ idcard = "A104",
4
+ bankcard = "A108",
5
+ page = "A112",
6
+ rmwatermark = "A115",
7
+ seal = "A116",
8
+ rmseal = "A117",
9
+ table = "A118"
10
+ }
11
+ export interface OCRMinioParams {
12
+ image?: string;
13
+ url?: string;
14
+ options?: {
15
+ use_rotate: boolean;
16
+ };
17
+ modelStore?: number;
18
+ }
19
+ export interface OCRPvcBatchParams {
20
+ confThres?: number;
21
+ pages: IPageList[];
22
+ modelStore?: number;
23
+ }
24
+ export interface IPageList {
25
+ pagNo?: number;
26
+ image?: string;
27
+ textItems?: IBbox[];
28
+ }
29
+ export interface IBbox {
30
+ bbox: [x: number, y: number][];
31
+ }
32
+ export interface OCRResult {
33
+ words?: string;
34
+ confidence?: number;
35
+ box: [x: number, y: number][];
36
+ type?: string;
37
+ catagoryId?: string;
38
+ }
39
+ export interface OCRBatchResult {
40
+ pages: IPageList[];
41
+ }
42
+ export interface DetectionParam {
43
+ instances: [{
44
+ image: {
45
+ b64: string;
46
+ };
47
+ }];
48
+ }
49
+ export interface IDetectionResult {
50
+ prediction: IPrediction[];
51
+ }
52
+ export interface IPrediction {
53
+ box: [x: number, y: number][];
54
+ label: string;
55
+ score: number;
56
+ }
57
+ export declare enum IChatRole {
58
+ User = "user",
59
+ Assistant = "assistant",
60
+ System = "system"
61
+ }
62
+ export interface IChatHistory {
63
+ role: string;
64
+ content: any;
65
+ created?: number;
66
+ isLoading?: boolean;
67
+ reasoningContent?: string;
68
+ state?: string;
69
+ }
70
+ export interface IChatCompletion {
71
+ model: string;
72
+ messages: IChatHistory[];
73
+ stream?: boolean;
74
+ temperature: number;
75
+ max_tokens?: number;
76
+ top_p?: number;
77
+ top_k?: number;
78
+ repetition_penalty?: number;
79
+ }
80
+ export interface IChatResult {
81
+ model: string;
82
+ choices: {
83
+ index: number;
84
+ message: IChatHistory;
85
+ finish_reason: string;
86
+ }[];
87
+ created?: number;
88
+ usage: {
89
+ prompt_tokens: number;
90
+ completion_tokens: number;
91
+ total_tokens: number;
92
+ };
93
+ }
94
+ export interface IEmbedding {
95
+ input: string[];
96
+ model: string;
97
+ }
98
+ export interface IEmbeddingResult {
99
+ data: {
100
+ embeddings: number[];
101
+ index: number;
102
+ object: string;
103
+ }[];
104
+ model: string;
105
+ object: string;
106
+ score_weight: number;
107
+ usage: {
108
+ prompt_tokens: number;
109
+ total_tokens: number;
110
+ };
111
+ }
@@ -0,0 +1,17 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ApiErrorHandler, BaseApi } from '../base';
3
+ import { LoginInfo, TRefreshToken } from './model';
4
+ export declare class AuthApi extends BaseApi {
5
+ constructor(axiosInstance?: AxiosInstance, errorHandler?: ApiErrorHandler);
6
+ getLoginUrl(): Promise<LoginInfo[]>;
7
+ getToken(url: string, params: any): Promise<string | {
8
+ accessToken: string;
9
+ otherToken: string;
10
+ }>;
11
+ getAIoTTokenByGTeamToken(params: {
12
+ accessToken: string;
13
+ productCode: string;
14
+ tenantCode: string;
15
+ }): Promise<string>;
16
+ postRefreshToken(oldToken: string, tenant: string, orgId?: string, expired?: string, product?: string): Promise<TRefreshToken>;
17
+ }
@@ -0,0 +1,24 @@
1
+ import { ITenant } from '../user/model';
2
+ export interface User {
3
+ id?: string;
4
+ username?: string;
5
+ password?: string;
6
+ token?: string;
7
+ tenant?: ITenant;
8
+ exp?: number;
9
+ ten?: string;
10
+ ro?: string;
11
+ uid?: string;
12
+ oid?: string;
13
+ }
14
+ export interface LoginInfo {
15
+ code: string;
16
+ name: string;
17
+ loginUrl: string;
18
+ logoutUrl: string;
19
+ checkTicketPath: string;
20
+ callbackUrl: string;
21
+ }
22
+ export interface TRefreshToken {
23
+ token: string;
24
+ }
@@ -0,0 +1,41 @@
1
+ import { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
2
+ import { AppResponse, Paged } from './model';
3
+ export declare class BaseApi {
4
+ private axios;
5
+ private errorHandler?;
6
+ constructor(axios: AxiosInstance, errorHandler?: ApiErrorHandler | undefined);
7
+ get<T>(path: string, params?: any, errInvisable?: boolean): Promise<T>;
8
+ listPaged<T>(path: string, params?: any): Promise<Paged<T>>;
9
+ list<T>(path: string, params?: any): Promise<T>;
10
+ delete<T>(path: string, params?: any): Promise<T>;
11
+ post<T>(path: string, data: any, params?: any, config?: AxiosRequestConfig): Promise<T>;
12
+ postForm<T>(path: string, formData: FormData, params?: any): Promise<T>;
13
+ patch<T>(path: string, data: any, params?: any): Promise<T>;
14
+ put<T>(path: string, data: any): Promise<T>;
15
+ upload<T>(path: string, data: any, config?: AxiosRequestConfig): Promise<T>;
16
+ getNonStandard<T>(path: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T, any> | undefined>;
17
+ postNonStandard(path: string, data: any, params?: any, config?: AxiosRequestConfig): Promise<any>;
18
+ handleResponse<T>(response: Promise<AxiosResponse<AppResponse<T>>>, errInvisable?: boolean): Promise<T>;
19
+ handleAppError<T>(response: AppResponse<T>, errInvisable?: boolean): AppResponse<T>;
20
+ handleError(error: AxiosError): Error;
21
+ }
22
+ export interface ApiErrorHandler {
23
+ onNetworkError?(): void;
24
+ onHttpStatusError?(status: number, message: string, response: AxiosResponse): void;
25
+ onAppStatusError?(status: number, message: string, errInvisable?: boolean): void;
26
+ }
27
+ /***
28
+ * 判断是否需要修改message的错误
29
+ * 不应该让用户看到的报错信息应包含在 10002 - 10012 区间。
30
+ * @param {number} status api error code
31
+ * @returns {boolean} 是否为需要修改的 error
32
+ */
33
+ export declare const needPrettifyMsg: (status: number) => boolean;
34
+ /**
35
+ * 优化message可读性
36
+ * @param {number} status api error code
37
+ * @param {string} message 原始的 api error message
38
+ * @returns {string} 优化后的 message
39
+ */
40
+ export declare const prettifyMsg: (status: number, message?: string) => string;
41
+ export * from './model';
@@ -0,0 +1,20 @@
1
+ export interface AppResponse<T> {
2
+ code: number;
3
+ message: string;
4
+ data: T;
5
+ }
6
+ export interface Paged<T> {
7
+ pageNo: number;
8
+ pageSize: number;
9
+ numResults: number;
10
+ totalResults: number;
11
+ recordList: T[];
12
+ }
13
+ export interface PageQueryParams {
14
+ pageNo: number;
15
+ pageSize: number;
16
+ search?: string;
17
+ }
18
+ export interface CreateDataResponse {
19
+ id: string;
20
+ }
@@ -0,0 +1,24 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ApiErrorHandler, BaseApi } from '../base';
3
+ import { Task, File, FileList, WorkflowExecution, IUploadParam, IUploadTicket } from './model';
4
+ export declare class ContralyzeApi extends BaseApi {
5
+ constructor(axiosInstance?: AxiosInstance, errorHandler?: ApiErrorHandler);
6
+ listTasks(params?: {
7
+ status?: string;
8
+ }): Promise<Task[]>;
9
+ createTask(params: Task): Promise<Task>;
10
+ getTask(id: string): Promise<Task>;
11
+ updateTask(id: string, params: Partial<Task>): Promise<Task>;
12
+ deleteTask(id: string): Promise<unknown>;
13
+ listTaskFiles(taskId: string): Promise<FileList>;
14
+ uploadTaskFile(taskId: string, file: File): Promise<File>;
15
+ listWorkflowExecutions(params?: {
16
+ status?: string;
17
+ }): Promise<WorkflowExecution[]>;
18
+ getWorkflowExecution(id: string): Promise<WorkflowExecution>;
19
+ startWorkflowExecution(params: WorkflowExecution): Promise<WorkflowExecution>;
20
+ updateWorkflowExecution(id: string, params: Partial<WorkflowExecution>): Promise<WorkflowExecution>;
21
+ cancelWorkflowExecution(id: string): Promise<unknown>;
22
+ getUploadTicket(params: IUploadParam): Promise<IUploadTicket>;
23
+ }
24
+ export * from './model';
@@ -0,0 +1,75 @@
1
+ export interface Task {
2
+ id: number;
3
+ name: string;
4
+ description: string;
5
+ status: string;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ creator: string;
9
+ updator: string;
10
+ sessionId: string;
11
+ applicationId: string;
12
+ knowledgeId: number;
13
+ workflowId: number;
14
+ }
15
+ export interface File {
16
+ id: number;
17
+ name: string;
18
+ size: number;
19
+ fileUrl: string;
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ creator: string;
23
+ updator: string;
24
+ rawFileUrl: string;
25
+ rawFileName: string;
26
+ analysisTaskId: number;
27
+ knowledgeId: number;
28
+ knowledgeFileId: number;
29
+ }
30
+ export type FileList = File[];
31
+ export interface WorkflowExecution {
32
+ id: number;
33
+ version: number;
34
+ type: 'InfoExtraction' | 'RiskReview';
35
+ workflowId: string;
36
+ analysisTaskId: number;
37
+ status: 'pending' | 'running' | 'completed' | 'failed';
38
+ progress: Record<string, any>;
39
+ inputParams: Record<string, any>;
40
+ outputResults: Record<string, any>;
41
+ errorDetails: string;
42
+ retryCount: number;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ creator: string;
46
+ }
47
+ export interface IUploadParam {
48
+ files: string[];
49
+ isv: string;
50
+ knowledgeId: string;
51
+ }
52
+ export interface MinioConfig {
53
+ accessKey: string;
54
+ secretKey: string;
55
+ bucket: string;
56
+ expiredAt: number;
57
+ prefix: string;
58
+ endpoints: string[];
59
+ region: string;
60
+ useSSL: boolean;
61
+ fileKeys: string[];
62
+ }
63
+ export interface IUploadTicket {
64
+ minio: {
65
+ accessKey: string;
66
+ secretKey: string;
67
+ bucket: string;
68
+ expiredAt: number;
69
+ prefix: string;
70
+ endpoints: string[];
71
+ region: string;
72
+ useSSL: boolean;
73
+ fileKeys: string[];
74
+ };
75
+ }