@plolink/sdk 0.0.5 → 0.0.8

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.
Files changed (56) hide show
  1. package/README.md +40 -26
  2. package/dist/{chunk-4H4RACSE.js → chunk-LHNCGCWW.js} +137 -3
  3. package/dist/chunk-LHNCGCWW.js.map +1 -0
  4. package/dist/{chunk-NS3DJP2O.cjs → chunk-WFBN23AH.cjs} +141 -2
  5. package/dist/chunk-WFBN23AH.cjs.map +1 -0
  6. package/dist/client-DXKAtLg1.d.ts +848 -0
  7. package/dist/client-l6cekf09.d.cts +848 -0
  8. package/dist/common/index.cjs +18 -14
  9. package/dist/common/index.d.cts +126 -1
  10. package/dist/common/index.d.ts +126 -1
  11. package/dist/common/index.js +1 -1
  12. package/dist/index.cjs +751 -13
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +410 -3
  15. package/dist/index.d.ts +410 -3
  16. package/dist/index.js +735 -3
  17. package/dist/index.js.map +1 -1
  18. package/dist/modules/billing/index.cjs +1 -1
  19. package/dist/modules/billing/index.d.cts +1 -1
  20. package/dist/modules/billing/index.d.ts +1 -1
  21. package/dist/modules/billing/index.js +1 -1
  22. package/dist/modules/rbac/index.d.cts +1 -1
  23. package/dist/modules/rbac/index.d.ts +1 -1
  24. package/dist/modules/team/index.d.cts +1 -1
  25. package/dist/modules/team/index.d.ts +1 -1
  26. package/dist/modules/video-psych-analysis/index.cjs +123 -4
  27. package/dist/modules/video-psych-analysis/index.cjs.map +1 -1
  28. package/dist/modules/video-psych-analysis/index.d.cts +231 -93
  29. package/dist/modules/video-psych-analysis/index.d.ts +231 -93
  30. package/dist/modules/video-psych-analysis/index.js +123 -4
  31. package/dist/modules/video-psych-analysis/index.js.map +1 -1
  32. package/dist/modules/virtual-account/index.d.cts +1 -1
  33. package/dist/modules/virtual-account/index.d.ts +1 -1
  34. package/package.json +1 -16
  35. package/dist/chunk-4H4RACSE.js.map +0 -1
  36. package/dist/chunk-NS3DJP2O.cjs.map +0 -1
  37. package/dist/client-CAjIQKPm.d.cts +0 -193
  38. package/dist/client-CwNikk7i.d.ts +0 -193
  39. package/dist/modules/agent/index.cjs +0 -21
  40. package/dist/modules/agent/index.cjs.map +0 -1
  41. package/dist/modules/agent/index.d.cts +0 -71
  42. package/dist/modules/agent/index.d.ts +0 -71
  43. package/dist/modules/agent/index.js +0 -19
  44. package/dist/modules/agent/index.js.map +0 -1
  45. package/dist/modules/chat/index.cjs +0 -20
  46. package/dist/modules/chat/index.cjs.map +0 -1
  47. package/dist/modules/chat/index.d.cts +0 -68
  48. package/dist/modules/chat/index.d.ts +0 -68
  49. package/dist/modules/chat/index.js +0 -18
  50. package/dist/modules/chat/index.js.map +0 -1
  51. package/dist/modules/psych/index.cjs +0 -20
  52. package/dist/modules/psych/index.cjs.map +0 -1
  53. package/dist/modules/psych/index.d.cts +0 -69
  54. package/dist/modules/psych/index.d.ts +0 -69
  55. package/dist/modules/psych/index.js +0 -18
  56. package/dist/modules/psych/index.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { P as PlolinkClient } from '../../client-CwNikk7i.js';
1
+ import { P as PlolinkClient } from '../../client-DXKAtLg1.js';
2
2
  import { P as Poller } from '../../poller-DWKZjuSw.js';
3
3
  import '../../core-77EbLgbp.js';
4
4
  import 'axios';
