zyjj-web-sdk 1.0.1 → 1.0.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.
@@ -70,3 +70,33 @@ export declare enum CloudTaskStatus {
70
70
  Error = 3,// 错误
71
71
  Cancel = 4
72
72
  }
73
+ export declare enum CloudTaskType {
74
+ UploadFile = -1,// 上传文件
75
+ UploadFileGetUrl = -2,// 上传文件获取url
76
+ ChoosePic = -3,// 选择图片
77
+ CostPoint = -4,// 扣除积分
78
+ AddAction = -5,// 添加action
79
+ CloseWindow = -6,// 关闭本地窗口
80
+ SendRequest = -7,// 发送请求
81
+ UploadFileByPath = -8,// 直接根据路径来上传文件
82
+ SubtitleGenerate = 1,// 语音合成
83
+ WhisperSubtitleGenerate = 2,// whisper 字幕生成
84
+ TencentVoiceGenerate = 1000,// 语音合成
85
+ GptChat = 1001,// gpt聊天
86
+ TencentVoiceRecognize = 1002,// 一句话语音识别
87
+ GptDallE = 1003,// dall e绘画模型
88
+ AzureVoiceGenerate = 1004,// azure 语音合成
89
+ TencentImageEnhance = 1005,// 腾讯云 图像整强
90
+ TencentText2Image = 1006,// 腾讯云 文生图
91
+ TencentImage2Image = 1007,// 腾讯云 图生图
92
+ TencentFaceAgeChange = 1008,// 腾讯云 人脸年龄变化
93
+ TencentFaceSexChange = 1009,// 腾讯云 人脸性别变化
94
+ TencentFaceAnimation = 1010,// 腾讯云 人脸动漫化
95
+ TencentSegmentPeople = 1011,// 腾讯云 人像分割
96
+ AiFishSpeech = 1012,// 声音克隆
97
+ AiOpenVoice = 1013,// 声音克隆 open-voice
98
+ BiliVideoParse = 1014,// B站视频解析
99
+ BiliPicParse = 1015,// B站封面解析
100
+ WangYiMusicParse = 1016
101
+ }
102
+ export declare const CloudTaskTypeMap: Map<CloudTaskType, string>;
@@ -1,5 +1,6 @@
1
1
  import { MqttRequest, MqttResponse } from "./mqtt.ts";
2
2
  import { ToolTaskInfo } from "./tool-task.ts";
3
+ import { CloudTaskType } from "./cloud.ts";
3
4
  export type SendTaskActionRequest = (info: LocalActionRequest) => void;
4
5
  export type TaskActionClose = () => void;
5
6
  export type GetTaskActionRequest = (uid: string, info: LocalActionRequest) => void;
@@ -108,7 +109,37 @@ export interface TaskService {
108
109
  }>;
109
110
  taskActionHandle: (callback: GetTaskActionRequest, addSend: SendTaskActionResponse) => void;
110
111
  }
