@extends('layouts.app') @section('content')
@include('admin.partials.export-excel-button', ['section' => 'ai-knowledge-base', 'label' => 'Export Excel Basis AI'])
@php $editDocument = $editDocument ?? null; $isEditingAiKnowledge = is_array($editDocument) && ! empty($editDocument['id']); $selectedDocumentType = old('document_type', $isEditingAiKnowledge ? ($editDocument['document_type'] ?? '') : ''); $documentTitleValue = old('title', $isEditingAiKnowledge ? ($editDocument['title'] ?? '') : ''); $documentDescriptionValue = old('description', $isEditingAiKnowledge ? ($editDocument['description'] ?? '') : ''); $documents = is_array($documents ?? null) ? $documents : []; $documentTypes = is_array($documentTypes ?? null) ? $documentTypes : []; $aiKbToText = function ($value, string $fallback = '') { if (is_array($value)) { return collect($value)->flatten()->filter(fn ($item) => filled($item))->map(fn ($item) => (string) $item)->implode(" "); } $text = trim((string) ($value ?? '')); return $text !== '' ? $text : $fallback; }; $aiKbToArray = function ($value) { if (is_array($value)) { return $value; } $text = trim((string) ($value ?? '')); if ($text === '') { return []; } return preg_split('/[,; ]+/', $text, -1, PREG_SPLIT_NO_EMPTY) ?: []; }; @endphp

Basis Pengetahuan AI

Upload file PDF seperti kamus bahasa Indonesia, buku pedoman tata bahasa, pedoman KKO Taksonomi Bloom, dan referensi utama lainnya. File ini menjadi bahan dasar AI untuk merumuskan kalimat Sub-CPMK, Indikator, serta konteks awal sebelum memberi respon terhadap kebutuhan penyusunan RPS.

Prioritas Sumber AI
@csrf @if ($isEditingAiKnowledge) @method('PUT') @endif

{{ $isEditingAiKnowledge ? 'Edit File PDF Basis Pengetahuan' : 'Upload File PDF Basis Pengetahuan' }}

{{ $isEditingAiKnowledge ? 'Perbarui jenis dokumen, judul, keterangan, atau ganti file PDF jika diperlukan. Kosongkan file PDF jika hanya ingin mengubah data keterangan.' : 'Gunakan PDF yang isinya stabil dan resmi. Sistem akan mengekstrak teks PDF dan menyimpannya sebagai konteks awal AI.' }}

Jenis Dokumen Judul Dokumen
Keterangan
File PDF

Format PDF, maksimal 80 MB. Upload file besar dilakukan bertahap otomatis agar tidak terkena batas POST PHP. @if($isEditingAiKnowledge) Kosongkan jika tidak ingin mengganti file PDF. @endif

@if ($isEditingAiKnowledge) Batal Edit @endif

Daftar File Basis Pengetahuan AI

Dokumen berikut akan dibaca sebagai konteks awal AI sebelum menyusun Sub-CPMK, indikator, pilihan pembelajaran, dan materi pembelajaran.

{{ count($documents) }} dokumen
@forelse ($documents as $index => $document) @php $document = is_array($document) ? $document : []; $profile = is_array($document['knowledge_profile'] ?? null) ? $document['knowledge_profile'] : []; $chunks = $aiKbToArray($document['searchable_chunks'] ?? []); $structured = is_array($document['structured_knowledge'] ?? null) ? $document['structured_knowledge'] : []; $keywords = $aiKbToArray($profile['keywords'] ?? ($document['retrieval_keywords'] ?? [])); $summaryText = $aiKbToText($profile['summary'] ?? ($document['extracted_excerpt'] ?? null), 'Belum ada ringkasan teks.'); $structuredSource = $structured['main_topics'] ?? ($structured['concepts'] ?? []); $structuredItems = collect($aiKbToArray($structuredSource)) ->map(fn ($item) => is_array($item) ? ($item['topic'] ?? $item['name'] ?? $item['title'] ?? '') : $item) ->filter(fn ($item) => filled($item)) ->take(5) ->values(); $weeklyTopics = collect($aiKbToArray($structured['possible_weekly_topics'] ?? [])) ->map(fn ($item) => is_array($item) ? ($item['topic'] ?? $item['title'] ?? '') : $item) ->filter(fn ($item) => filled($item)) ->take(3) ->values(); $analysisStatus = ! empty($structured) ? ($structured['analysis_status'] ?? 'tersimpan') : 'belum tersedia'; @endphp @empty @endforelse
No Jenis Judul / File Keterangan Halaman Status Ekstraksi Informasi Tersimpan untuk AI Aksi
{{ $index + 1 }} {{ $document['document_type_label'] ?? ($documentTypes[$document['document_type'] ?? ''] ?? '-') }}
{{ $document['uploaded_at'] ?? '-' }}
{{ $document['title'] ?? '-' }}
{{ $document['original_filename'] ?? '-' }}
{{ $document['description'] ?? '-' }} {{ $document['page_count'] ?? 0 }} @php($status = $document['extraction_status'] ?? 'unknown') {{ strtoupper($status) }} @if (! empty($document['extraction_error']))
{{ $document['extraction_error'] }}
@endif
Ringkasan AI:
{{ $summaryText }}
Potongan informasi tersimpan: {{ count($chunks) }} chunk
Analisis terstruktur: {{ $analysisStatus }} @if ($structuredItems->isNotEmpty())
Konsep/Topik: {{ $structuredItems->implode(', ') }}
@endif @if ($weeklyTopics->isNotEmpty())
Usulan topik mingguan: {{ $weeklyTopics->implode(' • ') }}
@endif @if (! empty($keywords))
Kata kunci: {{ collect($keywords)->filter()->take(12)->implode(', ') }}
@endif
@if (! empty($document['id'])) Edit Download
@csrf @method('DELETE')
@endif
Belum ada file basis pengetahuan AI yang diunggah.
@endsection