@@ -20,11 +20,13 @@ interface CreateVideoPsychAnalysisParams {
20
20
  videoFileIds: string[];
21
21
  /** 人物参考图文件ID */
22
22
  referenceImageFileId: string;
23
- /** 用户Prompt(如:心理分析专家的专业风格) */
23
+ /** 人物背景与分析目标(如:视频是华为CEO任正非的公开演讲,请分析他对某话题的真实态度) */
24
24
  prompt: string;
25
+ /** 人物背景信息(Markdown格式,可选) */
26
+ familyBackground?: string;
25
27
  /** 切帧FPS(1-30,默认3) */
26
28
  frameFps?: number;
27
- /** 分析语言(默认zh) */
29
+ /** 分析语言(默认zh-CN) */
28
30
  language?: string;
29
31
  }
30
32
  /**
@@ -49,6 +51,8 @@ interface VideoInfo {
49
51
  video_bitrate: number;
50
52
  /** 音频比特率 */
51
53
  audio_bitrate: number | null;
54
+ /** 首帧图URL */
55
+ first_frame_url?: string | null;
52
56
  }
53
57
  /**
54
58
  * 进度信息
@@ -61,6 +65,21 @@ interface AnalysisProgress {
61
65
  /** 当前阶段 */
62
66
  stage: string;
63
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
+ }
64
83
  /**
65
84
  * 创建分析任务响应
66
85
  */
@@ -96,6 +115,18 @@ interface VideoPsychAnalysisDetail {
96
115
  createdAt: string;
97
116
  /** 更新时间 */
98
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;
99
130
  }
100
131
  /**
101
132
  * 同步任务状态响应
@@ -108,6 +139,38 @@ interface SyncStatusResponse {
108
139
  /** 提示消息 */
109
140
  message: string;
110
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
+ }
111
174
  /**
112
175
  * 文本维度分析项
113
176
  */
@@ -116,21 +179,18 @@ interface TextAnalysisItem {
116
179
  id: string;
117
180
  /** 文本内容 */
118
181
  text: string;
119
- /** 开始时间(秒) */
120
- start_time: number;
121
- /** 结束时间(秒) */
122
- end_time: number;
123
- /** NLP分析结果 */
124
- nlp_result?: {
125
- /** 说话人情绪 */
126
- speaker_emotion?: string;
127
- /** 真实态度 */
128
- real_attitude?: string;
129
- /** 其他NLP字段 */
130
- [key: string]: unknown;
131
- };
132
- /** 其他字段 */
133
- [key: string]: unknown;
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[];
134
194
  }
135
195
  /**
136
196
  * 文本维度结果
@@ -145,23 +205,16 @@ interface TextsData {
145
205
  * 帧维度分析项
146
206
  */
147
207
  interface FrameAnalysisItem {
148
- /** 帧ID */
149
- id: string;
150
- /** 帧图片URL */
151
- image_url: string;
152
- /** 时间戳(秒) */
153
- timestamp: number;
154
- /** 视觉分析结果 */
155
- vision_result?: {
156
- /** 表情 */
157
- expression?: string;
158
- /** 动作 */
159
- action?: string;
160
- /** 其他视觉字段 */
161
- [key: string]: unknown;
162
- };
163
- /** 其他字段 */
164
- [key: string]: unknown;
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;
165
218
  }
166
219
  /**
167
220
  * 帧维度结果
@@ -177,26 +230,32 @@ interface FramesData {
177
230
  */
178
231
  interface ParagraphAnalysisItem {
179
232
  /** 段落ID */
180
- id: string;
233
+ group_id: string;
181
234
  /** 段落文本 */
182
235
  text: string;
183
236
  /** 段落摘要 */
184
237
  summary: string;
185
- /** 开始时间(秒) */
186
- start_time: number;
187
- /** 结束时间(秒) */
188
- end_time: number;
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;
189
248
  /** NLP分析结果 */
190
249
  nlp_result?: {
250
+ /** 行为一致性(0-1) */
251
+ behavior_consistency?: number;
191
252
  /** 说话人情绪 */
192
253
  speaker_emotion?: string;
254
+ /** 情绪强度(0-1) */
255
+ speaker_emotion_intensity?: number;
193
256
  /** 真实态度 */
194
257
  real_attitude?: string;
195
- /** 其他NLP字段 */
196
- [key: string]: unknown;
197
258
  };
198
- /** 其他字段 */
199
- [key: string]: unknown;
200
259
  }
