useChatGPT ? 'ChatGPT智能识别' : 'OCR识别 + AI判分'; } public function mount(): void { $this->initializeUserRole(); if ($this->isTeacher) { $teacherId = $this->getCurrentTeacherId(); if ($teacherId) { $this->teacherId = $teacherId; } } } #[Computed] public function teachers(): array { return app(ExamPaperService::class)->getTeachers( $this->isTeacher ? $this->getCurrentTeacherId() : null ); } #[Computed] public function students(): array { return app(ExamPaperService::class)->getStudents($this->teacherId); } #[Computed] public function studentPapers(): array { return app(ExamPaperService::class)->getStudentPapers($this->studentId); } #[Computed] public function selectedPaperQuestions(): array { return app(ExamPaperService::class)->getPaperQuestions($this->selectedPaperId); } public function updatedTeacherId($value): void { $this->studentId = null; $this->selectedPaperId = null; } public function updatedStudentId($value): void { $this->selectedPaperId = null; } /** * 查看OCR记录 */ public function viewRecord(int $recordId): void { $this->selectedRecordId = $recordId; $this->selectedRecord = OCRRecord::with('questions')->findOrFail($recordId); } /** * 手动重新判分 */ public function regrade(int $recordId): void { RegradeOCRSubmission::dispatch($recordId); Notification::make() ->title('已触发重新判分') ->body('请稍后刷新查看结果') ->success() ->send(); } /** * 获取最近的OCR记录 */ public function getRecentRecords(): \Illuminate\Database\Eloquent\Collection { return OCRRecord::with('questions') ->orderBy('created_at', 'desc') ->limit(10) ->get(); } /** * 切换识别模式 */ public function updatedUseChatGPT($value): void { if ($value) { Notification::make() ->title('ChatGPT识别模式') ->body('将使用ChatGPT进行试卷智能分析,无需OCR识别') ->info() ->send(); } } }