fix(P2-10): is_placeholder now reflects actual LLM driver availability
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

Previously hardcoded to false in Tauri bridge. Now checks whether
kernel provided a driver before building classroom, correctly flagging
placeholder content when LLM is unavailable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-06 12:31:44 +08:00
parent 7a3334384a
commit 9c346ed6fb
2 changed files with 6 additions and 4 deletions

View File

@@ -129,12 +129,12 @@ pub async fn classroom_generate(
}
// Get LLM driver from kernel if available, otherwise use placeholder mode
let pipeline = {
let (pipeline, has_driver) = {
let ks = kernel_state.lock().await;
if let Some(kernel) = ks.as_ref() {
GenerationPipeline::with_driver(kernel.driver(), kernel.config().model().to_string())
(GenerationPipeline::with_driver(kernel.driver(), kernel.config().model().to_string()), true)
} else {
GenerationPipeline::new()
(GenerationPipeline::new(), false)
}
};
@@ -211,7 +211,7 @@ pub async fn classroom_generate(
source_document: kernel_request.document.map(|_| "user_document".to_string()),
model: None,
version: "2.0.0".to_string(),
is_placeholder: false, // P2-10: Tauri layer always has a driver
is_placeholder: !has_driver, // P2-10: true when no LLM driver available
custom: serde_json::Map::new(),
},
};

View File

@@ -109,6 +109,8 @@ export interface ClassroomMetadata {
sourceDocument?: string;
model?: string;
version: string;
/** P2-10: marks content generated by placeholder fallback when LLM fails */
is_placeholder?: boolean;
custom: Record<string, unknown>;
}