201
260
  /**
202
261
  * 段落结果
@@ -240,6 +299,12 @@ interface VideoPsychAnalysisSummary {
240
299
  errorMessage: string;
241
300
  /** 报告生成时间 */
242
301
  reportGeneratedAt: string | null;
302
+ /** 视频元信息(任务提交后更新) */
303
+ videoInfo: VideoInfo | null;
304
+ /** 视频文件信息列表 */
305
+ videoFiles: FileInfo[];
306
+ /** 参考图文件信息 */
307
+ referenceImage: FileInfo;
243
308
  /** 创建时间 */
244
309
  createdAt: string;
245
310
  /** 更新时间 */
@@ -258,14 +323,34 @@ interface ListVideoPsychAnalysesResponse {
258
323
  /** 每页数量 */
259
324
  pageSize: number;
260
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
+ }
261
344
  /**
262
345
  * 更新分析任务参数
263
346
  */
264
347
  interface UpdateVideoPsychAnalysisParams {
265
348
  /** 任务名称 */
266
349
  name?: string;
267
- /** 用户Prompt */
350
+ /** 人物背景与分析目标 */
268
351
  prompt?: string;
352
+ /** 人物背景信息(Markdown格式) */
353
+ familyBackground?: string;
269
354
  }
270
355
  /**
271
356
  * 更新分析任务响应
@@ -277,65 +362,33 @@ interface UpdateVideoPsychAnalysisResponse {
277
362
  name: string;
278
363
  /** 用户Prompt */
279
364
  prompt: string;
365
+ /** 人物背景信息 */
366
+ familyBackground: string;
280
367
  /** 当前状态 */
281
368
  status: VideoPsychAnalysisStatus;
282
369
  /** 更新时间 */
283
370
  updatedAt: string;
284
371
  }
285
372
 
286
- /**
287
- * 视频人物心理分析模块
288
- *
289
- * @description
290
- * 提供视频人物心理分析相关功能,包括:
291
- * - 创建分析任务
292
- * - 查询任务详情和状态
293
- * - 同步任务状态(轮询)
294
- * - 获取分析结果(文本/帧/段落维度)
295
- * - 生成心理分析报告
296
- *
297
- * @example
298
- * ```typescript
299
- * import { PlolinkClient } from '@plolink/sdk';
300
- * import { VideoPsychAnalysis } from '@plolink/sdk/video-psych-analysis';
301
- *
302
- * const client = new PlolinkClient({
303
- * mode: 'apiKey',
304
- * apiKey: 'your-api-key'
305
- * });
306
- *
307
- * const videoPsych = new VideoPsychAnalysis(client);
308
- *
309
- * // 创建分析任务
310
- * const result = await videoPsych.create({
311
- * name: '候选人A面试分析',
312
- * videoFileIds: ['file1', 'file2'],
313
- * referenceImageFileId: 'refImage1',
314
- * prompt: '请以专业心理分析师的视角进行分析',
315
- * frameFps: 3,
316
- * language: 'zh'
317
- * });
318
- * console.log(`任务已创建: ${result.id}`);
319
- *
320
- * // 轮询任务状态
321
- * const poller = videoPsych.watchAnalysisStatus(result.id, (detail) => {
322
- * console.log(`分析进度: ${detail.progress.done}/${detail.progress.total}`);
323
- * if (detail.status === 'COMPLETED') {
324
- * console.log('分析完成,报告已生成!');
325
- * console.log(detail.reportContent);
326
- * }
327
- * });
328
- * ```
329
- *
330
- * @module video-psych-analysis
331
- */
332
-
333
373
  /**
334
374
  * 视频人物心理分析模块
335
375
  */
