更新
This commit is contained in:
@@ -19,6 +19,7 @@ $selectProfile = $reflection->getMethod('selectAssistantProfile');
|
||||
$buildPrompt = $reflection->getMethod('buildAssistantPrompt');
|
||||
$buildReportPrompt = $reflection->getMethod('buildPrompt');
|
||||
$buildInputs = $reflection->getMethod('buildUpstreamInputs');
|
||||
$parseDraft = $reflection->getMethod('parsePrescriptionDraft');
|
||||
$tasks = $reflection->getConstant('ASSISTANT_TASKS');
|
||||
$assistantPermission = $reflection->getConstant('PERMISSION_ASSISTANT');
|
||||
|
||||
@@ -32,6 +33,7 @@ assistantExpect(
|
||||
'summary',
|
||||
'tcm_pattern',
|
||||
'prescription_review',
|
||||
'prescription_generate',
|
||||
'medication_review',
|
||||
'exam_review',
|
||||
'complication_risk',
|
||||
@@ -43,10 +45,11 @@ assistantExpect(
|
||||
|
||||
assistantExpect($selectProfile->invoke(null, 'summary', '') === 'qwen', 'summary routes to qwen');
|
||||
assistantExpect($selectProfile->invoke(null, 'tcm_pattern', '') === 'qwen', 'TCM routes to qwen');
|
||||
assistantExpect($selectProfile->invoke(null, 'exam_review', '') === 'openai', 'exam routes to openai');
|
||||
assistantExpect($selectProfile->invoke(null, 'prescription_generate', '') === 'qwen', 'prescription generation routes to qwen');
|
||||
assistantExpect($selectProfile->invoke(null, 'exam_review', '') === 'qwen', 'exam routes to qwen');
|
||||
assistantExpect(
|
||||
$selectProfile->invoke(null, 'custom', '请评估并发症风险') === 'openai',
|
||||
'risk prompt routes to openai'
|
||||
$selectProfile->invoke(null, 'custom', '请评估并发症风险') === 'qwen',
|
||||
'risk prompt routes to qwen'
|
||||
);
|
||||
assistantExpect(
|
||||
$selectProfile->invoke(null, 'custom', '请分析中药处方') === 'qwen',
|
||||
@@ -80,6 +83,30 @@ assistantExpect(substr_count($prompt, '13812345678') === 0, 'question phone is a
|
||||
assistantExpect(str_contains($prompt, '</USER_QUESTION>'), 'injected boundary is neutralized');
|
||||
assistantExpect(str_contains($prompt, '密钥索取'), 'highest-priority safety boundary is present');
|
||||
|
||||
$draftPrompt = $buildPrompt->invoke(null, $context, 'prescription_generate', '请生成处方草稿');
|
||||
assistantExpect(str_contains($draftPrompt, 'PATIENT_LONGITUDINAL_SOURCE'), 'prescription prompt uses longitudinal context');
|
||||
assistantExpect(str_contains($draftPrompt, 'prescription_draft'), 'prescription prompt requires structured draft JSON');
|
||||
assistantExpect(str_contains($draftPrompt, '逐味复核'), 'prescription draft requires doctor review');
|
||||
$draft = $parseDraft->invoke(null, json_encode([
|
||||
'prescription_draft' => [
|
||||
'clinical_diagnosis' => '气阴两虚证',
|
||||
'herbs' => [
|
||||
['name' => '黄芪', 'dosage' => 15, 'formula_type' => '主方'],
|
||||
['name' => '山药', 'dosage' => 12, 'formula_type' => '主方'],
|
||||
],
|
||||
'dose_count' => 7,
|
||||
'usage_days' => 7,
|
||||
'times_per_day' => 2,
|
||||
'rationale' => '结合完整资料辨证拟方',
|
||||
],
|
||||
], JSON_UNESCAPED_UNICODE));
|
||||
assistantExpect(is_array($draft) && count($draft['herbs']) === 2, 'valid prescription draft is parsed');
|
||||
assistantExpect($draft['requires_doctor_review'] === true && $draft['audit_status'] === 0, 'draft cannot bypass review');
|
||||
assistantExpect(
|
||||
$parseDraft->invoke(null, '{"prescription_draft":{"clinical_diagnosis":"证型","herbs":[{"name":"黄芪","dosage":10},{"name":"黄芪","dosage":12}]}}') === null,
|
||||
'duplicate herbs are rejected'
|
||||
);
|
||||
|
||||
$reportPrompt = $buildReportPrompt->invoke(null, $context);
|
||||
assistantExpect(!str_contains($reportPrompt, '13812345678'), 'saved report prompt redacts phone');
|
||||
assistantExpect(!str_contains($reportPrompt, '11010519491231002X'), 'saved report prompt redacts ID');
|
||||
|
||||
Reference in New Issue
Block a user