@plolink/sdk 0.0.4 → 0.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.
- package/README.md +40 -26
- package/dist/{chunk-4H4RACSE.js → chunk-LHNCGCWW.js} +137 -3
- package/dist/chunk-LHNCGCWW.js.map +1 -0
- package/dist/{chunk-NS3DJP2O.cjs → chunk-WFBN23AH.cjs} +141 -2
- package/dist/chunk-WFBN23AH.cjs.map +1 -0
- package/dist/client-BuUQTr8R.d.cts +766 -0
- package/dist/client-D2HlV7GT.d.ts +766 -0
- package/dist/common/index.cjs +18 -14
- package/dist/common/index.d.cts +126 -1
- package/dist/common/index.d.ts +126 -1
- package/dist/common/index.js +1 -1
- package/dist/index.cjs +647 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +410 -3
- package/dist/index.d.ts +410 -3
- package/dist/index.js +631 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/billing/index.cjs +1 -1
- package/dist/modules/billing/index.d.cts +1 -1
- package/dist/modules/billing/index.d.ts +1 -1
- package/dist/modules/billing/index.js +1 -1
- package/dist/modules/rbac/index.d.cts +1 -1
- package/dist/modules/rbac/index.d.ts +1 -1
- package/dist/modules/team/index.d.cts +1 -1
- package/dist/modules/team/index.d.ts +1 -1
- package/dist/modules/video-psych-analysis/index.cjs +436 -0
- package/dist/modules/video-psych-analysis/index.cjs.map +1 -0
- package/dist/modules/video-psych-analysis/index.d.cts +700 -0
- package/dist/modules/video-psych-analysis/index.d.ts +700 -0
- package/dist/modules/video-psych-analysis/index.js +434 -0
- package/dist/modules/video-psych-analysis/index.js.map +1 -0
- package/dist/modules/virtual-account/index.d.cts +1 -1
- package/dist/modules/virtual-account/index.d.ts +1 -1
- package/package.json +6 -16
- package/dist/chunk-4H4RACSE.js.map +0 -1
- package/dist/chunk-NS3DJP2O.cjs.map +0 -1
- package/dist/client-CAjIQKPm.d.cts +0 -193
- package/dist/client-CwNikk7i.d.ts +0 -193
- package/dist/modules/agent/index.cjs +0 -21
- package/dist/modules/agent/index.cjs.map +0 -1
- package/dist/modules/agent/index.d.cts +0 -71
- package/dist/modules/agent/index.d.ts +0 -71
- package/dist/modules/agent/index.js +0 -19
- package/dist/modules/agent/index.js.map +0 -1
- package/dist/modules/chat/index.cjs +0 -20
- package/dist/modules/chat/index.cjs.map +0 -1
- package/dist/modules/chat/index.d.cts +0 -68
- package/dist/modules/chat/index.d.ts +0 -68
- package/dist/modules/chat/index.js +0 -18
- package/dist/modules/chat/index.js.map +0 -1
- package/dist/modules/psych/index.cjs +0 -20
- package/dist/modules/psych/index.cjs.map +0 -1
- package/dist/modules/psych/index.d.cts +0 -69
- package/dist/modules/psych/index.d.ts +0 -69
- package/dist/modules/psych/index.js +0 -18
- package/dist/modules/psych/index.js.map +0 -1
|
@@ -0,0 +1,700 @@
|
|
|
1
|
+
import { P as PlolinkClient } from '../../client-D2HlV7GT.js';
|
|
2
|
+
import { P as Poller } from '../../poller-DWKZjuSw.js';
|
|
3
|
+
import '../../core-77EbLgbp.js';
|
|
4
|
+
import 'axios';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 视频人物心理分析模块类型
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 视频人物心理分析状态枚举
|
|
11
|
+
*/
|
|
12
|
+
type VideoPsychAnalysisStatus = 'PENDING' | 'SUBMITTING' | 'SUBMITTED' | 'PROCESSING' | 'SYNCING_RESULTS' | 'GENERATING_REPORT' | 'COMPLETED' | 'FAILED';
|
|
13
|
+
/**
|
|
14
|
+
* 创建视频心理分析任务参数
|
|
15
|
+
*/
|
|
16
|
+
interface CreateVideoPsychAnalysisParams {
|
|
17
|
+
/** 任务名称(可选,用于用户识别) */
|
|
18
|
+
name?: string;
|
|
19
|
+
/** 视频文件ID数组 */
|
|
20
|
+
videoFileIds: string[];
|
|
21
|
+
/** 人物参考图文件ID */
|
|
22
|
+
referenceImageFileId: string;
|
|
23
|
+
/** 人物背景与分析目标(如:视频是华为CEO任正非的公开演讲,请分析他对某话题的真实态度) */
|
|
24
|
+
prompt: string;
|
|
25
|
+
/** 人物背景信息(Markdown格式,可选) */
|
|
26
|
+
familyBackground?: string;
|
|
27
|
+
/** 切帧FPS(1-30,默认3) */
|
|
28
|
+
frameFps?: number;
|
|
29
|
+
/** 分析语言(默认zh-CN) */
|
|
30
|
+
language?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 视频元数据信息
|
|
34
|
+
*/
|
|
35
|
+
interface VideoInfo {
|
|
36
|
+
/** 视频宽度 */
|
|
37
|
+
width: number;
|
|
38
|
+
/** 视频高度 */
|
|
39
|
+
height: number;
|
|
40
|
+
/** 视频时长(秒) */
|
|
41
|
+
duration: number;
|
|
42
|
+
/** 文件大小(字节) */
|
|
43
|
+
file_size: number;
|
|
44
|
+
/** 帧率 */
|
|
45
|
+
fps: number;
|
|
46
|
+
/** 视频编码 */
|
|
47
|
+
video_codec: string;
|
|
48
|
+
/** 音频编码 */
|
|
49
|
+
audio_codec: string | null;
|
|
50
|
+
/** 视频比特率 */
|
|
51
|
+
video_bitrate: number;
|
|
52
|
+
/** 音频比特率 */
|
|
53
|
+
audio_bitrate: number | null;
|
|
54
|
+
/** 首帧图URL */
|
|
55
|
+
first_frame_url?: string | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 进度信息
|
|
59
|
+
*/
|
|
60
|
+
interface AnalysisProgress {
|
|
61
|
+
/** 已完成步骤数 */
|
|
62
|
+
done: number;
|
|
63
|
+
/** 总步骤数 */
|
|
64
|
+
total: number;
|
|
65
|
+
/** 当前阶段 */
|
|
66
|
+
stage: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 文件信息
|
|
70
|
+
*/
|
|
71
|
+
interface FileInfo {
|
|
72
|
+
/** 文件ID */
|
|
73
|
+
id: string;
|
|
74
|
+
/** 文件访问URL */
|
|
75
|
+
url: string;
|
|
76
|
+
/** 文件名 */
|
|
77
|
+
name: string;
|
|
78
|
+
/** 文件大小(字节) */
|
|
79
|
+
size: number;
|
|
80
|
+
/** MIME类型 */
|
|
81
|
+
mimeType: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 创建分析任务响应
|
|
85
|
+
*/
|
|
86
|
+
interface CreateVideoPsychAnalysisResponse {
|
|
87
|
+
/** 分析任务ID */
|
|
88
|
+
id: string;
|
|
89
|
+
/** 当前状态 */
|
|
90
|
+
status: VideoPsychAnalysisStatus;
|
|
91
|
+
/** 提示消息 */
|
|
92
|
+
message: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* 视频心理分析详情
|
|
96
|
+
*/
|
|
97
|
+
interface VideoPsychAnalysisDetail {
|
|
98
|
+
/** 分析任务ID */
|
|
99
|
+
id: string;
|
|
100
|
+
/** 任务名称 */
|
|
101
|
+
name: string;
|
|
102
|
+
/** 当前状态 */
|
|
103
|
+
status: VideoPsychAnalysisStatus;
|
|
104
|
+
/** 进度信息 */
|
|
105
|
+
progress: AnalysisProgress;
|
|
106
|
+
/** 错误信息 */
|
|
107
|
+
errorMessage: string;
|
|
108
|
+
/** 视频元数据信息 */
|
|
109
|
+
videoInfo: VideoInfo | null;
|
|
110
|
+
/** AI生成的最终报告(Markdown格式) */
|
|
111
|
+
reportContent: string;
|
|
112
|
+
/** 报告生成时间 */
|
|
113
|
+
reportGeneratedAt: string | null;
|
|
114
|
+
/** 创建时间 */
|
|
115
|
+
createdAt: string;
|
|
116
|
+
/** 更新时间 */
|
|
117
|
+
updatedAt: string;
|
|
118
|
+
/** 用户Prompt(人物背景与分析目标) */
|
|
119
|
+
prompt: string;
|
|
120
|
+
/** 人物背景信息(Markdown格式,可选) */
|
|
121
|
+
familyBackground?: string;
|
|
122
|
+
/** 视频文件信息列表 */
|
|
123
|
+
videoFiles: FileInfo[];
|
|
124
|
+
/** 参考图文件信息 */
|
|
125
|
+
referenceImage: FileInfo;
|
|
126
|
+
/** 切帧FPS */
|
|
127
|
+
frameFps: number;
|
|
128
|
+
/** 分析语言 */
|
|
129
|
+
language: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 同步任务状态响应
|
|
133
|
+
*/
|
|
134
|
+
interface SyncStatusResponse {
|
|
135
|
+
/** 当前状态 */
|
|
136
|
+
status: string;
|
|
137
|
+
/** 进度信息 */
|
|
138
|
+
progress: AnalysisProgress;
|
|
139
|
+
/** 提示消息 */
|
|
140
|
+
message: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 表情动作项
|
|
144
|
+
*/
|
|
145
|
+
interface ExpActItem {
|
|
146
|
+
/** 帧ID */
|
|
147
|
+
id: string;
|
|
148
|
+
/** 帧图片路径 */
|
|
149
|
+
path: string;
|
|
150
|
+
/** 时间戳(秒) */
|
|
151
|
+
sec: number;
|
|
152
|
+
/** 小时 */
|
|
153
|
+
h: number;
|
|
154
|
+
/** 分钟 */
|
|
155
|
+
m: number;
|
|
156
|
+
/** 秒 */
|
|
157
|
+
s: number;
|
|
158
|
+
/** 毫秒 */
|
|
159
|
+
ms: number;
|
|
160
|
+
/** 表情参数(已解码的对象) */
|
|
161
|
+
exp_params: Record<string, unknown> | null;
|
|
162
|
+
/** 动作分析描述 */
|
|
163
|
+
act_params: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 声纹信息
|
|
167
|
+
*/
|
|
168
|
+
interface WaveInfo {
|
|
169
|
+
/** 对象类型 */
|
|
170
|
+
object: string;
|
|
171
|
+
/** 声纹参数 */
|
|
172
|
+
wave_params: Record<string, unknown>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 文本维度分析项
|
|
176
|
+
*/
|
|
177
|
+
interface TextAnalysisItem {
|
|
178
|
+
/** 文本ID */
|
|
179
|
+
id: string;
|
|
180
|
+
/** 文本内容 */
|
|
181
|
+
text: string;
|
|
182
|
+
/** 开始时间(毫秒) */
|
|
183
|
+
start_ms: number;
|
|
184
|
+
/** 结束时间(毫秒) */
|
|
185
|
+
end_ms: number;
|
|
186
|
+
/** 所属段落ID */
|
|
187
|
+
group_id: string;
|
|
188
|
+
/** 说话人编号 */
|
|
189
|
+
speaker: number;
|
|
190
|
+
/** 声纹信息 */
|
|
191
|
+
wave_info?: WaveInfo;
|
|
192
|
+
/** 表情动作列表 */
|
|
193
|
+
exp_act_list?: ExpActItem[];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 文本维度结果
|
|
197
|
+
*/
|
|
198
|
+
interface TextsData {
|
|
199
|
+
/** 总数 */
|
|
200
|
+
total: number;
|
|
201
|
+
/** 文本项列表 */
|
|
202
|
+
items: TextAnalysisItem[];
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* 帧维度分析项
|
|
206
|
+
*/
|
|
207
|
+
interface FrameAnalysisItem {
|
|
208
|
+
/** 帧ID(格式:HH-MM-SS-mmm) */
|
|
209
|
+
frame_id: string;
|
|
210
|
+
/** 时间戳(毫秒) */
|
|
211
|
+
time_ms: number;
|
|
212
|
+
/** 帧图片路径 */
|
|
213
|
+
frame_path: string;
|
|
214
|
+
/** 表情参数(已解码的对象,包含详细的FACS分析等) */
|
|
215
|
+
exp_params: Record<string, unknown> | null;
|
|
216
|
+
/** 动作分析描述 */
|
|
217
|
+
act_params: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* 帧维度结果
|
|
221
|
+
*/
|
|
222
|
+
interface FramesData {
|
|
223
|
+
/** 总数 */
|
|
224
|
+
total: number;
|
|
225
|
+
/** 帧项列表 */
|
|
226
|
+
items: FrameAnalysisItem[];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* 段落分析项
|
|
230
|
+
*/
|
|
231
|
+
interface ParagraphAnalysisItem {
|
|
232
|
+
/** 段落ID */
|
|
233
|
+
group_id: string;
|
|
234
|
+
/** 段落文本 */
|
|
235
|
+
text: string;
|
|
236
|
+
/** 段落摘要 */
|
|
237
|
+
summary: string;
|
|
238
|
+
/** 开始时间(毫秒) */
|
|
239
|
+
start_ms: number;
|
|
240
|
+
/** 结束时间(毫秒) */
|
|
241
|
+
end_ms: number;
|
|
242
|
+
/** 声纹信息 */
|
|
243
|
+
wave_info?: WaveInfo;
|
|
244
|
+
/** 微表情描述 */
|
|
245
|
+
micro_expression_desc?: string;
|
|
246
|
+
/** 动作描述 */
|
|
247
|
+
action_desc?: string;
|
|
248
|
+
/** NLP分析结果 */
|
|
249
|
+
nlp_result?: {
|
|
250
|
+
/** 行为一致性(0-1) */
|
|
251
|
+
behavior_consistency?: number;
|
|
252
|
+
/** 说话人情绪 */
|
|
253
|
+
speaker_emotion?: string;
|
|
254
|
+
/** 情绪强度(0-1) */
|
|
255
|
+
speaker_emotion_intensity?: number;
|
|
256
|
+
/** 真实态度 */
|
|
257
|
+
real_attitude?: string;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* 段落结果
|
|
262
|
+
*/
|
|
263
|
+
interface ParagraphsData {
|
|
264
|
+
/** 总数 */
|
|
265
|
+
total: number;
|
|
266
|
+
/** 段落项列表 */
|
|
267
|
+
items: ParagraphAnalysisItem[];
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* 列表查询参数
|
|
271
|
+
*/
|
|
272
|
+
interface ListVideoPsychAnalysesParams {
|
|
273
|
+
/** 页码(默认1) */
|
|
274
|
+
page?: number;
|
|
275
|
+
/** 每页数量(默认20) */
|
|
276
|
+
pageSize?: number;
|
|
277
|
+
/** 关键词搜索(搜索任务名称) */
|
|
278
|
+
keyword?: string;
|
|
279
|
+
/** 状态筛选 */
|
|
280
|
+
status?: VideoPsychAnalysisStatus;
|
|
281
|
+
/** 排序字段(默认createdAt) */
|
|
282
|
+
sortBy?: 'createdAt' | 'updatedAt';
|
|
283
|
+
/** 排序方向(默认desc) */
|
|
284
|
+
sortOrder?: 'asc' | 'desc';
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* 分析任务摘要(列表项)
|
|
288
|
+
*/
|
|
289
|
+
interface VideoPsychAnalysisSummary {
|
|
290
|
+
/** 分析任务ID */
|
|
291
|
+
id: string;
|
|
292
|
+
/** 任务名称 */
|
|
293
|
+
name: string;
|
|
294
|
+
/** 当前状态 */
|
|
295
|
+
status: VideoPsychAnalysisStatus;
|
|
296
|
+
/** 进度信息 */
|
|
297
|
+
progress: AnalysisProgress;
|
|
298
|
+
/** 错误信息 */
|
|
299
|
+
errorMessage: string;
|
|
300
|
+
/** 报告生成时间 */
|
|
301
|
+
reportGeneratedAt: string | null;
|
|
302
|
+
/** 视频元信息(任务提交后更新) */
|
|
303
|
+
videoInfo: VideoInfo | null;
|
|
304
|
+
/** 视频文件信息列表 */
|
|
305
|
+
videoFiles: FileInfo[];
|
|
306
|
+
/** 参考图文件信息 */
|
|
307
|
+
referenceImage: FileInfo;
|
|
308
|
+
/** 创建时间 */
|
|
309
|
+
createdAt: string;
|
|
310
|
+
/** 更新时间 */
|
|
311
|
+
updatedAt: string;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* 列表查询响应
|
|
315
|
+
*/
|
|
316
|
+
interface ListVideoPsychAnalysesResponse {
|
|
317
|
+
/** 任务列表 */
|
|
318
|
+
list: VideoPsychAnalysisSummary[];
|
|
319
|
+
/** 总数 */
|
|
320
|
+
total: number;
|
|
321
|
+
/** 当前页码 */
|
|
322
|
+
page: number;
|
|
323
|
+
/** 每页数量 */
|
|
324
|
+
pageSize: number;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* 语言选项
|
|
328
|
+
*/
|
|
329
|
+
interface LanguageOption {
|
|
330
|
+
/** 语言标签 */
|
|
331
|
+
label: string;
|
|
332
|
+
/** 语言代码 */
|
|
333
|
+
value: string;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* 视频心理分析配置
|
|
337
|
+
*/
|
|
338
|
+
interface VideoPsychAnalysisConfig {
|
|
339
|
+
/** 语言选项列表 */
|
|
340
|
+
languageOptions: LanguageOption[];
|
|
341
|
+
/** 默认语言 */
|
|
342
|
+
defaultLanguage: string;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* 更新分析任务参数
|
|
346
|
+
*/
|
|
347
|
+
interface UpdateVideoPsychAnalysisParams {
|
|
348
|
+
/** 任务名称 */
|
|
349
|
+
name?: string;
|
|
350
|
+
/** 人物背景与分析目标 */
|
|
351
|
+
prompt?: string;
|
|
352
|
+
/** 人物背景信息(Markdown格式) */
|
|
353
|
+
familyBackground?: string;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* 更新分析任务响应
|
|
357
|
+
*/
|
|
358
|
+
interface UpdateVideoPsychAnalysisResponse {
|
|
359
|
+
/** 分析任务ID */
|
|
360
|
+
id: string;
|
|
361
|
+
/** 任务名称 */
|
|
362
|
+
name: string;
|
|
363
|
+
/** 用户Prompt */
|
|
364
|
+
prompt: string;
|
|
365
|
+
/** 人物背景信息 */
|
|
366
|
+
familyBackground: string;
|
|
367
|
+
/** 当前状态 */
|
|
368
|
+
status: VideoPsychAnalysisStatus;
|
|
369
|
+
/** 更新时间 */
|
|
370
|
+
updatedAt: string;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* 视频人物心理分析模块
|
|
375
|
+
*/
|
|
376
|
+
declare class VideoPsychAnalysis {
|
|
377
|
+
private client;
|
|
378
|
+
constructor(client: PlolinkClient);
|
|
379
|
+
/**
|
|
380
|
+
* 获取视频心理分析配置
|
|
381
|
+
*
|
|
382
|
+
* @returns 配置信息(包括语言选项等)
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```typescript
|
|
386
|
+
* const config = await videoPsych.getConfig();
|
|
387
|
+
* console.log('语言选项:', config.languageOptions);
|
|
388
|
+
* console.log('默认语言:', config.defaultLanguage);
|
|
389
|
+
* ```
|
|
390
|
+
*/
|
|
391
|
+
getConfig(): Promise<VideoPsychAnalysisConfig>;
|
|
392
|
+
/**
|
|
393
|
+
* 查询分析任务列表
|
|
394
|
+
*
|
|
395
|
+
* @param params - 查询参数(可选)
|
|
396
|
+
* @returns 任务列表
|
|
397
|
+
* @throws {PlolinkError} 当查询失败时抛出
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* // 查询所有已完成的任务
|
|
402
|
+
* const result = await videoPsych.list({
|
|
403
|
+
* status: 'COMPLETED',
|
|
404
|
+
* page: 1,
|
|
405
|
+
* pageSize: 20
|
|
406
|
+
* });
|
|
407
|
+
* console.log(`共 ${result.total} 个任务`);
|
|
408
|
+
* result.list.forEach(item => {
|
|
409
|
+
* console.log(`${item.name}: ${item.status}`);
|
|
410
|
+
* });
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
list(params?: ListVideoPsychAnalysesParams): Promise<ListVideoPsychAnalysesResponse>;
|
|
414
|
+
/**
|
|
415
|
+
* 创建视频心理分析任务
|
|
416
|
+
*
|
|
417
|
+
* @param params - 创建参数
|
|
418
|
+
* @returns 创建结果,包含任务ID和初始状态
|
|
419
|
+
* @throws {PlolinkError} 当参数验证失败或创建失败时抛出
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const result = await videoPsych.create({
|
|
424
|
+
* name: '候选人A面试分析',
|
|
425
|
+
* videoFileIds: ['file1', 'file2', 'file3'],
|
|
426
|
+
* referenceImageFileId: 'refImage1',
|
|
427
|
+
* prompt: '请以专业心理分析师的视角,分析候选人的情绪、态度和心理状态',
|
|
428
|
+
* frameFps: 3,
|
|
429
|
+
* language: 'zh'
|
|
430
|
+
* });
|
|
431
|
+
* console.log(`任务ID: ${result.id}, 状态: ${result.status}`);
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
create(params: CreateVideoPsychAnalysisParams): Promise<CreateVideoPsychAnalysisResponse>;
|
|
435
|
+
/**
|
|
436
|
+
* 获取分析任务详情
|
|
437
|
+
*
|
|
438
|
+
* @param id - 任务ID
|
|
439
|
+
* @returns 任务详情信息
|
|
440
|
+
* @throws {PlolinkError} 当任务不存在或无权访问时抛出
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```typescript
|
|
444
|
+
* const detail = await videoPsych.getDetail('analysis_123');
|
|
445
|
+
* console.log(`任务: ${detail.name}`);
|
|
446
|
+
* console.log(`状态: ${detail.status}`);
|
|
447
|
+
* console.log(`进度: ${detail.progress.done}/${detail.progress.total}`);
|
|
448
|
+
*
|
|
449
|
+
* if (detail.reportContent) {
|
|
450
|
+
* console.log('报告已生成');
|
|
451
|
+
* }
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
getDetail(id: string): Promise<VideoPsychAnalysisDetail>;
|
|
455
|
+
/**
|
|
456
|
+
* 获取视频元数据信息
|
|
457
|
+
*
|
|
458
|
+
* @description
|
|
459
|
+
* 获取任务的视频元数据信息(videoInfo)。在异步模式下,任务创建时 videoInfo 为空,
|
|
460
|
+
* 需要等待任务进入 PROCESSING 状态后由定时任务自动同步。
|
|
461
|
+
*
|
|
462
|
+
* **使用场景**:
|
|
463
|
+
* - 获取视频的宽高、时长、编码等信息用于界面展示
|
|
464
|
+
* - 在任务创建后轮询此接口直到获取到 videoInfo
|
|
465
|
+
*
|
|
466
|
+
* **注意**:
|
|
467
|
+
* - 如果视频信息尚未生成,返回 null
|
|
468
|
+
* - 建议配合任务状态查询使用,等待状态变为 PROCESSING 后再查询
|
|
469
|
+
*
|
|
470
|
+
* @param id - 任务ID
|
|
471
|
+
* @returns 视频元数据信息,如果尚未生成则返回 null
|
|
472
|
+
* @throws {PlolinkError} 当任务不存在时抛出
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* // 轮询获取 videoInfo
|
|
477
|
+
* const checkVideoInfo = async (analysisId: string) => {
|
|
478
|
+
* const maxAttempts = 60;
|
|
479
|
+
* let attempt = 0;
|
|
480
|
+
*
|
|
481
|
+
* while (attempt < maxAttempts) {
|
|
482
|
+
* const videoInfo = await videoPsych.getVideoInfo(analysisId);
|
|
483
|
+
*
|
|
484
|
+
* if (videoInfo) {
|
|
485
|
+
* console.log(`视频信息: ${videoInfo.width}x${videoInfo.height}`);
|
|
486
|
+
* console.log(`时长: ${videoInfo.duration}s`);
|
|
487
|
+
* console.log(`文件大小: ${(videoInfo.file_size / 1024 / 1024).toFixed(2)}MB`);
|
|
488
|
+
* return videoInfo;
|
|
489
|
+
* }
|
|
490
|
+
*
|
|
491
|
+
* console.log('视频信息还在处理中...');
|
|
492
|
+
* await new Promise(resolve => setTimeout(resolve, 5000)); // 等待5秒
|
|
493
|
+
* attempt++;
|
|
494
|
+
* }
|
|
495
|
+
*
|
|
496
|
+
* throw new Error('获取视频信息超时');
|
|
497
|
+
* };
|
|
498
|
+
*
|
|
499
|
+
* const info = await checkVideoInfo('analysis_123');
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
getVideoInfo(id: string): Promise<VideoInfo | null>;
|
|
503
|
+
/**
|
|
504
|
+
* 更新分析任务
|
|
505
|
+
*
|
|
506
|
+
* @description
|
|
507
|
+
* 更新分析任务的基本信息(仅限 PENDING 和 FAILED 状态的任务)。
|
|
508
|
+
*
|
|
509
|
+
* @param id - 任务ID
|
|
510
|
+
* @param params - 更新参数
|
|
511
|
+
* @returns 更新后的任务信息
|
|
512
|
+
* @throws {PlolinkError} 当任务不存在、状态不允许更新或更新失败时抛出
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
* const updated = await videoPsych.update('analysis_123', {
|
|
517
|
+
* name: '李四的心理分析',
|
|
518
|
+
* prompt: '请以临床心理学专家的视角进行分析'
|
|
519
|
+
* });
|
|
520
|
+
* console.log(`已更新: ${updated.name}`);
|
|
521
|
+
* ```
|
|
522
|
+
*/
|
|
523
|
+
update(id: string, params: UpdateVideoPsychAnalysisParams): Promise<UpdateVideoPsychAnalysisResponse>;
|
|
524
|
+
/**
|
|
525
|
+
* 删除分析任务
|
|
526
|
+
*
|
|
527
|
+
* @description
|
|
528
|
+
* 删除分析任务(软删除)。
|
|
529
|
+
*
|
|
530
|
+
* @param id - 任务ID
|
|
531
|
+
* @throws {PlolinkError} 当任务不存在或删除失败时抛出
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```typescript
|
|
535
|
+
* await videoPsych.delete('analysis_123');
|
|
536
|
+
* console.log('任务已删除');
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
delete(id: string): Promise<{
|
|
540
|
+
message: string;
|
|
541
|
+
}>;
|
|
542
|
+
/**
|
|
543
|
+
* 重试失败的分析任务
|
|
544
|
+
*
|
|
545
|
+
* @description
|
|
546
|
+
* 对失败(FAILED)状态的任务进行重试,使用原有参数重新提交到AI引擎进行分析。
|
|
547
|
+
* 重试会清空之前的错误信息和分析结果,重新开始完整的分析流程。
|
|
548
|
+
*
|
|
549
|
+
* **注意**:
|
|
550
|
+
* - 只能重试状态为 FAILED 的任务
|
|
551
|
+
* - 重试后任务状态会重置为 PENDING
|
|
552
|
+
* - 会清空之前的分析结果和报告内容
|
|
553
|
+
* - 建议配合 `watchAnalysisStatus()` 方法监听重试后的任务状态
|
|
554
|
+
*
|
|
555
|
+
* @param id - 任务ID
|
|
556
|
+
* @returns 更新后的任务信息
|
|
557
|
+
* @throws {PlolinkError} 当任务不存在、状态不是FAILED或重试失败时抛出
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```typescript
|
|
561
|
+
* // 重试失败的任务
|
|
562
|
+
* const result = await videoPsych.retry('analysis_123');
|
|
563
|
+
* console.log(`任务已重新提交: ${result.id}`);
|
|
564
|
+
* console.log(`当前状态: ${result.status}`);
|
|
565
|
+
*
|
|
566
|
+
* // 监听重试后的任务状态
|
|
567
|
+
* const poller = videoPsych.watchAnalysisStatus(result.id, (detail) => {
|
|
568
|
+
* console.log(`重试进度: ${detail.progress.done}/${detail.progress.total}`);
|
|
569
|
+
* if (detail.status === 'COMPLETED') {
|
|
570
|
+
* console.log('重试成功,分析完成!');
|
|
571
|
+
* } else if (detail.status === 'FAILED') {
|
|
572
|
+
* console.error('重试后仍失败');
|
|
573
|
+
* }
|
|
574
|
+
* });
|
|
575
|
+
* poller.start();
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
retry(id: string): Promise<VideoPsychAnalysisDetail>;
|
|
579
|
+
/**
|
|
580
|
+
* 同步任务状态
|
|
581
|
+
*
|
|
582
|
+
* @description
|
|
583
|
+
* 主动触发后端从 AI TOOLS API 同步最新状态和中间结果。
|
|
584
|
+
*
|
|
585
|
+
* **注意**:通常不需要手动调用此方法,系统会每30秒自动轮询同步所有非完成态的任务。
|
|
586
|
+
*
|
|
587
|
+
* @param id - 任务ID
|
|
588
|
+
* @returns 同步后的状态信息
|
|
589
|
+
* @throws {PlolinkError} 当任务不存在或同步失败时抛出
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* ```typescript
|
|
593
|
+
* const status = await videoPsych.syncStatus('analysis_123');
|
|
594
|
+
* console.log(`当前状态: ${status.status}`);
|
|
595
|
+
* console.log(`进度: ${status.progress.done}/${status.progress.total}`);
|
|
596
|
+
* ```
|
|
597
|
+
*/
|
|
598
|
+
syncStatus(id: string): Promise<SyncStatusResponse>;
|
|
599
|
+
/**
|
|
600
|
+
* 轮询分析任务状态
|
|
601
|
+
*
|
|
602
|
+
* @description
|
|
603
|
+
* 创建一个轮询器持续监听任务状态变化,直到任务达到终态(COMPLETED/FAILED)。
|
|
604
|
+
* 使用指数退避策略,初始间隔5秒,最大间隔30秒。
|
|
605
|
+
*
|
|
606
|
+
* @param id - 任务ID
|
|
607
|
+
* @param onStatusChange - 状态变化回调函数
|
|
608
|
+
* @returns Poller实例,可用于手动停止轮询
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* ```typescript
|
|
612
|
+
* const poller = videoPsych.watchAnalysisStatus('analysis_123', (detail) => {
|
|
613
|
+
* console.log(`状态: ${detail.status}`);
|
|
614
|
+
* console.log(`进度: ${detail.progress.done}/${detail.progress.total} (${detail.progress.stage})`);
|
|
615
|
+
*
|
|
616
|
+
* if (detail.status === 'COMPLETED') {
|
|
617
|
+
* console.log('分析完成,报告已生成!');
|
|
618
|
+
* console.log(detail.reportContent);
|
|
619
|
+
* } else if (detail.status === 'FAILED') {
|
|
620
|
+
* console.error(`分析失败: ${detail.errorMessage}`);
|
|
621
|
+
* }
|
|
622
|
+
* });
|
|
623
|
+
*
|
|
624
|
+
* // 开始轮询
|
|
625
|
+
* poller.start();
|
|
626
|
+
*
|
|
627
|
+
* // 需要时可以手动停止
|
|
628
|
+
* // poller.stop();
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
watchAnalysisStatus(id: string, onStatusChange: (detail: VideoPsychAnalysisDetail) => void): Poller<VideoPsychAnalysisDetail>;
|
|
632
|
+
/**
|
|
633
|
+
* 获取文本维度分析结果
|
|
634
|
+
*
|
|
635
|
+
* @param id - 任务ID
|
|
636
|
+
* @returns 文本维度分析数据
|
|
637
|
+
* @throws {PlolinkError} 当任务不存在或分析未完成时抛出
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```typescript
|
|
641
|
+
* const texts = await videoPsych.getTexts('analysis_123');
|
|
642
|
+
* console.log(`共 ${texts.total} 条文本`);
|
|
643
|
+
* texts.items.forEach(item => {
|
|
644
|
+
* console.log(`${item.start_time}s: ${item.text}`);
|
|
645
|
+
* if (item.nlp_result) {
|
|
646
|
+
* console.log(` 情绪: ${item.nlp_result.speaker_emotion}`);
|
|
647
|
+
* console.log(` 态度: ${item.nlp_result.real_attitude}`);
|
|
648
|
+
* }
|
|
649
|
+
* });
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
652
|
+
getTexts(id: string): Promise<TextsData>;
|
|
653
|
+
/**
|
|
654
|
+
* 获取帧维度分析结果
|
|
655
|
+
*
|
|
656
|
+
* @param id - 任务ID
|
|
657
|
+
* @returns 帧维度分析数据
|
|
658
|
+
* @throws {PlolinkError} 当任务不存在或分析未完成时抛出
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```typescript
|
|
662
|
+
* const frames = await videoPsych.getFrames('analysis_123');
|
|
663
|
+
* console.log(`共 ${frames.total} 帧`);
|
|
664
|
+
* frames.items.forEach(item => {
|
|
665
|
+
* console.log(`${item.timestamp}s: ${item.image_url}`);
|
|
666
|
+
* if (item.vision_result) {
|
|
667
|
+
* console.log(` 表情: ${item.vision_result.expression}`);
|
|
668
|
+
* console.log(` 动作: ${item.vision_result.action}`);
|
|
669
|
+
* }
|
|
670
|
+
* });
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
getFrames(id: string): Promise<FramesData>;
|
|
674
|
+
/**
|
|
675
|
+
* 获取段落分析结果
|
|
676
|
+
*
|
|
677
|
+
* @param id - 任务ID
|
|
678
|
+
* @returns 段落分析数据
|
|
679
|
+
* @throws {PlolinkError} 当任务不存在或分析未完成时抛出
|
|
680
|
+
*
|
|
681
|
+
* @example
|
|
682
|
+
* ```typescript
|
|
683
|
+
* const paragraphs = await videoPsych.getParagraphs('analysis_123');
|
|
684
|
+
* console.log(`共 ${paragraphs.total} 段`);
|
|
685
|
+
* paragraphs.items.forEach(item => {
|
|
686
|
+
* console.log(`段落 ${item.id}:`);
|
|
687
|
+
* console.log(` 时间: ${item.start_time}s - ${item.end_time}s`);
|
|
688
|
+
* console.log(` 内容: ${item.text}`);
|
|
689
|
+
* console.log(` 摘要: ${item.summary}`);
|
|
690
|
+
* if (item.nlp_result) {
|
|
691
|
+
* console.log(` 情绪: ${item.nlp_result.speaker_emotion}`);
|
|
692
|
+
* console.log(` 态度: ${item.nlp_result.real_attitude}`);
|
|
693
|
+
* }
|
|
694
|
+
* });
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
getParagraphs(id: string): Promise<ParagraphsData>;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export { type AnalysisProgress, type CreateVideoPsychAnalysisParams, type CreateVideoPsychAnalysisResponse, type FileInfo, type FrameAnalysisItem, type FramesData, type LanguageOption, type ListVideoPsychAnalysesParams, type ListVideoPsychAnalysesResponse, type ParagraphAnalysisItem, type ParagraphsData, type SyncStatusResponse, type TextAnalysisItem, type TextsData, type UpdateVideoPsychAnalysisParams, type UpdateVideoPsychAnalysisResponse, type VideoInfo, VideoPsychAnalysis, type VideoPsychAnalysisConfig, type VideoPsychAnalysisDetail, type VideoPsychAnalysisStatus, type VideoPsychAnalysisSummary };
|