zyjj-web-sdk 1.0.4 → 1.0.6

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.
@@ -1,6 +1,8 @@
1
+ import { GetPageReq } from "../api/entity.ts";
1
2
  import { MaterialInfo } from "../types/cloud.ts";
2
3
  export interface MaterialListProps {
3
- materialSize: number;
4
+ pageInfo: GetPageReq;
5
+ onPageChange?: (info: GetPageReq) => void;
4
6
  onDownload: (info: MaterialInfo) => void;
5
7
  }
6
8
  export default function MaterialList(props: MaterialListProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,10 @@
1
+ import { GetPageReq } from "../api/entity.ts";
1
2
  import { ToolInfo } from "../types/cloud.ts";
2
3
  export interface ToolListProps {
3
- toolSize: number;
4
+ pageInfo: GetPageReq;
5
+ onPageChange?: (info: GetPageReq) => void;
6
+ starIdList: string[];
7
+ onStarChange: (ids: string[]) => void;
4
8
  onTool: (info: ToolInfo) => void;
5
9
  onHelp: (info: ToolInfo) => void;
6
10
  }
@@ -0,0 +1,15 @@
1
+ import { UserInfo } from "../types/cloud.ts";
2
+ import { MqttResponse } from "../types/mqtt.ts";
3
+ import mqtt from "mqtt";
4
+ export interface UserState {
5
+ isLogin: boolean;
6
+ showLogin: boolean;
7
+ userInfo?: UserInfo;
8
+ }
9
+ export interface MqttState {
10
+ taskEvent: {
11
+ [key: string]: MqttResponse;
12
+ };
13
+ taskQueue: string[];
14
+ client?: mqtt.MqttClient;
15
+ }
@@ -0,0 +1,11 @@
1
+ import { AsyncThunk, PayloadAction } from '@reduxjs/toolkit';
2
+ import { MqttResponse } from "../types/mqtt";
3
+ import { MqttClient } from 'mqtt';
4
+ import { MqttState } from "./entity.ts";
5
+ export declare const initMqtt: AsyncThunk<MqttClient, undefined, any>;
6
+ export declare const mqttActions: import("@reduxjs/toolkit").CaseReducerActions<{
7
+ addTaskEvent(state: import("immer").WritableDraft<MqttState>, info: PayloadAction<MqttResponse>): void;
8
+ closeClient(state: import("immer").WritableDraft<MqttState>): void;
9
+ }, "mqtt">;
10
+ declare const _default: import("redux").Reducer<MqttState>;
11
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { AsyncThunk } from '@reduxjs/toolkit';
2
+ import { UserState } from "./entity.ts";
3
+ import { UserInfo } from "../types/cloud.ts";
4
+ export declare const getUserInfo: AsyncThunk<UserInfo | undefined, undefined, any>;
5
+ export declare const userAction: import("@reduxjs/toolkit").CaseReducerActions<{
6
+ loginOut(state: import("immer").WritableDraft<UserState>): void;
7
+ showLogin(state: import("immer").WritableDraft<UserState>): void;
8
+ hideLogin(state: import("immer").WritableDraft<UserState>): void;
9
+ }, "user">;
10
+ declare const _default: import("redux").Reducer<UserState>;
11
+ export default _default;
package/lib/style.css CHANGED
@@ -1 +1 @@
1
- .arco-image-img{width:100%}.arco-progress-line-outer,.arco-progress-line-inner{border-radius:2px!important}.arco-list-item-meta-content{width:100%}
1
+ .button-trigger{display:flex;align-items:center;justify-content:center;position:absolute;width:40px;height:40px;border-radius:50%;font-size:14px;color:var(--color-white);cursor:pointer;transition:all .1s;background-color:#4578ea}.button-trigger.button-trigger-active{background-color:var(--color-primary-light-4)}.tool-card:before{content:"";background-repeat:no-repeat,no-repeat;position:absolute;background-size:90px;width:100%;height:100%;background-position:-10% 160%,0 0;opacity:.7}.arco-image-img{width:100%}.arco-progress-line-outer,.arco-progress-line-inner{border-radius:2px!important}.arco-list-item-meta-content{width:100%}
@@ -0,0 +1,7 @@
1
+ import { LocalTaskInfo } from '../types/local-task';
2
+ export declare const storeNameTask = "task";
3
+ export declare const AddTask: (data: LocalTaskInfo, table?: string) => Promise<IDBValidKey>;
4
+ export declare const GetAllData: <T>(table?: string) => Promise<T[]>;
5
+ export declare const GetData: <T>(id: string, table?: string) => Promise<T>;
6
+ export declare const UpdateData: <T>(id: string, data: T, table?: string) => Promise<IDBValidKey>;
7
+ export declare const DeleteData: (id: string, table?: string) => Promise<void>;
@@ -1,4 +1,12 @@
1
1
  import { ToolParamFile } from "../types/local-task.ts";
2
+ import COS from 'cos-js-sdk-v5';
2
3
  export declare const convertFileSize: (bytes: number) => string;
3
4
  export declare const File2ToolParamFile: (file: File) => ToolParamFile;
4
5
  export declare const Seconds2TimeStr: (seconds: number) => string;
6
+ export declare const getTencentInfo: () => Promise<{
7
+ cos: COS;
8
+ path: string;
9
+ bucket: string;
10
+ region: string;
11
+ }>;
12
+ export declare const object2query: (data: any) => string;
@@ -14,6 +14,7 @@ export interface UserInfo {
14
14
  email: string;
15
15
  points: number;
16
16
  role: number;
17
+ tool_id_list?: string[];
17
18
  }
18
19
  export interface ToolInfo {
19
20
  id: string;
@@ -29,6 +30,7 @@ export interface ToolInfo {
29
30
  width: number;
30
31
  height: number;
31
32
  url: string;
33
+ icon: string;
32
34
  }
33
35
  export declare enum ToolType {
34
36
  Task = 0,// 任务类型
@@ -70,33 +72,3 @@ export declare enum CloudTaskStatus {
70
72
  Error = 3,// 错误
71
73
  Cancel = 4
72
74
  }
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,6 +1,5 @@
1
1
  import { MqttRequest, MqttResponse } from "./mqtt.ts";
2
2
  import { ToolTaskInfo } from "./tool-task.ts";
3
- import { CloudTaskType } from "./cloud.ts";
4
3
  export type SendTaskActionRequest = (info: LocalActionRequest) => void;
5
4
  export type TaskActionClose = () => void;
6
5
  export type GetTaskActionRequest = (uid: string, info: LocalActionRequest) => void;
@@ -43,8 +42,8 @@ export declare enum LocalActionReqType {
43
42
  MqttReconnect = 5,// MQTT重连
44
43
  TaskActionAdd = 6,// 添加一个action动作
45
44
  NavigateTo = 7,// 跳转到指定页面
46
- SetToken = 8,// 设置token信息(extension)
47
- UploadFile = 9
45
+ ExtensionBlobConvert = 8,// Blob url转换
46
+ ExtensionGetId = 9
48
47
  }
49
48
  export interface LocalActionReqDataCreatTask {
50
49
  name: string;
@@ -66,16 +65,18 @@ export interface TaskRestoreInfo {
66
65
  export interface LocalActionResponse {
67
66
  id: string;
68
67
  action_type: LocalActionResType;
69
- data: TaskActionResDataUpdateTaskInfo | LocalActionReqDataCreatTask | MqttResponse | string;
68
+ data: LocalActionResData;
70
69
  }
70
+ export type LocalActionResData = LocalActionResDataUpdateTaskInfo | LocalActionReqDataCreatTask | MqttResponse | string;
71
71
  export declare enum LocalActionResType {
72
72
  TaskInfoUpdate = 0,// 任务信息更新
73
73
  MqttBack = 1,// Mqtt数据回调
74
74
  TaskActionAdd = 2,// 新增一个action
75
75
  NavigateTo = 3,// 跳转到指定页面
76
- FileUpload = 4
76
+ ExtensionBlobUrl = 4,// 返回blob url(extension)
77
+ ExtensionId = 5
77
78
  }
78
- export interface TaskActionResDataUpdateTaskInfo {
79
+ export interface LocalActionResDataUpdateTaskInfo {
79
80
  progress?: number;
80
81
  status?: LocalTaskStatus;
81
82
  msg?: string;
@@ -111,8 +112,8 @@ export interface TaskService {
111
112
  }
112
113
  export interface IframeDataRequest {
113
114
  id?: string;
114
- task_type: CloudTaskType;
115
- data?: LocalActionRequest | SendDataRequest | SendDataCostPoint | SendDataChooseFile | SendDataUploadFileByPath;
115
+ task_type: TaskType;
116
+ data?: LocalActionRequest | SendDataRequest | SendDataCostPoint | SendDataChooseFile | ToolParamFile;
116
117
  }
117
118
  export interface SendDataRequest {
118
119
  url: string;
@@ -128,12 +129,9 @@ export interface SendDataChooseFile {
128
129
  title: string;
129
130
  accept: string;
130
131
  }
131
- export interface SendDataUploadFileByPath {
132
- path: string;
133
- }
134
132
  export interface IframeDataResponse {
135
133
  id?: string;
136
- task_type: CloudTaskType;
134
+ task_type: TaskType;
137
135
  event_type: LocalTaskEventType;
138
136
  data: any;
139
137
  }
@@ -143,3 +141,13 @@ export declare enum LocalTaskEventType {
143
141
  Success = 3,
144
142
  Error = 4
145
143
  }
144
+ export declare enum TaskType {
145
+ UploadFile = -1,
146
+ UploadFileGetUrl = -2,
147
+ ChoosePic = -3,
148
+ CostPoint = -4,
149
+ AddAction = -5,
150
+ CloseWindow = -6,
151
+ SendRequest = -7,
152
+ UploadFileByPath = -8
153
+ }
@@ -1,4 +1,4 @@
1
- import { CloudTaskType } from "./cloud.ts";
1
+ import { TaskType } from "./local-task.ts";
2
2
  export interface ToolConfigInfo {
3
3
  unique: string;
4
4
  name: string;
@@ -75,7 +75,7 @@ export interface ToolDetailLab {
75
75
  form_init?: {
76
76
  [key: string]: any;
77
77
  } | string;
78
- task_type: CloudTaskType;
78
+ task_type: TaskType;
79
79
  loading: string;
80
80
  submit_text: string;
81
81
  price: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zyjj-web-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib"
@@ -14,10 +14,14 @@
14
14
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
15
15
  "preview": "vite preview",
16
16
  "link": "rm -rf lib/* && yarn build && yarn unlink && yarn link",
17
- "publish": "rm -rf lib/* && yarn build && npm publish --access public"
17
+ "publish_pkg": "rm -rf lib/* && yarn build && npm publish --access public"
18
18
  },
19
19
  "dependencies": {},
20
20
  "devDependencies": {
21
+ "@reduxjs/toolkit": "^2.0.1",
22
+ "idb": "^8.0.0",
23
+ "mqtt": "^5.3.4",
24
+ "cos-js-sdk-v5": "^1.5.0",
21
25
  "@arco-design/web-react": "^2.61.2",
22
26
  "@rollup/plugin-typescript": "^11.1.6",
23
27
  "@types/node": "^20.12.6",
File without changes