Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ai_token_usages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->comment('테넌트 ID');
|
||||
$table->string('model', 100)->comment('AI 모델명 (gemini-2.0-flash 등)');
|
||||
$table->string('menu_name', 100)->comment('호출 메뉴/기능명 (AI리포트, 명함OCR 등)');
|
||||
$table->unsignedInteger('prompt_tokens')->default(0)->comment('입력 토큰 수');
|
||||
$table->unsignedInteger('completion_tokens')->default(0)->comment('출력 토큰 수');
|
||||
$table->unsignedInteger('total_tokens')->default(0)->comment('전체 토큰 수');
|
||||
$table->decimal('cost_usd', 10, 6)->default(0)->comment('예상 비용 (USD)');
|
||||
$table->decimal('cost_krw', 12, 2)->default(0)->comment('예상 비용 (KRW)');
|
||||
$table->string('request_id', 100)->nullable()->comment('요청 추적 ID');
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->comment('생성자 ID');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['tenant_id', 'created_at'], 'idx_ai_token_tenant_date');
|
||||
$table->index(['tenant_id', 'menu_name'], 'idx_ai_token_tenant_menu');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ai_token_usages');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ai_voice_recordings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
|
||||
$table->unsignedBigInteger('user_id')->comment('작성자 ID');
|
||||
$table->string('title', 200)->comment('녹음 제목');
|
||||
$table->unsignedBigInteger('interview_template_id')->nullable()->comment('연결된 인터뷰 템플릿 ID');
|
||||
$table->string('audio_file_path', 500)->nullable()->comment('GCS 오브젝트 경로');
|
||||
$table->string('audio_gcs_uri', 500)->nullable()->comment('GCS URI (gs://...)');
|
||||
$table->longText('transcript_text')->nullable()->comment('STT 변환 텍스트');
|
||||
$table->longText('analysis_text')->nullable()->comment('Gemini AI 분석 결과');
|
||||
$table->string('status', 20)->default('PENDING')->comment('상태: PENDING, PROCESSING, COMPLETED, FAILED');
|
||||
$table->unsignedInteger('duration_seconds')->nullable()->comment('녹음 시간(초)');
|
||||
$table->timestamp('file_expiry_date')->nullable()->comment('파일 삭제 예정일');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index('tenant_id');
|
||||
$table->index('user_id');
|
||||
$table->index('status');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ai_voice_recordings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ai_pricing_configs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('provider', 50)->comment('제공자 (gemini, claude, google-stt, google-gcs)');
|
||||
$table->string('model_name', 100)->comment('모델명 (gemini-2.0-flash, claude-3-haiku 등)');
|
||||
$table->decimal('input_price_per_million', 10, 4)->default(0)->comment('입력 토큰 백만개당 가격 (USD)');
|
||||
$table->decimal('output_price_per_million', 10, 4)->default(0)->comment('출력 토큰 백만개당 가격 (USD)');
|
||||
$table->decimal('unit_price', 10, 6)->default(0)->comment('단위 가격 (STT: 15초당, GCS: 1000건당)');
|
||||
$table->string('unit_description', 100)->nullable()->comment('단위 설명 (예: per 15 seconds)');
|
||||
$table->decimal('exchange_rate', 8, 2)->default(1400)->comment('USD→KRW 환율');
|
||||
$table->boolean('is_active')->default(true)->comment('활성 여부');
|
||||
$table->string('description', 255)->nullable()->comment('설명');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique('provider', 'uq_ai_pricing_provider');
|
||||
$table->index('is_active', 'idx_ai_pricing_active');
|
||||
});
|
||||
|
||||
// 기본 시드 데이터 삽입
|
||||
$now = now();
|
||||
DB::table('ai_pricing_configs')->insert([
|
||||
[
|
||||
'provider' => 'gemini',
|
||||
'model_name' => 'gemini-2.0-flash',
|
||||
'input_price_per_million' => 0.1000,
|
||||
'output_price_per_million' => 0.4000,
|
||||
'unit_price' => 0,
|
||||
'unit_description' => null,
|
||||
'exchange_rate' => 1400,
|
||||
'is_active' => true,
|
||||
'description' => 'Gemini 2.0 Flash - 입력 $0.10/1M, 출력 $0.40/1M',
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
[
|
||||
'provider' => 'claude',
|
||||
'model_name' => 'claude-3-haiku',
|
||||
'input_price_per_million' => 0.2500,
|
||||
'output_price_per_million' => 1.2500,
|
||||
'unit_price' => 0,
|
||||
'unit_description' => null,
|
||||
'exchange_rate' => 1400,
|
||||
'is_active' => true,
|
||||
'description' => 'Claude 3 Haiku - 입력 $0.25/1M, 출력 $1.25/1M',
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
[
|
||||
'provider' => 'google-stt',
|
||||
'model_name' => 'latest_long',
|
||||
'input_price_per_million' => 0,
|
||||
'output_price_per_million' => 0,
|
||||
'unit_price' => 0.009000,
|
||||
'unit_description' => 'per 15 seconds',
|
||||
'exchange_rate' => 1400,
|
||||
'is_active' => true,
|
||||
'description' => 'Google Speech-to-Text - $0.009/15초',
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
[
|
||||
'provider' => 'google-gcs',
|
||||
'model_name' => 'cloud-storage',
|
||||
'input_price_per_million' => 0,
|
||||
'output_price_per_million' => 0,
|
||||
'unit_price' => 0.005000,
|
||||
'unit_description' => 'per 1000 operations',
|
||||
'exchange_rate' => 1400,
|
||||
'is_active' => true,
|
||||
'description' => 'Google Cloud Storage - $0.005/1000건',
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ai_pricing_configs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user