wtfai 1.7.2 → 1.8.0
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.
- package/dist/client.d.ts +5 -1
- package/dist/client.js +4 -0
- package/dist/session.d.ts +11 -1
- package/dist/session.js +27 -0
- package/dist/ui/code.js +1 -0
- package/dist/upload.d.ts +3 -1
- package/dist/upload.js +2 -2
- package/package.json +11 -11
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Workflow, WorkflowListResponse } from '@our-llm/shared/types';
|
|
1
|
+
import type { Workflow, WorkflowListResponse, DeviceInfo } from '@our-llm/shared/types';
|
|
2
2
|
import type { ClientConfig, SessionOptions } from './types';
|
|
3
3
|
import { WorkflowSession } from './session';
|
|
4
4
|
import { UploadService } from './upload';
|
|
@@ -47,4 +47,8 @@ export declare class Wtfai {
|
|
|
47
47
|
* 创建工作流会话
|
|
48
48
|
*/
|
|
49
49
|
createSession(workflowId: string, options?: SessionOptions): WorkflowSession;
|
|
50
|
+
/**
|
|
51
|
+
* 获取当前详细的设备信息(本地计算)
|
|
52
|
+
*/
|
|
53
|
+
getDeviceInfo(): Promise<DeviceInfo>;
|
|
50
54
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getDeviceInfo } from "@our-llm/shared/fingerprint";
|
|
1
2
|
import { WorkflowSession } from "./session.js";
|
|
2
3
|
import { UploadService } from "./upload.js";
|
|
3
4
|
function _define_property(obj, key, value) {
|
|
@@ -32,6 +33,9 @@ class Wtfai {
|
|
|
32
33
|
createSession(workflowId, options) {
|
|
33
34
|
return new WorkflowSession(workflowId, this.baseUrl, this.uploadService, this.headers, options);
|
|
34
35
|
}
|
|
36
|
+
async getDeviceInfo() {
|
|
37
|
+
return getDeviceInfo();
|
|
38
|
+
}
|
|
35
39
|
constructor(config){
|
|
36
40
|
_define_property(this, "baseUrl", void 0);
|
|
37
41
|
_define_property(this, "uploadService", void 0);
|
package/dist/session.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SimpleMessage } from '@our-llm/shared/types';
|
|
1
|
+
import type { SimpleMessage, DeviceInfo } from '@our-llm/shared/types';
|
|
2
2
|
import type { SessionOptions, SessionState, SessionEventListeners, SendInput, ListRecordsOptions, ListRecordsResult } from './types';
|
|
3
3
|
import { UploadService } from './upload';
|
|
4
4
|
/**
|
|
@@ -137,6 +137,16 @@ export declare class WorkflowSession {
|
|
|
137
137
|
* @param options 请求配置
|
|
138
138
|
*/
|
|
139
139
|
fetch(url: string, options?: RequestInit): Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* 上报设备信息相关(用于日志监控)
|
|
142
|
+
*/
|
|
143
|
+
reportDeviceInfo(): Promise<{
|
|
144
|
+
success: boolean;
|
|
145
|
+
}>;
|
|
146
|
+
/**
|
|
147
|
+
* 获取当前详细的设备信息(本地计算)
|
|
148
|
+
*/
|
|
149
|
+
getDeviceInfo(): Promise<DeviceInfo>;
|
|
140
150
|
/**
|
|
141
151
|
* 发送消息执行工作流
|
|
142
152
|
*/
|
package/dist/session.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getDeviceInfo, getFingerprint } from "@our-llm/shared/fingerprint";
|
|
1
2
|
import { executeWorkflowSSE } from "./sse.js";
|
|
2
3
|
import { v7 } from "uuid";
|
|
3
4
|
function _define_property(obj, key, value) {
|
|
@@ -371,6 +372,32 @@ class WorkflowSession {
|
|
|
371
372
|
}
|
|
372
373
|
return response.json();
|
|
373
374
|
}
|
|
375
|
+
async reportDeviceInfo() {
|
|
376
|
+
this.assertNotDisposed();
|
|
377
|
+
const deviceId = await getFingerprint();
|
|
378
|
+
const userAgent = navigator.userAgent;
|
|
379
|
+
const sessionId = this.state.threadId;
|
|
380
|
+
if (!sessionId) throw new Error('No active session (missing threadId)');
|
|
381
|
+
const payload = {
|
|
382
|
+
deviceId,
|
|
383
|
+
userAgent,
|
|
384
|
+
sessionId
|
|
385
|
+
};
|
|
386
|
+
const response = await fetch(`${this.baseUrl}/workflows/device-info`, {
|
|
387
|
+
method: 'POST',
|
|
388
|
+
headers: {
|
|
389
|
+
'Content-Type': 'application/json',
|
|
390
|
+
...this.headers
|
|
391
|
+
},
|
|
392
|
+
body: JSON.stringify(payload)
|
|
393
|
+
});
|
|
394
|
+
if (!response.ok) throw new Error('Failed to report device info');
|
|
395
|
+
return response.json();
|
|
396
|
+
}
|
|
397
|
+
async getDeviceInfo() {
|
|
398
|
+
this.assertNotDisposed();
|
|
399
|
+
return getDeviceInfo();
|
|
400
|
+
}
|
|
374
401
|
async send({ parts: inputParts, ...rest }) {
|
|
375
402
|
this.assertNotDisposed();
|
|
376
403
|
if (this.state.isExecuting) throw new Error('工作流正在执行中');
|
package/dist/ui/code.js
CHANGED
package/dist/upload.d.ts
CHANGED
package/dist/upload.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import cos_js_sdk_v5 from "cos-js-sdk-v5";
|
|
2
1
|
import compressorjs from "compressorjs";
|
|
3
2
|
function _define_property(obj, key, value) {
|
|
4
3
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -86,7 +85,8 @@ class UploadService {
|
|
|
86
85
|
throw new Error(error.message || '获取上传凭证失败');
|
|
87
86
|
}
|
|
88
87
|
const data = await response.json();
|
|
89
|
-
const
|
|
88
|
+
const COS = (await import("cos-js-sdk-v5")).default;
|
|
89
|
+
const cos = new COS({
|
|
90
90
|
getAuthorization: (_options, callback)=>{
|
|
91
91
|
callback({
|
|
92
92
|
TmpSecretId: data.credentials.tmpSecretId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wtfai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -15,30 +15,30 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@eslint/js": "^9.39.4",
|
|
17
17
|
"@rsbuild/plugin-react": "^1.4.6",
|
|
18
|
-
"@rslib/core": "^0.
|
|
18
|
+
"@rslib/core": "^0.21.2",
|
|
19
19
|
"@types/react": "^19.2.14",
|
|
20
20
|
"eslint": "^9.39.4",
|
|
21
21
|
"eslint-config-prettier": "^10.1.8",
|
|
22
22
|
"eslint-plugin-prettier": "^5.5.5",
|
|
23
|
-
"globals": "^17.
|
|
24
|
-
"prettier": "^3.8.
|
|
25
|
-
"react": "^19.2.
|
|
23
|
+
"globals": "^17.5.0",
|
|
24
|
+
"prettier": "^3.8.3",
|
|
25
|
+
"react": "^19.2.5",
|
|
26
26
|
"typescript": "^5.9.3",
|
|
27
|
-
"typescript-eslint": "^8.
|
|
27
|
+
"typescript-eslint": "^8.58.2"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=16.9.0",
|
|
31
31
|
"react-dom": ">=16.9.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ant-design/icons": "^6.1.
|
|
35
|
-
"@ant-design/x": "^2.
|
|
36
|
-
"@ant-design/x-markdown": "^2.
|
|
34
|
+
"@ant-design/icons": "^6.1.1",
|
|
35
|
+
"@ant-design/x": "^2.5.0",
|
|
36
|
+
"@ant-design/x-markdown": "^2.5.0",
|
|
37
37
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
38
38
|
"clsx": "^2.1.1",
|
|
39
|
-
"compressorjs": "^1.
|
|
39
|
+
"compressorjs": "^1.3.0",
|
|
40
40
|
"cos-js-sdk-v5": "^1.10.1",
|
|
41
|
-
"jsonrepair": "^3.
|
|
41
|
+
"jsonrepair": "^3.14.0",
|
|
42
42
|
"uuid": "^13.0.0",
|
|
43
43
|
"@our-llm/shared": "3.0.1"
|
|
44
44
|
},
|