336
376
  declare class VideoPsychAnalysis {
337
377
  private client;
338
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>;
339
392
  /**
340
393
  * 查询分析任务列表
341
394
  *
@@ -399,6 +452,54 @@ declare class VideoPsychAnalysis {
399
452
  * ```
400
453
  */
401
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>;
402
503
  /**
403
504
  * 更新分析任务
404
505
  *
@@ -438,6 +539,43 @@ declare class VideoPsychAnalysis {
438
539
  delete(id: string): Promise<{
439
540
  message: string;
440
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>;
441
579
  /**
442
580
  * 同步任务状态
443
581
  *
@@ -559,4 +697,4 @@ declare class VideoPsychAnalysis {
559
697
  getParagraphs(id: string): Promise<ParagraphsData>;
560
698
  }
561
699
 
562
- export { type AnalysisProgress, type CreateVideoPsychAnalysisParams, type CreateVideoPsychAnalysisResponse, type FrameAnalysisItem, type FramesData, type ListVideoPsychAnalysesParams, type ListVideoPsychAnalysesResponse, type ParagraphAnalysisItem, type ParagraphsData, type SyncStatusResponse, type TextAnalysisItem, type TextsData, type UpdateVideoPsychAnalysisParams, type UpdateVideoPsychAnalysisResponse, type VideoInfo, VideoPsychAnalysis, type VideoPsychAnalysisDetail, type VideoPsychAnalysisStatus, type VideoPsychAnalysisSummary };
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 };
@@ -1,11 +1,26 @@
1
- import { Poller } from '../../chunk-IHAAKFEJ.js';
2
1
  import { PlolinkError } from '../../chunk-MD4O7FWT.js';
2
+ import { Poller } from '../../chunk-IHAAKFEJ.js';
3
3
 
4
4
  // src/modules/video-psych-analysis/index.ts
5
5
  var VideoPsychAnalysis = class {
6
6
  constructor(client) {
7
7
  this.client = client;
8
8
  }
9
+ /**
10
+ * 获取视频心理分析配置
11
+ *
12
+ * @returns 配置信息(包括语言选项等)
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const config = await videoPsych.getConfig();
17
+ * console.log('语言选项:', config.languageOptions);
18
+ * console.log('默认语言:', config.defaultLanguage);
19
+ * ```
20
+ */
21
+ async getConfig() {
22
+ return this.client.axiosInstance.get("/api/v1/video-psych-analysis/config");
23
+ }
9
24
  /**
10
25
  * 查询分析任务列表
11
26
  *
@@ -51,7 +66,7 @@ var VideoPsychAnalysis = class {
51
66
  * ```
52
67
  */
53
68
  async create(params) {
54
- const { videoFileIds, referenceImageFileId, prompt, frameFps, language, name } = params;
69
+ const { videoFileIds, referenceImageFileId, prompt, familyBackground, frameFps, language, name } = params;
55
70
  if (!videoFileIds || videoFileIds.length === 0) {
56
71
  throw new PlolinkError("videoFileIds is required and must not be empty", "INVALID_PARAMS");
57
72
  }
@@ -69,6 +84,7 @@ var VideoPsychAnalysis = class {
69
84
  videoFileIds,
70
85
  referenceImageFileId,
71
86
  prompt,
87
+ familyBackground,
72
88
  frameFps,
73
89
  language
74
90
  });
@@ -98,6 +114,67 @@ var VideoPsychAnalysis = class {
98
114
  }
99
115
  return this.client.axiosInstance.get(`/api/v1/video-psych-analysis/${id}`);
100
116
  }