111
- export interface IframeMsgData {
112
- task_type: number;
113
- data?: any;
112
+ export interface IframeDataRequest {
113
+ id?: string;
114
+ task_type: CloudTaskType;
115
+ data?: LocalActionRequest | SendDataRequest | SendDataCostPoint | SendDataChooseFile | SendDataUploadFileByPath;
116
+ }
117
+ export interface SendDataRequest {
118
+ url: string;
119
+ data: any;
120
+ method: 'get' | 'post' | 'put' | 'delete';
121
+ }
122
+ export interface SendDataCostPoint {
123
+ name: string;
124
+ point: number;
125
+ desc: string;
126
+ }
127
+ export interface SendDataChooseFile {
128
+ title: string;
129
+ accept: string;
130
+ }
131
+ export interface SendDataUploadFileByPath {
132
+ path: string;
133
+ }
134
+ export interface IframeDataResponse {
135
+ id?: string;
136
+ task_type: CloudTaskType;
137
+ event_type: LocalTaskEventType;
138
+ data: any;
139
+ }
140
+ export declare enum LocalTaskEventType {
141
+ Start = 1,
142
+ Progress = 2,
143
+ Success = 3,
144
+ Error = 4
114
145
  }
@@ -1,3 +1,22 @@
1
+ import { CloudTaskType } from "./cloud.ts";
2
+ export interface ToolConfigInfo {
3
+ unique: string;
4
+ name: string;
5
+ config_type: ToolConfigType;
6
+ config_data: string;
7
+ }
8
+ export declare enum ToolConfigType {
9
+ FileInput = 0,// 文件上传框
10
+ FileInputList = 1,// 文件上传列表
11
+ Select = 2,// 下拉框
12
+ FileGenerate = 3,// 随机生成一个文件
13
+ Input = 4
14
+ }
15
+ export interface ToolDetailTask {
16
+ configs: ToolConfigInfo[];
17
+ task_name_unique: string;
18
+ task_list: ToolTaskInfo[];
19
+ }
1
20
  export interface ToolTaskInfo {
2
21
  task_type: ToolTaskType;
3
22
  inputs: string[];
@@ -46,3 +65,68 @@ export interface TaskDataDownload {
46
65
  output?: string;
47
66
  relation: string;
48
67
  }
68
+ export interface ToolDetailLab {
69
+ inputs: LabCoreInputOption[];
70
+ outputs: LabCoreOutputOption[];
71
+ submit_init?: {
72
+ [key: string]: any;
73
+ } | string;
74
+ form_init?: {
75
+ [key: string]: any;
76
+ } | string;
77
+ task_type: CloudTaskType;
78
+ loading: string;
79
+ submit_text: string;
80
+ price: number;
81
+ replace_param?: string[];
82
+ }
83
+ export interface LabCoreInputOption {
84
+ name: string;
85
+ field: string;
86
+ element: LabElementType;
87
+ element_data?: LabCoreInputElementData;
88
+ require?: boolean;
89
+ }
90
+ export type LabCoreInputElementData = InputData | SelectData | TextAreaData | UploadData | SliderData | AlertData | string;
91
+ export declare enum LabElementType {
92
+ Input = 0,
93
+ Select = 1,
94
+ TextArea = 2,
95
+ FileUpload = 3,
96
+ Slider = 4,
97
+ Audio = 5,
98
+ Number = 6,
99
+ ImageList = 7,
100
+ Image = 8,
101
+ Alert = 9
102
+ }
103
+ export interface InputData {
104
+ placeholder: string;
105
+ }
106
+ export interface TextAreaData {
107
+ placeholder: string;
108
+ max_len: number;
109
+ }
110
+ export interface SelectData {
111
+ data: {
112
+ label: string;
113
+ value: any;
114
+ }[];
115
+ }
116
+ export interface UploadData {
117
+ accept: string;
118
+ max_size?: number;
119
+ }
120
+ export interface SliderData {
121
+ max: number;
122
+ min: number;
123
+ step?: number;
124
+ }
125
+ export interface AlertData {
126
+ content: string;
127
+ type?: 'info' | 'success' | 'warning' | 'error';
128
+ }
129
+ export interface LabCoreOutputOption {
130
+ field: string;
131
+ element: LabElementType;
132
+ }
@@ -1 +1,4 @@
1
+ import { ToolParamFile } from "../types/local-task.ts";
1
2
  export declare const convertFileSize: (bytes: number) => string;
3
+ export declare const File2ToolParamFile: (file: File) => ToolParamFile;
4
+ export declare const Seconds2TimeStr: (seconds: number) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyjj-web-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib"
@@ -21,6 +21,7 @@
21
21
  "@types/node": "^20.12.6",
22
22
  "@types/react": "^18.2.66",
23
23
  "@types/react-dom": "^18.2.22",
24
+ "@types/uuid": "^9.0.8",
24
25
  "@typescript-eslint/eslint-plugin": "^7.2.0",
25
26
  "@typescript-eslint/parser": "^7.2.0",
26
27
  "@vitejs/plugin-react": "^4.2.1",
@@ -32,6 +33,7 @@
32
33
  "react-dom": "^18.2.0",
33
34
  "tslib": "^2.6.2",
34
35
  "typescript": "^5.4.4",
36
+ "uuid": "^9.0.1",
35
37
  "vite": "^5.2.0",
36
38
  "vite-plugin-svgr": "^4.2.0"
37
39
  }