sa2kit 1.6.49 → 1.6.52
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/{chunk-QROLPPXP.mjs → chunk-PKKIDPXE.mjs} +3 -3
- package/dist/{chunk-QROLPPXP.mjs.map → chunk-PKKIDPXE.mjs.map} +1 -1
- package/dist/{chunk-VLZ5N6XZ.js → chunk-TSTBLX6B.js} +3 -3
- package/dist/{chunk-VLZ5N6XZ.js.map → chunk-TSTBLX6B.js.map} +1 -1
- package/dist/iflytek/index.d.mts +109 -0
- package/dist/iflytek/index.d.ts +109 -0
- package/dist/iflytek/index.js +365 -0
- package/dist/iflytek/index.js.map +1 -0
- package/dist/iflytek/index.mjs +362 -0
- package/dist/iflytek/index.mjs.map +1 -0
- package/dist/iflytek/server.d.mts +59 -0
- package/dist/iflytek/server.d.ts +59 -0
- package/dist/iflytek/server.js +281 -0
- package/dist/iflytek/server.js.map +1 -0
- package/dist/iflytek/server.mjs +274 -0
- package/dist/iflytek/server.mjs.map +1 -0
- package/dist/showmasterpiece/index.js +45 -45
- package/dist/showmasterpiece/index.js.map +1 -1
- package/dist/showmasterpiece/index.mjs +45 -45
- package/dist/showmasterpiece/index.mjs.map +1 -1
- package/dist/showmasterpiece/migration/index.js +10 -10
- package/dist/showmasterpiece/migration/index.mjs +2 -2
- package/dist/types-C4bbgHHW.d.mts +100 -0
- package/dist/types-C4bbgHHW.d.ts +100 -0
- package/dist/universalFile/server/index.js +80 -80
- package/dist/universalFile/server/index.mjs +2 -2
- package/package.json +20 -4
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var chunk7JN25DJB_js = require('../../chunk-7JN25DJB.js');
|
|
4
4
|
require('../../chunk-XYQMAF7H.js');
|
|
5
5
|
require('../../chunk-IZOIVYOW.js');
|
|
6
|
-
var
|
|
7
|
-
require('../../chunk-M4HGHTIC.js');
|
|
6
|
+
var chunkTSTBLX6B_js = require('../../chunk-TSTBLX6B.js');
|
|
8
7
|
require('../../chunk-6AHYPPUP.js');
|
|
9
8
|
require('../../chunk-CFGX3EKK.js');
|
|
10
9
|
require('../../chunk-4NFOSCM6.js');
|
|
10
|
+
require('../../chunk-M4HGHTIC.js');
|
|
11
11
|
require('../../chunk-ACLOJXXE.js');
|
|
12
12
|
require('../../chunk-D2HXMGXS.js');
|
|
13
13
|
require('../../chunk-Z6ZWNWWR.js');
|
|
@@ -118,11 +118,11 @@ var ArtworkMigrator = class {
|
|
|
118
118
|
async ensureStorageProvider() {
|
|
119
119
|
let provider = this.storageProviderCache.get("local-default");
|
|
120
120
|
if (!provider) {
|
|
121
|
-
const [existingProvider] = await this.db.select().from(
|
|
121
|
+
const [existingProvider] = await this.db.select().from(chunkTSTBLX6B_js.fileStorageProviders).where(drizzleOrm.eq(chunkTSTBLX6B_js.fileStorageProviders.name, "local-default")).limit(1);
|
|
122
122
|
if (existingProvider) {
|
|
123
123
|
provider = existingProvider;
|
|
124
124
|
} else if (!this.config.dryRun) {
|
|
125
|
-
[provider] = await this.db.insert(
|
|
125
|
+
[provider] = await this.db.insert(chunkTSTBLX6B_js.fileStorageProviders).values({
|
|
126
126
|
name: "local-default",
|
|
127
127
|
type: "local",
|
|
128
128
|
config: {
|
|
@@ -163,11 +163,11 @@ var ArtworkMigrator = class {
|
|
|
163
163
|
const rootFolderName = "ShowMasterpiece";
|
|
164
164
|
let rootFolder = this.folderCache.get(rootFolderName);
|
|
165
165
|
if (!rootFolder) {
|
|
166
|
-
const [existingFolder] = await this.db.select().from(
|
|
166
|
+
const [existingFolder] = await this.db.select().from(chunkTSTBLX6B_js.fileFolders).where(drizzleOrm.eq(chunkTSTBLX6B_js.fileFolders.name, rootFolderName)).limit(1);
|
|
167
167
|
if (existingFolder) {
|
|
168
168
|
rootFolder = existingFolder;
|
|
169
169
|
} else if (!this.config.dryRun) {
|
|
170
|
-
[rootFolder] = await this.db.insert(
|
|
170
|
+
[rootFolder] = await this.db.insert(chunkTSTBLX6B_js.fileFolders).values({
|
|
171
171
|
id: rootFolderId,
|
|
172
172
|
name: rootFolderName,
|
|
173
173
|
path: "/showmasterpiece",
|
|
@@ -210,7 +210,7 @@ var ArtworkMigrator = class {
|
|
|
210
210
|
if (!collectionFolder) {
|
|
211
211
|
if (!this.config.dryRun) {
|
|
212
212
|
const folderId = uuid.v4();
|
|
213
|
-
[collectionFolder] = await this.db.insert(
|
|
213
|
+
[collectionFolder] = await this.db.insert(chunkTSTBLX6B_js.fileFolders).values({
|
|
214
214
|
id: folderId,
|
|
215
215
|
name: collection.title,
|
|
216
216
|
path: `/showmasterpiece/collection-${collection.id}`,
|
|
@@ -349,7 +349,7 @@ var ArtworkMigrator = class {
|
|
|
349
349
|
}
|
|
350
350
|
let fileRecord = null;
|
|
351
351
|
if (!this.config.dryRun) {
|
|
352
|
-
[fileRecord] = await this.db.insert(
|
|
352
|
+
[fileRecord] = await this.db.insert(chunkTSTBLX6B_js.fileMetadata).values({
|
|
353
353
|
originalName: `${artwork.title}${extension}`,
|
|
354
354
|
storedName,
|
|
355
355
|
extension: extension.substring(1),
|
|
@@ -435,13 +435,13 @@ var ArtworkMigrator = class {
|
|
|
435
435
|
console.log(`\u26A0\uFE0F [ArtworkMigrator] \u4F5C\u54C1 ${artworkId} \u6CA1\u6709\u6587\u4EF6\u5F15\u7528\uFF0C\u65E0\u9700\u56DE\u6EDA`);
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
438
|
-
const [fileRecord] = await this.db.select().from(
|
|
438
|
+
const [fileRecord] = await this.db.select().from(chunkTSTBLX6B_js.fileMetadata).where(drizzleOrm.eq(chunkTSTBLX6B_js.fileMetadata.id, artwork.fileId)).limit(1);
|
|
439
439
|
if (fileRecord) {
|
|
440
440
|
const fullPath = path.join("./uploads", fileRecord.storagePath);
|
|
441
441
|
if (fs.existsSync(fullPath)) {
|
|
442
442
|
console.log(`\u{1F4C1} [ArtworkMigrator] \u4FDD\u7559\u6587\u4EF6: ${fullPath}`);
|
|
443
443
|
}
|
|
444
|
-
await this.db.delete(
|
|
444
|
+
await this.db.delete(chunkTSTBLX6B_js.fileMetadata).where(drizzleOrm.eq(chunkTSTBLX6B_js.fileMetadata.id, artwork.fileId));
|
|
445
445
|
}
|
|
446
446
|
await this.db.update(chunk7JN25DJB_js.comicUniverseArtworks).set({
|
|
447
447
|
fileId: null,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { comicUniverseArtworks, comicUniverseCollections } from '../../chunk-SHY424RZ.mjs';
|
|
2
2
|
import '../../chunk-PAX4S7QM.mjs';
|
|
3
3
|
import '../../chunk-GFVAIT6Y.mjs';
|
|
4
|
-
import { fileStorageProviders, fileFolders, fileMetadata } from '../../chunk-
|
|
5
|
-
import '../../chunk-76V7EKBX.mjs';
|
|
4
|
+
import { fileStorageProviders, fileFolders, fileMetadata } from '../../chunk-PKKIDPXE.mjs';
|
|
6
5
|
import '../../chunk-VTGPHE4Z.mjs';
|
|
7
6
|
import '../../chunk-K7WNCB4V.mjs';
|
|
8
7
|
import '../../chunk-AEXPAH7Z.mjs';
|
|
8
|
+
import '../../chunk-76V7EKBX.mjs';
|
|
9
9
|
import '../../chunk-PXWDQFWV.mjs';
|
|
10
10
|
import '../../chunk-L4ZYBFB2.mjs';
|
|
11
11
|
import '../../chunk-WMJKH4XE.mjs';
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 讯飞语音转文字 — 公共类型定义
|
|
3
|
+
*
|
|
4
|
+
* 客户端与服务端共享,不依赖任何 UI 框架或运行时库。
|
|
5
|
+
*/
|
|
6
|
+
type IflytekPhase = "idle" | "connecting" | "recording" | "stopping";
|
|
7
|
+
interface IflytekAudioFrame {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
/** 0 = 首帧(携带 common/business),1 = 中间帧,2 = 终帧 */
|
|
10
|
+
status: 0 | 1 | 2;
|
|
11
|
+
audio?: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
domain?: string;
|
|
14
|
+
accent?: string;
|
|
15
|
+
}
|
|
16
|
+
interface IflytekStartPayload {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
}
|
|
19
|
+
interface IflytekReadyPayload {
|
|
20
|
+
sessionId: string;
|
|
21
|
+
}
|
|
22
|
+
interface IflytekResultPayload {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
text: string;
|
|
25
|
+
isFinal: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface IflytekErrorPayload {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
interface IflytekStopPayload {
|
|
32
|
+
sessionId: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 音频录制器的抽象接口。
|
|
36
|
+
* 使用者需要根据平台提供实现(如 @fugood/react-native-audio-pcm-stream)。
|
|
37
|
+
*/
|
|
38
|
+
interface AudioRecorder {
|
|
39
|
+
init(options: {
|
|
40
|
+
sampleRate: number;
|
|
41
|
+
channels: number;
|
|
42
|
+
bitsPerSample: number;
|
|
43
|
+
audioSource: number;
|
|
44
|
+
bufferSize: number;
|
|
45
|
+
}): void;
|
|
46
|
+
start(): void;
|
|
47
|
+
stop(): void;
|
|
48
|
+
on(event: "data", callback: (base64Chunk: string) => void): {
|
|
49
|
+
remove: () => void;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Socket 传输层抽象。
|
|
54
|
+
* 与 socket.io-client 的 Socket 兼容,但只声明必需方法。
|
|
55
|
+
*/
|
|
56
|
+
interface IflytekTransport {
|
|
57
|
+
emit(event: string, payload?: unknown): void;
|
|
58
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
59
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
60
|
+
}
|
|
61
|
+
interface IflytekClientConfig {
|
|
62
|
+
/** 传输层(Socket.IO 客户端实例) */
|
|
63
|
+
transport: IflytekTransport;
|
|
64
|
+
/** 音频录制器实例 */
|
|
65
|
+
recorder: AudioRecorder;
|
|
66
|
+
/** 采样率,默认 16000 */
|
|
67
|
+
sampleRate?: number;
|
|
68
|
+
/** 语言,默认 zh_cn */
|
|
69
|
+
language?: string;
|
|
70
|
+
/** 领域,默认 iat */
|
|
71
|
+
domain?: string;
|
|
72
|
+
/** 方言,默认 mandarin */
|
|
73
|
+
accent?: string;
|
|
74
|
+
/** ready 超时(ms),默认 5000 */
|
|
75
|
+
readyTimeout?: number;
|
|
76
|
+
/** 松手后等待首帧超时(ms),默认 1500 */
|
|
77
|
+
stopWaitTimeout?: number;
|
|
78
|
+
/** 是否输出调试日志,默认 false */
|
|
79
|
+
debug?: boolean;
|
|
80
|
+
}
|
|
81
|
+
interface IflytekClientEvents {
|
|
82
|
+
/** 识别到中间结果 */
|
|
83
|
+
onInterimResult?: (text: string, sessionId: string) => void;
|
|
84
|
+
/** 识别到最终结果 */
|
|
85
|
+
onFinalResult?: (text: string, sessionId: string) => void;
|
|
86
|
+
/** 状态变化 */
|
|
87
|
+
onPhaseChange?: (phase: IflytekPhase, sessionId: string | null) => void;
|
|
88
|
+
/** 出错 */
|
|
89
|
+
onError?: (message: string, sessionId: string | null) => void;
|
|
90
|
+
}
|
|
91
|
+
interface IflytekServerConfig {
|
|
92
|
+
appId: string;
|
|
93
|
+
apiKey: string;
|
|
94
|
+
apiSecret: string;
|
|
95
|
+
host?: string;
|
|
96
|
+
path?: string;
|
|
97
|
+
debug?: boolean;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type { AudioRecorder as A, IflytekServerConfig as I, IflytekAudioFrame as a, IflytekStartPayload as b, IflytekStopPayload as c, IflytekClientConfig as d, IflytekClientEvents as e, IflytekPhase as f, IflytekTransport as g, IflytekReadyPayload as h, IflytekResultPayload as i, IflytekErrorPayload as j };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 讯飞语音转文字 — 公共类型定义
|
|
3
|
+
*
|
|
4
|
+
* 客户端与服务端共享,不依赖任何 UI 框架或运行时库。
|
|
5
|
+
*/
|
|
6
|
+
type IflytekPhase = "idle" | "connecting" | "recording" | "stopping";
|
|
7
|
+
interface IflytekAudioFrame {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
/** 0 = 首帧(携带 common/business),1 = 中间帧,2 = 终帧 */
|
|
10
|
+
status: 0 | 1 | 2;
|
|
11
|
+
audio?: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
domain?: string;
|
|
14
|
+
accent?: string;
|
|
15
|
+
}
|
|
16
|
+
interface IflytekStartPayload {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
}
|
|
19
|
+
interface IflytekReadyPayload {
|
|
20
|
+
sessionId: string;
|
|
21
|
+
}
|
|
22
|
+
interface IflytekResultPayload {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
text: string;
|
|
25
|
+
isFinal: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface IflytekErrorPayload {
|
|
28
|
+
sessionId: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
interface IflytekStopPayload {
|
|
32
|
+
sessionId: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 音频录制器的抽象接口。
|
|
36
|
+
* 使用者需要根据平台提供实现(如 @fugood/react-native-audio-pcm-stream)。
|
|
37
|
+
*/
|
|
38
|
+
interface AudioRecorder {
|
|
39
|
+
init(options: {
|
|
40
|
+
sampleRate: number;
|
|
41
|
+
channels: number;
|
|
42
|
+
bitsPerSample: number;
|
|
43
|
+
audioSource: number;
|
|
44
|
+
bufferSize: number;
|
|
45
|
+
}): void;
|
|
46
|
+
start(): void;
|
|
47
|
+
stop(): void;
|
|
48
|
+
on(event: "data", callback: (base64Chunk: string) => void): {
|
|
49
|
+
remove: () => void;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Socket 传输层抽象。
|
|
54
|
+
* 与 socket.io-client 的 Socket 兼容,但只声明必需方法。
|
|
55
|
+
*/
|
|
56
|
+
interface IflytekTransport {
|
|
57
|
+
emit(event: string, payload?: unknown): void;
|
|
58
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
59
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
60
|
+
}
|
|
61
|
+
interface IflytekClientConfig {
|
|
62
|
+
/** 传输层(Socket.IO 客户端实例) */
|
|
63
|
+
transport: IflytekTransport;
|
|
64
|
+
/** 音频录制器实例 */
|
|
65
|
+
recorder: AudioRecorder;
|
|
66
|
+
/** 采样率,默认 16000 */
|
|
67
|
+
sampleRate?: number;
|
|
68
|
+
/** 语言,默认 zh_cn */
|
|
69
|
+
language?: string;
|
|
70
|
+
/** 领域,默认 iat */
|
|
71
|
+
domain?: string;
|
|
72
|
+
/** 方言,默认 mandarin */
|
|
73
|
+
accent?: string;
|
|
74
|
+
/** ready 超时(ms),默认 5000 */
|
|
75
|
+
readyTimeout?: number;
|
|
76
|
+
/** 松手后等待首帧超时(ms),默认 1500 */
|
|
77
|
+
stopWaitTimeout?: number;
|
|
78
|
+
/** 是否输出调试日志,默认 false */
|
|
79
|
+
debug?: boolean;
|
|
80
|
+
}
|
|
81
|
+
interface IflytekClientEvents {
|
|
82
|
+
/** 识别到中间结果 */
|
|
83
|
+
onInterimResult?: (text: string, sessionId: string) => void;
|
|
84
|
+
/** 识别到最终结果 */
|
|
85
|
+
onFinalResult?: (text: string, sessionId: string) => void;
|
|
86
|
+
/** 状态变化 */
|
|
87
|
+
onPhaseChange?: (phase: IflytekPhase, sessionId: string | null) => void;
|
|
88
|
+
/** 出错 */
|
|
89
|
+
onError?: (message: string, sessionId: string | null) => void;
|
|
90
|
+
}
|
|
91
|
+
interface IflytekServerConfig {
|
|
92
|
+
appId: string;
|
|
93
|
+
apiKey: string;
|
|
94
|
+
apiSecret: string;
|
|
95
|
+
host?: string;
|
|
96
|
+
path?: string;
|
|
97
|
+
debug?: boolean;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type { AudioRecorder as A, IflytekServerConfig as I, IflytekAudioFrame as a, IflytekStartPayload as b, IflytekStopPayload as c, IflytekClientConfig as d, IflytekClientEvents as e, IflytekPhase as f, IflytekTransport as g, IflytekReadyPayload as h, IflytekResultPayload as i, IflytekErrorPayload as j };
|