llm-content-creator 0.1.0
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 +309 -0
- package/dist/application/workflow/SyncExecutor.d.ts +75 -0
- package/dist/application/workflow/SyncExecutor.d.ts.map +1 -0
- package/dist/application/workflow/SyncExecutor.js +370 -0
- package/dist/application/workflow/SyncExecutor.js.map +1 -0
- package/dist/application/workflow/types.d.ts +46 -0
- package/dist/application/workflow/types.d.ts.map +1 -0
- package/dist/application/workflow/types.js +7 -0
- package/dist/application/workflow/types.js.map +1 -0
- package/dist/config/index.d.ts +173 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +288 -0
- package/dist/config/index.js.map +1 -0
- package/dist/domain/entities/QualityCheck.d.ts +181 -0
- package/dist/domain/entities/QualityCheck.d.ts.map +1 -0
- package/dist/domain/entities/QualityCheck.js +39 -0
- package/dist/domain/entities/QualityCheck.js.map +1 -0
- package/dist/domain/entities/Result.d.ts +103 -0
- package/dist/domain/entities/Result.d.ts.map +1 -0
- package/dist/domain/entities/Result.js +15 -0
- package/dist/domain/entities/Result.js.map +1 -0
- package/dist/domain/entities/Task.d.ts +130 -0
- package/dist/domain/entities/Task.d.ts.map +1 -0
- package/dist/domain/entities/Task.js +64 -0
- package/dist/domain/entities/Task.js.map +1 -0
- package/dist/domain/entities/TaskStep.d.ts +160 -0
- package/dist/domain/entities/TaskStep.d.ts.map +1 -0
- package/dist/domain/entities/TaskStep.js +30 -0
- package/dist/domain/entities/TaskStep.js.map +1 -0
- package/dist/domain/entities/TokenUsage.d.ts +70 -0
- package/dist/domain/entities/TokenUsage.d.ts.map +1 -0
- package/dist/domain/entities/TokenUsage.js +42 -0
- package/dist/domain/entities/TokenUsage.js.map +1 -0
- package/dist/domain/entities/index.d.ts +11 -0
- package/dist/domain/entities/index.d.ts.map +1 -0
- package/dist/domain/entities/index.js +16 -0
- package/dist/domain/entities/index.js.map +1 -0
- package/dist/domain/repositories/QualityCheckRepository.d.ts +49 -0
- package/dist/domain/repositories/QualityCheckRepository.d.ts.map +1 -0
- package/dist/domain/repositories/QualityCheckRepository.js +5 -0
- package/dist/domain/repositories/QualityCheckRepository.js.map +1 -0
- package/dist/domain/repositories/ResultRepository.d.ts +43 -0
- package/dist/domain/repositories/ResultRepository.d.ts.map +1 -0
- package/dist/domain/repositories/ResultRepository.js +5 -0
- package/dist/domain/repositories/ResultRepository.js.map +1 -0
- package/dist/domain/repositories/TaskRepository.d.ts +240 -0
- package/dist/domain/repositories/TaskRepository.d.ts.map +1 -0
- package/dist/domain/repositories/TaskRepository.js +7 -0
- package/dist/domain/repositories/TaskRepository.js.map +1 -0
- package/dist/domain/workflow/CheckpointManager.d.ts +94 -0
- package/dist/domain/workflow/CheckpointManager.d.ts.map +1 -0
- package/dist/domain/workflow/CheckpointManager.js +224 -0
- package/dist/domain/workflow/CheckpointManager.js.map +1 -0
- package/dist/domain/workflow/ContentCreatorGraph.d.ts +17 -0
- package/dist/domain/workflow/ContentCreatorGraph.d.ts.map +1 -0
- package/dist/domain/workflow/ContentCreatorGraph.js +381 -0
- package/dist/domain/workflow/ContentCreatorGraph.js.map +1 -0
- package/dist/domain/workflow/State.d.ts +172 -0
- package/dist/domain/workflow/State.d.ts.map +1 -0
- package/dist/domain/workflow/State.js +184 -0
- package/dist/domain/workflow/State.js.map +1 -0
- package/dist/domain/workflow/index.d.ts +11 -0
- package/dist/domain/workflow/index.d.ts.map +1 -0
- package/dist/domain/workflow/index.js +15 -0
- package/dist/domain/workflow/index.js.map +1 -0
- package/dist/domain/workflow/nodes/BaseNode.d.ts +134 -0
- package/dist/domain/workflow/nodes/BaseNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/BaseNode.js +253 -0
- package/dist/domain/workflow/nodes/BaseNode.js.map +1 -0
- package/dist/domain/workflow/nodes/CheckImageNode.d.ts +43 -0
- package/dist/domain/workflow/nodes/CheckImageNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/CheckImageNode.js +254 -0
- package/dist/domain/workflow/nodes/CheckImageNode.js.map +1 -0
- package/dist/domain/workflow/nodes/CheckTextNode.d.ts +66 -0
- package/dist/domain/workflow/nodes/CheckTextNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/CheckTextNode.js +530 -0
- package/dist/domain/workflow/nodes/CheckTextNode.js.map +1 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.d.ts +44 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.js +272 -0
- package/dist/domain/workflow/nodes/GenerateImageNode.js.map +1 -0
- package/dist/domain/workflow/nodes/OrganizeNode.d.ts +49 -0
- package/dist/domain/workflow/nodes/OrganizeNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/OrganizeNode.js +241 -0
- package/dist/domain/workflow/nodes/OrganizeNode.js.map +1 -0
- package/dist/domain/workflow/nodes/SearchNode.d.ts +48 -0
- package/dist/domain/workflow/nodes/SearchNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/SearchNode.js +151 -0
- package/dist/domain/workflow/nodes/SearchNode.js.map +1 -0
- package/dist/domain/workflow/nodes/WriteNode.d.ts +68 -0
- package/dist/domain/workflow/nodes/WriteNode.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/WriteNode.js +431 -0
- package/dist/domain/workflow/nodes/WriteNode.js.map +1 -0
- package/dist/domain/workflow/nodes/config/index.js +287 -0
- package/dist/domain/workflow/nodes/domain/entities/Task.js +68 -0
- package/dist/domain/workflow/nodes/domain/workflow/State.js +200 -0
- package/dist/domain/workflow/nodes/domain/workflow/nodes/BaseNode.js +328 -0
- package/dist/domain/workflow/nodes/domain/workflow/nodes/CheckTextNode.js +500 -0
- package/dist/domain/workflow/nodes/index.d.ts +13 -0
- package/dist/domain/workflow/nodes/index.d.ts.map +1 -0
- package/dist/domain/workflow/nodes/index.js +13 -0
- package/dist/domain/workflow/nodes/index.js.map +1 -0
- package/dist/domain/workflow/nodes/infrastructure/logging/logger.js +275 -0
- package/dist/domain/workflow/nodes/services/llm/EnhancedLLMService.js +559 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/cache/CacheService.d.ts +139 -0
- package/dist/infrastructure/cache/CacheService.d.ts.map +1 -0
- package/dist/infrastructure/cache/CacheService.js +419 -0
- package/dist/infrastructure/cache/CacheService.js.map +1 -0
- package/dist/infrastructure/cache/index.d.ts +5 -0
- package/dist/infrastructure/cache/index.d.ts.map +1 -0
- package/dist/infrastructure/cache/index.js +6 -0
- package/dist/infrastructure/cache/index.js.map +1 -0
- package/dist/infrastructure/database/BaseRepository.d.ts +98 -0
- package/dist/infrastructure/database/BaseRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/BaseRepository.js +178 -0
- package/dist/infrastructure/database/BaseRepository.js.map +1 -0
- package/dist/infrastructure/database/MemoryTaskRepository.d.ts +77 -0
- package/dist/infrastructure/database/MemoryTaskRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/MemoryTaskRepository.js +309 -0
- package/dist/infrastructure/database/MemoryTaskRepository.js.map +1 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.d.ts +36 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.js +89 -0
- package/dist/infrastructure/database/PostgresQualityCheckRepository.js.map +1 -0
- package/dist/infrastructure/database/PostgresTaskRepository.d.ts +94 -0
- package/dist/infrastructure/database/PostgresTaskRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/PostgresTaskRepository.js +364 -0
- package/dist/infrastructure/database/PostgresTaskRepository.js.map +1 -0
- package/dist/infrastructure/database/ResultRepository.d.ts +41 -0
- package/dist/infrastructure/database/ResultRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/ResultRepository.js +86 -0
- package/dist/infrastructure/database/ResultRepository.js.map +1 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.d.ts +101 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.d.ts.map +1 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.js +548 -0
- package/dist/infrastructure/database/SQLiteTaskRepository.js.map +1 -0
- package/dist/infrastructure/database/index.d.ts +32 -0
- package/dist/infrastructure/database/index.d.ts.map +1 -0
- package/dist/infrastructure/database/index.js +72 -0
- package/dist/infrastructure/database/index.js.map +1 -0
- package/dist/infrastructure/logging/logger.d.ts +69 -0
- package/dist/infrastructure/logging/logger.d.ts.map +1 -0
- package/dist/infrastructure/logging/logger.js +169 -0
- package/dist/infrastructure/logging/logger.js.map +1 -0
- package/dist/infrastructure/monitoring/LoggingService.d.ts +109 -0
- package/dist/infrastructure/monitoring/LoggingService.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/LoggingService.js +198 -0
- package/dist/infrastructure/monitoring/LoggingService.js.map +1 -0
- package/dist/infrastructure/monitoring/MetricsService.d.ts +112 -0
- package/dist/infrastructure/monitoring/MetricsService.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/MetricsService.js +362 -0
- package/dist/infrastructure/monitoring/MetricsService.js.map +1 -0
- package/dist/infrastructure/monitoring/SentryService.d.ts +108 -0
- package/dist/infrastructure/monitoring/SentryService.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/SentryService.js +282 -0
- package/dist/infrastructure/monitoring/SentryService.js.map +1 -0
- package/dist/infrastructure/monitoring/index.d.ts +7 -0
- package/dist/infrastructure/monitoring/index.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/index.js +10 -0
- package/dist/infrastructure/monitoring/index.js.map +1 -0
- package/dist/infrastructure/queue/TaskQueue.d.ts +110 -0
- package/dist/infrastructure/queue/TaskQueue.d.ts.map +1 -0
- package/dist/infrastructure/queue/TaskQueue.js +363 -0
- package/dist/infrastructure/queue/TaskQueue.js.map +1 -0
- package/dist/infrastructure/queue/index.d.ts +5 -0
- package/dist/infrastructure/queue/index.d.ts.map +1 -0
- package/dist/infrastructure/queue/index.js +5 -0
- package/dist/infrastructure/queue/index.js.map +1 -0
- package/dist/infrastructure/redis/connection.d.ts +61 -0
- package/dist/infrastructure/redis/connection.d.ts.map +1 -0
- package/dist/infrastructure/redis/connection.js +184 -0
- package/dist/infrastructure/redis/connection.js.map +1 -0
- package/dist/infrastructure/redis/index.d.ts +5 -0
- package/dist/infrastructure/redis/index.d.ts.map +1 -0
- package/dist/infrastructure/redis/index.js +5 -0
- package/dist/infrastructure/redis/index.js.map +1 -0
- package/dist/infrastructure/security/ApiKeyService.d.ts +103 -0
- package/dist/infrastructure/security/ApiKeyService.d.ts.map +1 -0
- package/dist/infrastructure/security/ApiKeyService.js +250 -0
- package/dist/infrastructure/security/ApiKeyService.js.map +1 -0
- package/dist/infrastructure/security/QuotaService.d.ts +87 -0
- package/dist/infrastructure/security/QuotaService.d.ts.map +1 -0
- package/dist/infrastructure/security/QuotaService.js +303 -0
- package/dist/infrastructure/security/QuotaService.js.map +1 -0
- package/dist/infrastructure/security/RateLimiter.d.ts +104 -0
- package/dist/infrastructure/security/RateLimiter.d.ts.map +1 -0
- package/dist/infrastructure/security/RateLimiter.js +331 -0
- package/dist/infrastructure/security/RateLimiter.js.map +1 -0
- package/dist/infrastructure/security/index.d.ts +7 -0
- package/dist/infrastructure/security/index.d.ts.map +1 -0
- package/dist/infrastructure/security/index.js +10 -0
- package/dist/infrastructure/security/index.js.map +1 -0
- package/dist/monitoring/index.d.ts +5 -0
- package/dist/monitoring/index.d.ts.map +1 -0
- package/dist/monitoring/index.js +5 -0
- package/dist/monitoring/index.js.map +1 -0
- package/dist/monitoring/server.d.ts +14 -0
- package/dist/monitoring/server.d.ts.map +1 -0
- package/dist/monitoring/server.js +99 -0
- package/dist/monitoring/server.js.map +1 -0
- package/dist/presentation/cli/commands/cancel.d.ts +8 -0
- package/dist/presentation/cli/commands/cancel.d.ts.map +1 -0
- package/dist/presentation/cli/commands/cancel.js +57 -0
- package/dist/presentation/cli/commands/cancel.js.map +1 -0
- package/dist/presentation/cli/commands/create.d.ts +8 -0
- package/dist/presentation/cli/commands/create.d.ts.map +1 -0
- package/dist/presentation/cli/commands/create.js +368 -0
- package/dist/presentation/cli/commands/create.js.map +1 -0
- package/dist/presentation/cli/commands/result.d.ts +8 -0
- package/dist/presentation/cli/commands/result.d.ts.map +1 -0
- package/dist/presentation/cli/commands/result.js +121 -0
- package/dist/presentation/cli/commands/result.js.map +1 -0
- package/dist/presentation/cli/commands/status.d.ts +8 -0
- package/dist/presentation/cli/commands/status.d.ts.map +1 -0
- package/dist/presentation/cli/commands/status.js +92 -0
- package/dist/presentation/cli/commands/status.js.map +1 -0
- package/dist/presentation/cli/index.d.ts +8 -0
- package/dist/presentation/cli/index.d.ts.map +1 -0
- package/dist/presentation/cli/index.js +32 -0
- package/dist/presentation/cli/index.js.map +1 -0
- package/dist/presentation/cli/utils/cleanup.d.ts +14 -0
- package/dist/presentation/cli/utils/cleanup.d.ts.map +1 -0
- package/dist/presentation/cli/utils/cleanup.js +62 -0
- package/dist/presentation/cli/utils/cleanup.js.map +1 -0
- package/dist/presentation/cli/utils/formatter.d.ts +28 -0
- package/dist/presentation/cli/utils/formatter.d.ts.map +1 -0
- package/dist/presentation/cli/utils/formatter.js +68 -0
- package/dist/presentation/cli/utils/formatter.js.map +1 -0
- package/dist/presentation/cli.d.ts +7 -0
- package/dist/presentation/cli.d.ts.map +1 -0
- package/dist/presentation/cli.js +8 -0
- package/dist/presentation/cli.js.map +1 -0
- package/dist/presentation/monitor-cli.d.ts +8 -0
- package/dist/presentation/monitor-cli.d.ts.map +1 -0
- package/dist/presentation/monitor-cli.js +44 -0
- package/dist/presentation/monitor-cli.js.map +1 -0
- package/dist/presentation/worker-cli.d.ts +8 -0
- package/dist/presentation/worker-cli.d.ts.map +1 -0
- package/dist/presentation/worker-cli.js +51 -0
- package/dist/presentation/worker-cli.js.map +1 -0
- package/dist/schedulers/TaskScheduler.d.ts +99 -0
- package/dist/schedulers/TaskScheduler.d.ts.map +1 -0
- package/dist/schedulers/TaskScheduler.js +233 -0
- package/dist/schedulers/TaskScheduler.js.map +1 -0
- package/dist/schedulers/index.d.ts +5 -0
- package/dist/schedulers/index.d.ts.map +1 -0
- package/dist/schedulers/index.js +5 -0
- package/dist/schedulers/index.js.map +1 -0
- package/dist/services/image/ImageService.d.ts +68 -0
- package/dist/services/image/ImageService.d.ts.map +1 -0
- package/dist/services/image/ImageService.js +166 -0
- package/dist/services/image/ImageService.js.map +1 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +12 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/llm/EnhancedLLMService.d.ts +148 -0
- package/dist/services/llm/EnhancedLLMService.d.ts.map +1 -0
- package/dist/services/llm/EnhancedLLMService.js +425 -0
- package/dist/services/llm/EnhancedLLMService.js.map +1 -0
- package/dist/services/llm/LLMService.d.ts +103 -0
- package/dist/services/llm/LLMService.d.ts.map +1 -0
- package/dist/services/llm/LLMService.js +212 -0
- package/dist/services/llm/LLMService.js.map +1 -0
- package/dist/services/quality/HardRuleChecker.d.ts +143 -0
- package/dist/services/quality/HardRuleChecker.d.ts.map +1 -0
- package/dist/services/quality/HardRuleChecker.js +353 -0
- package/dist/services/quality/HardRuleChecker.js.map +1 -0
- package/dist/services/quality/LLMEvaluator.d.ts +105 -0
- package/dist/services/quality/LLMEvaluator.d.ts.map +1 -0
- package/dist/services/quality/LLMEvaluator.js +312 -0
- package/dist/services/quality/LLMEvaluator.js.map +1 -0
- package/dist/services/quality/QualityCheckService.d.ts +112 -0
- package/dist/services/quality/QualityCheckService.d.ts.map +1 -0
- package/dist/services/quality/QualityCheckService.js +342 -0
- package/dist/services/quality/QualityCheckService.js.map +1 -0
- package/dist/services/quality/QualityService.d.ts +75 -0
- package/dist/services/quality/QualityService.d.ts.map +1 -0
- package/dist/services/quality/QualityService.js +360 -0
- package/dist/services/quality/QualityService.js.map +1 -0
- package/dist/services/quality/index.d.ts +7 -0
- package/dist/services/quality/index.d.ts.map +1 -0
- package/dist/services/quality/index.js +10 -0
- package/dist/services/quality/index.js.map +1 -0
- package/dist/services/search/SearchService.d.ts +79 -0
- package/dist/services/search/SearchService.d.ts.map +1 -0
- package/dist/services/search/SearchService.js +193 -0
- package/dist/services/search/SearchService.js.map +1 -0
- package/dist/workers/TaskWorker.d.ts +61 -0
- package/dist/workers/TaskWorker.d.ts.map +1 -0
- package/dist/workers/TaskWorker.js +256 -0
- package/dist/workers/TaskWorker.js.map +1 -0
- package/dist/workers/index.d.ts +5 -0
- package/dist/workers/index.d.ts.map +1 -0
- package/dist/workers/index.js +5 -0
- package/dist/workers/index.js.map +1 -0
- package/docs/DOCUMENTATION-ANALYSIS.md +190 -0
- package/docs/README.md +145 -0
- package/docs/SOURCE-CODE-ANALYSIS.md +1107 -0
- package/docs/architecture-complete.md +5524 -0
- package/docs/archive/implementation/implementation-analysis/README.md +244 -0
- package/docs/archive/implementation/implementation-analysis/implementation-analysis-context.md +483 -0
- package/docs/archive/implementation/implementation-analysis/implementation-analysis-plan.md +1242 -0
- package/docs/archive/implementation/implementation-analysis/implementation-analysis-tasks.md +777 -0
- package/docs/archive/phases/phase-1/phase-1-completion-summary.md +284 -0
- package/docs/archive/phases/phase-1/phase-1-implementation-guide.md +1380 -0
- package/docs/archive/phases/phase-2/phase-2a/phase-2a-completion-summary.md +443 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-completion-report.md +430 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-completion-summary.md +592 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-final-summary.md +371 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-preparation-complete.md +343 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-preparation.md +945 -0
- package/docs/archive/phases/phase-2/phase-2b/phase-2b-progress-update.md +366 -0
- package/docs/archive/phases/phase-3/phase-3-completion-summary.md +354 -0
- package/docs/archive/phases/phase-3/phase-3-development-plan.md +878 -0
- package/docs/archive/phases/phase-3/phase-3-quick-start.md +324 -0
- package/docs/archive/phases/phase-4/phase-4-completion-summary.md +708 -0
- package/docs/archive/phases/phase-4/phase-4-development-plan.md +740 -0
- package/docs/archive/phases/phase-4/phase-4-quick-start.md +632 -0
- package/docs/archive/phases/phase-4/phase-4-session-3-security-testing.md +484 -0
- package/docs/archive/phases/phase-4/phase-4-session-4-unit-tests.md +550 -0
- package/docs/archive/phases/phase-4/phase-4-session-5-security-tests.md +564 -0
- package/docs/archive/phases/phase-4/phase-4-session-6-cache-integration.md +456 -0
- package/docs/archive/phases/phase-4/phase-4-session-7-test-fixes.md +348 -0
- package/docs/archive/phases/phase-4/phase-4-session-8-taskqueue-fixes.md +323 -0
- package/docs/archive/phases/phase-4/phase-4-session-summary-continued.md +373 -0
- package/docs/archive/phases/phase-4/phase-4-session-summary.md +595 -0
- package/docs/archive/reports/progress-reports/PHASE_0_PROGRESS.md +242 -0
- package/docs/archive/reports/progress-reports/PHASE_0_SUMMARY.md +262 -0
- package/docs/archive/reports/progress-reports/PHASE_1_2_ISSUES.md +399 -0
- package/docs/archive/reports/progress-reports/PHASE_1_PROGRESS.md +388 -0
- package/docs/archive/reports/progress-reports/PHASE_3_PREPARATION.md +574 -0
- package/docs/archive/reports/progress-reports/current-progress-update.md +294 -0
- package/docs/archive/reports/progress-reports/final-summary.md +215 -0
- package/docs/archive/reports/progress-reports/implementation-summary.md +287 -0
- package/docs/archive/reports/progress-reports/project-progress-report.md +440 -0
- package/docs/archive/reports/progress-reports/project-progress.md +386 -0
- package/docs/archive/reports/test-reports/TEST-COVERAGE-REPORT.md +441 -0
- package/docs/archive/reports/test-reports/e2e-test-report.md +293 -0
- package/docs/archive/reports/test-reports/final-test-report.md +367 -0
- package/docs/archive/reports/test-reports/real-env-test-report.md +391 -0
- package/docs/archive/reports/test-reports/test-completion-summary.md +356 -0
- package/docs/archive/reports/test-reports/test-report.md +371 -0
- package/docs/archive/sessions/session-2-summary.md +429 -0
- package/docs/archive/sessions/session-3-summary.md +395 -0
- package/docs/archive/sessions/session-summary.md +370 -0
- package/docs/config-system-update.md +239 -0
- package/docs/database-refactoring-PLAN.md +199 -0
- package/docs/database-refactoring-SUMMARY.md +384 -0
- package/docs/quality-check-architecture.md +1030 -0
- package/docs/quick-start.md +388 -0
- package/docs/references/bullmq-quick-reference.md +525 -0
- package/docs/references/monitoring-optimization-guide.md +871 -0
- package/docs/references/performance-optimization-guide.md +933 -0
- package/docs/storage-guide.md +612 -0
- package/docs/test-implementation-PLAN.md +223 -0
- package/docs/test-implementation-SUMMARY.md +194 -0
- package/docs/user-guide.md +719 -0
- package/docs/workflow-architecture.md +549 -0
- package/package.json +126 -0
- package/src/application/workflow/SyncExecutor.ts +444 -0
- package/src/application/workflow/types.ts +57 -0
- package/src/config/index.ts +352 -0
- package/src/domain/entities/QualityCheck.ts +202 -0
- package/src/domain/entities/Result.ts +130 -0
- package/src/domain/entities/Task.ts +178 -0
- package/src/domain/entities/TaskStep.ts +188 -0
- package/src/domain/entities/TokenUsage.ts +119 -0
- package/src/domain/entities/index.ts +20 -0
- package/src/domain/repositories/QualityCheckRepository.ts +52 -0
- package/src/domain/repositories/ResultRepository.ts +47 -0
- package/src/domain/repositories/TaskRepository.ts +271 -0
- package/src/domain/workflow/CheckpointManager.ts +283 -0
- package/src/domain/workflow/ContentCreatorGraph.ts +446 -0
- package/src/domain/workflow/State.ts +321 -0
- package/src/domain/workflow/index.ts +18 -0
- package/src/domain/workflow/nodes/BaseNode.ts +325 -0
- package/src/domain/workflow/nodes/CheckImageNode.ts +325 -0
- package/src/domain/workflow/nodes/CheckTextNode.ts +709 -0
- package/src/domain/workflow/nodes/GenerateImageNode.ts +342 -0
- package/src/domain/workflow/nodes/OrganizeNode.ts +304 -0
- package/src/domain/workflow/nodes/SearchNode.ts +192 -0
- package/src/domain/workflow/nodes/WriteNode.ts +505 -0
- package/src/domain/workflow/nodes/index.ts +13 -0
- package/src/index.ts +43 -0
- package/src/infrastructure/cache/CacheService.ts +483 -0
- package/src/infrastructure/cache/index.ts +6 -0
- package/src/infrastructure/database/BaseRepository.ts +214 -0
- package/src/infrastructure/database/MemoryTaskRepository.ts +377 -0
- package/src/infrastructure/database/PostgresQualityCheckRepository.ts +115 -0
- package/src/infrastructure/database/PostgresTaskRepository.ts +424 -0
- package/src/infrastructure/database/ResultRepository.ts +113 -0
- package/src/infrastructure/database/SQLiteTaskRepository.ts +651 -0
- package/src/infrastructure/database/index.ts +83 -0
- package/src/infrastructure/logging/logger.ts +231 -0
- package/src/infrastructure/monitoring/LoggingService.ts +292 -0
- package/src/infrastructure/monitoring/MetricsService.ts +468 -0
- package/src/infrastructure/monitoring/SentryService.ts +345 -0
- package/src/infrastructure/monitoring/index.ts +12 -0
- package/src/infrastructure/queue/TaskQueue.ts +429 -0
- package/src/infrastructure/queue/index.ts +5 -0
- package/src/infrastructure/redis/connection.ts +215 -0
- package/src/infrastructure/redis/index.ts +5 -0
- package/src/infrastructure/security/ApiKeyService.ts +340 -0
- package/src/infrastructure/security/QuotaService.ts +411 -0
- package/src/infrastructure/security/RateLimiter.ts +417 -0
- package/src/infrastructure/security/index.ts +12 -0
- package/src/monitoring/index.ts +5 -0
- package/src/monitoring/server.ts +109 -0
- package/src/presentation/cli/commands/cancel.ts +64 -0
- package/src/presentation/cli/commands/create.ts +400 -0
- package/src/presentation/cli/commands/result.ts +136 -0
- package/src/presentation/cli/commands/status.ts +102 -0
- package/src/presentation/cli/index.ts +39 -0
- package/src/presentation/cli/utils/cleanup.ts +65 -0
- package/src/presentation/cli/utils/formatter.ts +74 -0
- package/src/presentation/cli.ts +8 -0
- package/src/presentation/monitor-cli.ts +52 -0
- package/src/presentation/worker-cli.ts +62 -0
- package/src/schedulers/TaskScheduler.ts +314 -0
- package/src/schedulers/index.ts +11 -0
- package/src/services/image/ImageService.ts +221 -0
- package/src/services/index.ts +15 -0
- package/src/services/llm/EnhancedLLMService.ts +596 -0
- package/src/services/llm/LLMService.ts +310 -0
- package/src/services/quality/HardRuleChecker.ts +509 -0
- package/src/services/quality/LLMEvaluator.ts +400 -0
- package/src/services/quality/QualityCheckService.ts +473 -0
- package/src/services/quality/QualityService.ts +445 -0
- package/src/services/quality/index.ts +12 -0
- package/src/services/search/SearchService.ts +266 -0
- package/src/types/global.d.ts +17 -0
- package/src/workers/TaskWorker.ts +320 -0
- package/src/workers/index.ts +5 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task 领域模型
|
|
3
|
+
*
|
|
4
|
+
* 表示一个内容创作任务
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 任务状态
|
|
8
|
+
*/
|
|
9
|
+
export declare enum TaskStatus {
|
|
10
|
+
PENDING = "pending",// 待处理
|
|
11
|
+
RUNNING = "running",// 运行中
|
|
12
|
+
WAITING = "waiting",// 等待中(等待人工审核)
|
|
13
|
+
COMPLETED = "completed",// 已完成
|
|
14
|
+
FAILED = "failed",// 失败
|
|
15
|
+
CANCELLED = "cancelled"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 任务类型
|
|
19
|
+
*/
|
|
20
|
+
export declare enum TaskType {
|
|
21
|
+
ARTICLE = "article",// 文章
|
|
22
|
+
SOCIAL_MEDIA = "social_media",// 社交媒体内容
|
|
23
|
+
MARKETING = "marketing",// 营销文案
|
|
24
|
+
OTHER = "other"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 任务优先级
|
|
28
|
+
*/
|
|
29
|
+
export declare enum TaskPriority {
|
|
30
|
+
LOW = 1,
|
|
31
|
+
NORMAL = 2,
|
|
32
|
+
HIGH = 3,
|
|
33
|
+
URGENT = 4
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 执行模式
|
|
37
|
+
*/
|
|
38
|
+
export declare enum ExecutionMode {
|
|
39
|
+
SYNC = "sync",// 同步执行
|
|
40
|
+
ASYNC = "async"
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 任务实体
|
|
44
|
+
*/
|
|
45
|
+
export interface Task {
|
|
46
|
+
id: string;
|
|
47
|
+
taskId: string;
|
|
48
|
+
type?: TaskType;
|
|
49
|
+
status: TaskStatus;
|
|
50
|
+
priority: TaskPriority;
|
|
51
|
+
mode: ExecutionMode;
|
|
52
|
+
topic: string;
|
|
53
|
+
requirements: string;
|
|
54
|
+
targetAudience: string;
|
|
55
|
+
keywords?: string[];
|
|
56
|
+
tone?: string;
|
|
57
|
+
hardConstraints?: {
|
|
58
|
+
minWords?: number;
|
|
59
|
+
maxWords?: number;
|
|
60
|
+
keywords?: string[];
|
|
61
|
+
};
|
|
62
|
+
userId?: string;
|
|
63
|
+
estimatedTokens?: number;
|
|
64
|
+
maxTokens?: number;
|
|
65
|
+
currentStep?: string;
|
|
66
|
+
workerId?: string;
|
|
67
|
+
assignedWorkerId?: string;
|
|
68
|
+
textRetryCount: number;
|
|
69
|
+
imageRetryCount: number;
|
|
70
|
+
version: number;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
updatedAt: Date;
|
|
73
|
+
startedAt?: Date;
|
|
74
|
+
completedAt?: Date;
|
|
75
|
+
deletedAt?: Date;
|
|
76
|
+
claimedAt?: Date;
|
|
77
|
+
errorMessage?: string;
|
|
78
|
+
stateSnapshot?: object;
|
|
79
|
+
idempotencyKey?: string;
|
|
80
|
+
steps?: TaskStep[];
|
|
81
|
+
results?: Result[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 任务创建参数
|
|
85
|
+
*/
|
|
86
|
+
export interface CreateTaskParams {
|
|
87
|
+
mode: ExecutionMode;
|
|
88
|
+
topic: string;
|
|
89
|
+
requirements: string;
|
|
90
|
+
targetAudience: string;
|
|
91
|
+
type?: TaskType;
|
|
92
|
+
keywords?: string[];
|
|
93
|
+
tone?: string;
|
|
94
|
+
priority?: TaskPriority;
|
|
95
|
+
maxTokens?: number;
|
|
96
|
+
userId?: string;
|
|
97
|
+
hardConstraints?: {
|
|
98
|
+
minWords?: number;
|
|
99
|
+
maxWords?: number;
|
|
100
|
+
keywords?: string[];
|
|
101
|
+
};
|
|
102
|
+
idempotencyKey?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 任务更新参数
|
|
106
|
+
*/
|
|
107
|
+
export interface UpdateTaskParams {
|
|
108
|
+
status?: TaskStatus;
|
|
109
|
+
currentStep?: string;
|
|
110
|
+
workerId?: string;
|
|
111
|
+
assignedWorkerId?: string;
|
|
112
|
+
claimedAt?: Date;
|
|
113
|
+
startedAt?: Date;
|
|
114
|
+
completedAt?: Date;
|
|
115
|
+
estimatedTokens?: number;
|
|
116
|
+
errorMessage?: string;
|
|
117
|
+
stateSnapshot?: object;
|
|
118
|
+
version: number;
|
|
119
|
+
}
|
|
120
|
+
import type { TaskStep } from './TaskStep.js';
|
|
121
|
+
import type { Result } from './Result.js';
|
|
122
|
+
/**
|
|
123
|
+
* 任务状态转换
|
|
124
|
+
*/
|
|
125
|
+
export declare const TaskStatusTransitions: Record<TaskStatus, TaskStatus[]>;
|
|
126
|
+
/**
|
|
127
|
+
* 检查状态转换是否合法
|
|
128
|
+
*/
|
|
129
|
+
export declare function isValidStatusTransition(currentStatus: TaskStatus, newStatus: TaskStatus): boolean;
|
|
130
|
+
//# sourceMappingURL=Task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/Task.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,oBAAY,UAAU;IACpB,OAAO,YAAY,CAAY,MAAM;IACrC,OAAO,YAAY,CAAY,MAAM;IACrC,OAAO,YAAY,CAAY,cAAc;IAC7C,SAAS,cAAc,CAAQ,MAAM;IACrC,MAAM,WAAW,CAAc,KAAK;IACpC,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,oBAAY,QAAQ;IAClB,OAAO,YAAY,C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AAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,CAOlE,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,UAAU,EACzB,SAAS,EAAE,UAAU,GACpB,OAAO,CAGT"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task 领域模型
|
|
3
|
+
*
|
|
4
|
+
* 表示一个内容创作任务
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 任务状态
|
|
8
|
+
*/
|
|
9
|
+
export var TaskStatus;
|
|
10
|
+
(function (TaskStatus) {
|
|
11
|
+
TaskStatus["PENDING"] = "pending";
|
|
12
|
+
TaskStatus["RUNNING"] = "running";
|
|
13
|
+
TaskStatus["WAITING"] = "waiting";
|
|
14
|
+
TaskStatus["COMPLETED"] = "completed";
|
|
15
|
+
TaskStatus["FAILED"] = "failed";
|
|
16
|
+
TaskStatus["CANCELLED"] = "cancelled";
|
|
17
|
+
})(TaskStatus || (TaskStatus = {}));
|
|
18
|
+
/**
|
|
19
|
+
* 任务类型
|
|
20
|
+
*/
|
|
21
|
+
export var TaskType;
|
|
22
|
+
(function (TaskType) {
|
|
23
|
+
TaskType["ARTICLE"] = "article";
|
|
24
|
+
TaskType["SOCIAL_MEDIA"] = "social_media";
|
|
25
|
+
TaskType["MARKETING"] = "marketing";
|
|
26
|
+
TaskType["OTHER"] = "other";
|
|
27
|
+
})(TaskType || (TaskType = {}));
|
|
28
|
+
/**
|
|
29
|
+
* 任务优先级
|
|
30
|
+
*/
|
|
31
|
+
export var TaskPriority;
|
|
32
|
+
(function (TaskPriority) {
|
|
33
|
+
TaskPriority[TaskPriority["LOW"] = 1] = "LOW";
|
|
34
|
+
TaskPriority[TaskPriority["NORMAL"] = 2] = "NORMAL";
|
|
35
|
+
TaskPriority[TaskPriority["HIGH"] = 3] = "HIGH";
|
|
36
|
+
TaskPriority[TaskPriority["URGENT"] = 4] = "URGENT";
|
|
37
|
+
})(TaskPriority || (TaskPriority = {}));
|
|
38
|
+
/**
|
|
39
|
+
* 执行模式
|
|
40
|
+
*/
|
|
41
|
+
export var ExecutionMode;
|
|
42
|
+
(function (ExecutionMode) {
|
|
43
|
+
ExecutionMode["SYNC"] = "sync";
|
|
44
|
+
ExecutionMode["ASYNC"] = "async";
|
|
45
|
+
})(ExecutionMode || (ExecutionMode = {}));
|
|
46
|
+
/**
|
|
47
|
+
* 任务状态转换
|
|
48
|
+
*/
|
|
49
|
+
export const TaskStatusTransitions = {
|
|
50
|
+
[TaskStatus.PENDING]: [TaskStatus.RUNNING, TaskStatus.CANCELLED],
|
|
51
|
+
[TaskStatus.RUNNING]: [TaskStatus.WAITING, TaskStatus.COMPLETED, TaskStatus.FAILED, TaskStatus.CANCELLED],
|
|
52
|
+
[TaskStatus.WAITING]: [TaskStatus.RUNNING, TaskStatus.COMPLETED, TaskStatus.FAILED, TaskStatus.CANCELLED],
|
|
53
|
+
[TaskStatus.COMPLETED]: [], // 终态,不可转换
|
|
54
|
+
[TaskStatus.FAILED]: [], // 终态,不可转换
|
|
55
|
+
[TaskStatus.CANCELLED]: [], // 终态,不可转换
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 检查状态转换是否合法
|
|
59
|
+
*/
|
|
60
|
+
export function isValidStatusTransition(currentStatus, newStatus) {
|
|
61
|
+
const allowedTransitions = TaskStatusTransitions[currentStatus];
|
|
62
|
+
return allowedTransitions.includes(newStatus);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=Task.js.map
|
|
@@ -0,0 +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,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC;IACzG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,UAAU;IACtC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,EAAK,UAAU;IACtC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,UAAU;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,aAAyB,EACzB,SAAqB;IAErB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAChE,OAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TaskStep 领域模型
|
|
3
|
+
*
|
|
4
|
+
* 表示任务的一个执行步骤
|
|
5
|
+
*/
|
|
6
|
+
import { TaskStatus } from './Task.js';
|
|
7
|
+
/**
|
|
8
|
+
* 步骤类型
|
|
9
|
+
*/
|
|
10
|
+
export declare enum StepType {
|
|
11
|
+
SEARCH = "search",// 搜索选题
|
|
12
|
+
ORGANIZE = "organize",// 整理资料
|
|
13
|
+
WRITE = "write",// 撰写内容
|
|
14
|
+
CHECK_TEXT = "check_text",// 文本质量检查
|
|
15
|
+
GEN_IMAGE = "gen_image",// 生成配图
|
|
16
|
+
CHECK_IMAGE = "check_image"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 步骤输入定义
|
|
20
|
+
*/
|
|
21
|
+
export interface StepInput {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 搜索步骤输入
|
|
26
|
+
*/
|
|
27
|
+
export interface SearchStepInput extends StepInput {
|
|
28
|
+
topic: string;
|
|
29
|
+
requirements: string;
|
|
30
|
+
targetAudience: string;
|
|
31
|
+
keywords?: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 整理步骤输入
|
|
35
|
+
*/
|
|
36
|
+
export interface OrganizeStepInput extends StepInput {
|
|
37
|
+
searchResults: any[];
|
|
38
|
+
requirements: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 撰写步骤输入
|
|
42
|
+
*/
|
|
43
|
+
export interface WriteStepInput extends StepInput {
|
|
44
|
+
organizedContent: any;
|
|
45
|
+
topic: string;
|
|
46
|
+
targetAudience: string;
|
|
47
|
+
tone?: string;
|
|
48
|
+
maxTokens?: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 文本检查步骤输入
|
|
52
|
+
*/
|
|
53
|
+
export interface CheckTextStepInput extends StepInput {
|
|
54
|
+
text: string;
|
|
55
|
+
requirements: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 生成图片步骤输入
|
|
59
|
+
*/
|
|
60
|
+
export interface GenImageStepInput extends StepInput {
|
|
61
|
+
text: string;
|
|
62
|
+
requirements: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 图片检查步骤输入
|
|
66
|
+
*/
|
|
67
|
+
export interface CheckImageStepInput extends StepInput {
|
|
68
|
+
imageUrl: string;
|
|
69
|
+
requirements: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 步骤输出定义
|
|
73
|
+
*/
|
|
74
|
+
export interface StepOutput {
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 搜索步骤输出
|
|
79
|
+
*/
|
|
80
|
+
export interface SearchStepOutput extends StepOutput {
|
|
81
|
+
results: any[];
|
|
82
|
+
summary: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 整理步骤输出
|
|
86
|
+
*/
|
|
87
|
+
export interface OrganizeStepOutput extends StepOutput {
|
|
88
|
+
organized: any;
|
|
89
|
+
outline: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 撰写步骤输出
|
|
93
|
+
*/
|
|
94
|
+
export interface WriteStepOutput extends StepOutput {
|
|
95
|
+
text: string;
|
|
96
|
+
tokenCount: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* 检查步骤输出
|
|
100
|
+
*/
|
|
101
|
+
export interface CheckStepOutput extends StepOutput {
|
|
102
|
+
passed: boolean;
|
|
103
|
+
score?: number;
|
|
104
|
+
reason?: string;
|
|
105
|
+
details?: any;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 步骤状态
|
|
109
|
+
*/
|
|
110
|
+
export declare enum StepStatus {
|
|
111
|
+
PENDING = "pending",
|
|
112
|
+
RUNNING = "running",
|
|
113
|
+
COMPLETED = "completed",
|
|
114
|
+
FAILED = "failed",
|
|
115
|
+
SKIPPED = "skipped"
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 任务步骤实体
|
|
119
|
+
*/
|
|
120
|
+
export interface TaskStep {
|
|
121
|
+
id: number;
|
|
122
|
+
taskId: string;
|
|
123
|
+
stepType: StepType;
|
|
124
|
+
status: StepStatus;
|
|
125
|
+
attempt: number;
|
|
126
|
+
inputData?: object;
|
|
127
|
+
outputData?: object;
|
|
128
|
+
input?: StepInput;
|
|
129
|
+
output?: StepOutput;
|
|
130
|
+
errorMessage?: string;
|
|
131
|
+
error?: string;
|
|
132
|
+
retryCount?: number;
|
|
133
|
+
createdAt: Date;
|
|
134
|
+
startedAt?: Date;
|
|
135
|
+
completedAt?: Date;
|
|
136
|
+
durationMs?: number;
|
|
137
|
+
duration?: number;
|
|
138
|
+
workerId?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 创建步骤参数
|
|
142
|
+
*/
|
|
143
|
+
export interface CreateStepParams {
|
|
144
|
+
taskId: string;
|
|
145
|
+
stepType: StepType;
|
|
146
|
+
input: StepInput;
|
|
147
|
+
workerId?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 更新步骤参数
|
|
151
|
+
*/
|
|
152
|
+
export interface UpdateStepParams {
|
|
153
|
+
status?: TaskStatus;
|
|
154
|
+
output?: StepOutput;
|
|
155
|
+
error?: string;
|
|
156
|
+
startedAt?: Date;
|
|
157
|
+
completedAt?: Date;
|
|
158
|
+
duration?: number;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=TaskStep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskStep.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/TaskStep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,oBAAY,QAAQ;IAClB,MAAM,WAAW,CAAc,OAAO;IACtC,QAAQ,aAAa,CAAU,OAAO;IACtC,KAAK,UAAU,CAAgB,OAAO;IACtC,UAAU,eAAe,CAAM,SAAS;IACxC,SAAS,cAAc,CAAQ,OAAO;IACtC,WAAW,gBAAgB;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,aAAa,EAAE,GAAG,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,gBAAgB,EAAE,GAAG,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;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C;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAGhB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,CAAC;IAGpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TaskStep 领域模型
|
|
3
|
+
*
|
|
4
|
+
* 表示任务的一个执行步骤
|
|
5
|
+
*/
|
|
6
|
+
import { TaskStatus } from './Task.js';
|
|
7
|
+
/**
|
|
8
|
+
* 步骤类型
|
|
9
|
+
*/
|
|
10
|
+
export var StepType;
|
|
11
|
+
(function (StepType) {
|
|
12
|
+
StepType["SEARCH"] = "search";
|
|
13
|
+
StepType["ORGANIZE"] = "organize";
|
|
14
|
+
StepType["WRITE"] = "write";
|
|
15
|
+
StepType["CHECK_TEXT"] = "check_text";
|
|
16
|
+
StepType["GEN_IMAGE"] = "gen_image";
|
|
17
|
+
StepType["CHECK_IMAGE"] = "check_image";
|
|
18
|
+
})(StepType || (StepType = {}));
|
|
19
|
+
/**
|
|
20
|
+
* 步骤状态
|
|
21
|
+
*/
|
|
22
|
+
export var StepStatus;
|
|
23
|
+
(function (StepStatus) {
|
|
24
|
+
StepStatus["PENDING"] = "pending";
|
|
25
|
+
StepStatus["RUNNING"] = "running";
|
|
26
|
+
StepStatus["COMPLETED"] = "completed";
|
|
27
|
+
StepStatus["FAILED"] = "failed";
|
|
28
|
+
StepStatus["SKIPPED"] = "skipped";
|
|
29
|
+
})(StepStatus || (StepStatus = {}));
|
|
30
|
+
//# sourceMappingURL=TaskStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskStep.js","sourceRoot":"","sources":["../../../src/domain/entities/TaskStep.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,qCAAyB,CAAA;IACzB,mCAAuB,CAAA;IACvB,uCAA2B,CAAA;AAC7B,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB;AAuGD;;GAEG;AACH,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;IACvB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;AACrB,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TokenUsage 领域模型
|
|
3
|
+
*
|
|
4
|
+
* 表示 API Token 使用记录和成本统计
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Token 使用记录实体
|
|
8
|
+
*/
|
|
9
|
+
export interface TokenUsage {
|
|
10
|
+
id: number;
|
|
11
|
+
taskId: string;
|
|
12
|
+
traceId: string;
|
|
13
|
+
stepName: string;
|
|
14
|
+
apiName: string;
|
|
15
|
+
modelName: string;
|
|
16
|
+
tokensIn: number;
|
|
17
|
+
tokensOut: number;
|
|
18
|
+
totalTokens: number;
|
|
19
|
+
costPer1kTokensIn: number;
|
|
20
|
+
costPer1kTokensOut: number;
|
|
21
|
+
totalCost: number;
|
|
22
|
+
metadata?: TokenUsageMetadata;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Token 使用元数据
|
|
27
|
+
*/
|
|
28
|
+
export interface TokenUsageMetadata {
|
|
29
|
+
temperature?: number;
|
|
30
|
+
maxTokens?: number;
|
|
31
|
+
duration?: number;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 创建 Token 使用记录参数
|
|
36
|
+
*/
|
|
37
|
+
export interface CreateTokenUsageParams {
|
|
38
|
+
taskId: string;
|
|
39
|
+
traceId: string;
|
|
40
|
+
stepName: string;
|
|
41
|
+
apiName: string;
|
|
42
|
+
modelName: string;
|
|
43
|
+
tokensIn: number;
|
|
44
|
+
tokensOut: number;
|
|
45
|
+
costPer1kTokensIn: number;
|
|
46
|
+
costPer1kTokensOut: number;
|
|
47
|
+
metadata?: TokenUsageMetadata;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Token 成本配置
|
|
51
|
+
*/
|
|
52
|
+
export interface TokenCostConfig {
|
|
53
|
+
apiName: string;
|
|
54
|
+
modelName: string;
|
|
55
|
+
costPer1kTokensIn: number;
|
|
56
|
+
costPer1kTokensOut: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 常用 API 成本配置(单位:元/1k tokens)
|
|
60
|
+
*/
|
|
61
|
+
export declare const TOKEN_COST_CONFIGS: Record<string, TokenCostConfig[]>;
|
|
62
|
+
/**
|
|
63
|
+
* 计算 Token 成本
|
|
64
|
+
*/
|
|
65
|
+
export declare function calculateTokenCost(tokensIn: number, tokensOut: number, costPer1kTokensIn: number, costPer1kTokensOut: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* 获取 API 成本配置
|
|
68
|
+
*/
|
|
69
|
+
export declare function getTokenCostConfig(apiName: string, modelName: string): TokenCostConfig | undefined;
|
|
70
|
+
//# sourceMappingURL=TokenUsage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenUsage.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/TokenUsage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IAEzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAGlB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IAGpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAG9B,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAiBhE,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,EACzB,kBAAkB,EAAE,MAAM,GACzB,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,eAAe,GAAG,SAAS,CAG7B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TokenUsage 领域模型
|
|
3
|
+
*
|
|
4
|
+
* 表示 API Token 使用记录和成本统计
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 常用 API 成本配置(单位:元/1k tokens)
|
|
8
|
+
*/
|
|
9
|
+
export const TOKEN_COST_CONFIGS = {
|
|
10
|
+
deepseek: [
|
|
11
|
+
{
|
|
12
|
+
apiName: 'deepseek',
|
|
13
|
+
modelName: 'deepseek-chat',
|
|
14
|
+
costPer1kTokensIn: 0.001, // ¥0.001/1k tokens
|
|
15
|
+
costPer1kTokensOut: 0.002, // ¥0.002/1k tokens
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
doubao: [
|
|
19
|
+
{
|
|
20
|
+
apiName: 'doubao',
|
|
21
|
+
modelName: 'doubao-v1',
|
|
22
|
+
costPer1kTokensIn: 0.008,
|
|
23
|
+
costPer1kTokensOut: 0.008,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 计算 Token 成本
|
|
29
|
+
*/
|
|
30
|
+
export function calculateTokenCost(tokensIn, tokensOut, costPer1kTokensIn, costPer1kTokensOut) {
|
|
31
|
+
const costIn = (tokensIn / 1000) * costPer1kTokensIn;
|
|
32
|
+
const costOut = (tokensOut / 1000) * costPer1kTokensOut;
|
|
33
|
+
return Number((costIn + costOut).toFixed(6));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 获取 API 成本配置
|
|
37
|
+
*/
|
|
38
|
+
export function getTokenCostConfig(apiName, modelName) {
|
|
39
|
+
const configs = TOKEN_COST_CONFIGS[apiName];
|
|
40
|
+
return configs?.find(config => config.modelName === modelName);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=TokenUsage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenUsage.js","sourceRoot":"","sources":["../../../src/domain/entities/TokenUsage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsC;IACnE,QAAQ,EAAE;QACR;YACE,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,eAAe;YAC1B,iBAAiB,EAAE,KAAK,EAAG,mBAAmB;YAC9C,kBAAkB,EAAE,KAAK,EAAE,mBAAmB;SAC/C;KACF;IACD,MAAM,EAAE;QACN;YACE,OAAO,EAAE,QAAQ;YACjB,SAAS,EAAE,WAAW;YACtB,iBAAiB,EAAE,KAAK;YACxB,kBAAkB,EAAE,KAAK;SAC1B;KACF;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,SAAiB,EACjB,iBAAyB,EACzB,kBAA0B;IAE1B,MAAM,MAAM,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,iBAAiB,CAAC;IACrD,MAAM,OAAO,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,kBAAkB,CAAC;IACxD,OAAO,MAAM,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAe,EACf,SAAiB;IAEjB,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,WAAW,CAAC;AAG1B,cAAc,eAAe,CAAC;AAG9B,cAAc,aAAa,CAAC;AAG5B,cAAc,mBAAmB,CAAC;AAGlC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 领域实体导出
|
|
3
|
+
*
|
|
4
|
+
* 统一导出所有领域模型
|
|
5
|
+
*/
|
|
6
|
+
// Task 实体 - 包含基础的 Task、TaskStep、Result、QualityCheck 接口
|
|
7
|
+
export * from './Task.js';
|
|
8
|
+
// TaskStep 实体 - 包含详细的步骤类型和输入输出定义
|
|
9
|
+
export * from './TaskStep.js';
|
|
10
|
+
// Result 实体 - 包含详细的结果类型和元数据定义
|
|
11
|
+
export * from './Result.js';
|
|
12
|
+
// QualityCheck 实体 - 包含详细的质量检查类型和检查结果定义
|
|
13
|
+
export * from './QualityCheck.js';
|
|
14
|
+
// TokenUsage 实体
|
|
15
|
+
export * from './TokenUsage.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/entities/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uDAAuD;AACvD,cAAc,WAAW,CAAC;AAE1B,iCAAiC;AACjC,cAAc,eAAe,CAAC;AAE9B,8BAA8B;AAC9B,cAAc,aAAa,CAAC;AAE5B,uCAAuC;AACvC,cAAc,mBAAmB,CAAC;AAElC,gBAAgB;AAChB,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quality Check Repository 接口
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 创建质量检查记录参数
|
|
6
|
+
*/
|
|
7
|
+
export interface CreateQualityCheckParams {
|
|
8
|
+
taskId: string;
|
|
9
|
+
checkType: 'text' | 'image';
|
|
10
|
+
score: number;
|
|
11
|
+
passed: boolean;
|
|
12
|
+
hardConstraintsPassed: boolean;
|
|
13
|
+
details: Record<string, any>;
|
|
14
|
+
fixSuggestions?: string[];
|
|
15
|
+
rubricVersion?: string;
|
|
16
|
+
modelName?: string;
|
|
17
|
+
promptHash?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 质量检查记录
|
|
21
|
+
*/
|
|
22
|
+
export interface QualityCheckRecord {
|
|
23
|
+
id: number;
|
|
24
|
+
taskId: string;
|
|
25
|
+
checkType: 'text' | 'image';
|
|
26
|
+
score: number;
|
|
27
|
+
passed: boolean;
|
|
28
|
+
hardConstraintsPassed: boolean;
|
|
29
|
+
details: Record<string, any>;
|
|
30
|
+
fixSuggestions: string[] | null;
|
|
31
|
+
rubricVersion: string | null;
|
|
32
|
+
modelName: string | null;
|
|
33
|
+
promptHash: string | null;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Quality Check Repository 接口
|
|
38
|
+
*/
|
|
39
|
+
export interface IQualityCheckRepository {
|
|
40
|
+
/**
|
|
41
|
+
* 创建质量检查记录
|
|
42
|
+
*/
|
|
43
|
+
create(params: CreateQualityCheckParams): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* 根据任务 ID 查询质量检查
|
|
46
|
+
*/
|
|
47
|
+
findByTaskId(taskId: string): Promise<QualityCheckRecord[]>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=QualityCheckRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QualityCheckRepository.d.ts","sourceRoot":"","sources":["../../../src/domain/repositories/QualityCheckRepository.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExD;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CAC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QualityCheckRepository.js","sourceRoot":"","sources":["../../../src/domain/repositories/QualityCheckRepository.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result Repository 接口
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 创建结果参数
|
|
6
|
+
*/
|
|
7
|
+
export interface CreateResultParams {
|
|
8
|
+
taskId: string;
|
|
9
|
+
resultType: 'article' | 'image' | 'text';
|
|
10
|
+
content?: string;
|
|
11
|
+
filePath?: string;
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 结果记录
|
|
16
|
+
*/
|
|
17
|
+
export interface ResultRecord {
|
|
18
|
+
id: number;
|
|
19
|
+
taskId: string;
|
|
20
|
+
resultType: 'article' | 'image' | 'text';
|
|
21
|
+
content: string | null;
|
|
22
|
+
filePath: string | null;
|
|
23
|
+
metadata: Record<string, any> | null;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Result Repository 接口
|
|
28
|
+
*/
|
|
29
|
+
export interface IResultRepository {
|
|
30
|
+
/**
|
|
31
|
+
* 创建结果记录
|
|
32
|
+
*/
|
|
33
|
+
create(params: CreateResultParams): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* 根据任务 ID 查询结果
|
|
36
|
+
*/
|
|
37
|
+
findByTaskId(taskId: string): Promise<ResultRecord[]>;
|
|
38
|
+
/**
|
|
39
|
+
* 删除任务的所有结果
|
|
40
|
+
*/
|
|
41
|
+
deleteByTaskId(taskId: string): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ResultRepository.d.ts.map
|