Files
sam-manage/app/Models/TutorialVideo.php
김보곤 768bc30a6d feat:사용자 매뉴얼 영상 자동 생성 기능 구현
- TutorialVideo 모델 (상태 관리, TenantScope)
- GeminiScriptService에 callGeminiWithParts() 멀티모달 지원 추가
- ScreenAnalysisService: Gemini Vision 스크린샷 AI 분석
- SlideAnnotationService: PHP GD 이미지 어노테이션 (마커, 캡션)
- TutorialAssemblyService: FFmpeg 이미지→영상 합성 (crossfade)
- TutorialVideoJob: 분석→슬라이드→TTS→BGM→합성 파이프라인
- TutorialVideoController: 업로드/분석/생성/상태/다운로드/이력 API
- React-in-Blade UI: 3단계 (업로드→분석확인→생성모니터링) + 이력

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:56:39 +09:00

70 lines
1.6 KiB
PHP

<?php
namespace App\Models;
use App\Models\Scopes\TenantScope;
use Illuminate\Database\Eloquent\Model;
class TutorialVideo extends Model
{
protected $fillable = [
'tenant_id',
'user_id',
'title',
'status',
'progress',
'current_step',
'screenshots',
'analysis_data',
'slides_data',
'output_path',
'gcs_path',
'cost_usd',
'error_message',
];
protected $casts = [
'screenshots' => 'array',
'analysis_data' => 'array',
'slides_data' => 'array',
'progress' => 'integer',
'cost_usd' => 'decimal:4',
];
protected static function booted(): void
{
static::addGlobalScope(new TenantScope);
}
public function user()
{
return $this->belongsTo(\App\Models\User::class);
}
const STATUS_PENDING = 'pending';
const STATUS_ANALYZING = 'analyzing';
const STATUS_GENERATING_SLIDES = 'generating_slides';
const STATUS_GENERATING_TTS = 'generating_tts';
const STATUS_GENERATING_BGM = 'generating_bgm';
const STATUS_ASSEMBLING = 'assembling';
const STATUS_COMPLETED = 'completed';
const STATUS_FAILED = 'failed';
public function updateProgress(string $status, int $progress, string $step): void
{
$this->update([
'status' => $status,
'progress' => $progress,
'current_step' => $step,
]);
}
public function markFailed(string $errorMessage): void
{
$this->update([
'status' => self::STATUS_FAILED,
'error_message' => $errorMessage,
]);
}
}