117
+ /**
118
+ * 获取视频元数据信息
119
+ *
120
+ * @description
121
+ * 获取任务的视频元数据信息(videoInfo)。在异步模式下,任务创建时 videoInfo 为空,
122
+ * 需要等待任务进入 PROCESSING 状态后由定时任务自动同步。
123
+ *
124
+ * **使用场景**:
125
+ * - 获取视频的宽高、时长、编码等信息用于界面展示
126
+ * - 在任务创建后轮询此接口直到获取到 videoInfo
127
+ *
128
+ * **注意**:
129
+ * - 如果视频信息尚未生成,返回 null
130
+ * - 建议配合任务状态查询使用,等待状态变为 PROCESSING 后再查询
131
+ *
132
+ * @param id - 任务ID
133
+ * @returns 视频元数据信息,如果尚未生成则返回 null
134
+ * @throws {PlolinkError} 当任务不存在时抛出
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * // 轮询获取 videoInfo
139
+ * const checkVideoInfo = async (analysisId: string) => {
140
+ * const maxAttempts = 60;
141
+ * let attempt = 0;
142
+ *
143
+ * while (attempt < maxAttempts) {
144
+ * const videoInfo = await videoPsych.getVideoInfo(analysisId);
145
+ *
146
+ * if (videoInfo) {
147
+ * console.log(`视频信息: ${videoInfo.width}x${videoInfo.height}`);
148
+ * console.log(`时长: ${videoInfo.duration}s`);
149
+ * console.log(`文件大小: ${(videoInfo.file_size / 1024 / 1024).toFixed(2)}MB`);
150
+ * return videoInfo;
151
+ * }
152
+ *
153
+ * console.log('视频信息还在处理中...');
154
+ * await new Promise(resolve => setTimeout(resolve, 5000)); // 等待5秒
155
+ * attempt++;
156
+ * }
157
+ *
158
+ * throw new Error('获取视频信息超时');
159
+ * };
160
+ *
161
+ * const info = await checkVideoInfo('analysis_123');
162
+ * ```
163
+ */
164
+ async getVideoInfo(id) {
165
+ if (!id) {
166
+ throw new PlolinkError("id is required", "INVALID_PARAMS");
167
+ }
168
+ try {
169
+ const response = await this.client.axiosInstance.get(`/api/v1/video-psych-analysis/${id}/video-info`);
170
+ return response.videoInfo || null;
171
+ } catch (error) {
172
+ if (error instanceof PlolinkError && error.code === 404) {
173
+ return null;
174
+ }
175
+ throw error;
176
+ }
177
+ }
101
178
  /**
102
179
  * 更新分析任务
103
180
  *
@@ -122,8 +199,8 @@ var VideoPsychAnalysis = class {
122
199
  if (!id) {
123
200
  throw new PlolinkError("id is required", "INVALID_PARAMS");
124
201
  }
125
- if (!params.name && !params.prompt) {
126
- throw new PlolinkError("At least one field (name or prompt) must be provided", "INVALID_PARAMS");
202
+ if (!params.name && !params.prompt && !params.familyBackground) {
203
+ throw new PlolinkError("At least one field (name, prompt, or familyBackground) must be provided", "INVALID_PARAMS");
127
204
  }
128
205
  return this.client.axiosInstance.patch(`/api/v1/video-psych-analysis/${id}`, params);
129
206
  }
@@ -148,6 +225,48 @@ var VideoPsychAnalysis = class {
148
225
  }
149
226
  return this.client.axiosInstance.delete(`/api/v1/video-psych-analysis/${id}`);
150
227
  }
228
+ /**
229
+ * 重试失败的分析任务
230
+ *
231
+ * @description
232
+ * 对失败(FAILED)状态的任务进行重试,使用原有参数重新提交到AI引擎进行分析。
233
+ * 重试会清空之前的错误信息和分析结果,重新开始完整的分析流程。
234
+ *
235
+ * **注意**:
236
+ * - 只能重试状态为 FAILED 的任务
237
+ * - 重试后任务状态会重置为 PENDING
238
+ * - 会清空之前的分析结果和报告内容
239
+ * - 建议配合 `watchAnalysisStatus()` 方法监听重试后的任务状态
240
+ *
241
+ * @param id - 任务ID
242
+ * @returns 更新后的任务信息
243
+ * @throws {PlolinkError} 当任务不存在、状态不是FAILED或重试失败时抛出
244
+ *
245
+ * @example
246
+ * ```typescript
247
+ * // 重试失败的任务
248
+ * const result = await videoPsych.retry('analysis_123');
249
+ * console.log(`任务已重新提交: ${result.id}`);
250
+ * console.log(`当前状态: ${result.status}`);
251
+ *
252
+ * // 监听重试后的任务状态
253
+ * const poller = videoPsych.watchAnalysisStatus(result.id, (detail) => {
254
+ * console.log(`重试进度: ${detail.progress.done}/${detail.progress.total}`);
255
+ * if (detail.status === 'COMPLETED') {
256
+ * console.log('重试成功,分析完成!');
257
+ * } else if (detail.status === 'FAILED') {
258
+ * console.error('重试后仍失败');
259
+ * }
260
+ * });
261
+ * poller.start();
262
+ * ```
263
+ */
264
+ async retry(id) {
265
+ if (!id) {
266
+ throw new PlolinkError("id is required", "INVALID_PARAMS");
267
+ }
268
+ return this.client.axiosInstance.post(`/api/v1/video-psych-analysis/${id}/retry`);
269
+ }
151
270
  /**
152
271
  * 同步任务状态
153
272
  *