更新
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
// 指令定义
|
||||
'commands' => [
|
||||
'commands' => [
|
||||
'prescription-ai:work' => 'app\\command\\PrescriptionAiWork',
|
||||
'prescription-ai:backfill' => 'app\\command\\PrescriptionAiBackfill',
|
||||
// 定时任务
|
||||
'crontab' => 'app\common\command\Crontab',
|
||||
// 退款查询
|
||||
|
||||
@@ -22,15 +22,58 @@ return [
|
||||
* 单次请求可随附的附件总数上限。Dify 应用的 file_upload.number_limits 超限时
|
||||
* 直接返回 400 invalid_param 拒绝整单,患者纵向资料的附件数量又不可控,
|
||||
* 因此这里必须与上游应用配置保持一致(默认 3),超出的附件改以清单形式送达。
|
||||
* 各应用的上限不同时用下面 models 里的 max_files 覆盖;核对方式是只读调用
|
||||
* 该应用的 /parameters,读取 file_upload.number_limits。
|
||||
*/
|
||||
'max_files' => (int) env(
|
||||
'prescription_ai.MAX_FILES',
|
||||
env('prescription_ai.max_files', 3)
|
||||
),
|
||||
// Per-model staged analysis limits. Oversized semantic units and exhausted call budgets
|
||||
// are explicit task errors; they never silently remove patient evidence or attachments.
|
||||
'manual_analysis' => [
|
||||
/**
|
||||
* 单次提示词的字节上限(UTF-8 字节是 token 的保守上界)。调大可减少分片与压缩
|
||||
* 轮次、显著缩短一份报告的总耗时;上游应用限制更严时会返回可重试的拒绝,
|
||||
* 此时调小本值。
|
||||
*/
|
||||
'input_token_budget' => (int) env(
|
||||
'prescription_ai.MANUAL_INPUT_TOKEN_BUDGET',
|
||||
env('prescription_ai.manual_input_token_budget', 48000)
|
||||
),
|
||||
'max_calls_per_model' => (int) env(
|
||||
'prescription_ai.MANUAL_MAX_CALLS_PER_MODEL',
|
||||
env('prescription_ai.manual_max_calls_per_model', 128)
|
||||
),
|
||||
/**
|
||||
* 医学研究对照模式:无论资料是否完整,两个模型都必须先各自独立开出候选处方,
|
||||
* 再由服务端与人工方比较。缺口、假设与复核要求写入候选方的说明与风险提示,
|
||||
* 不再以资料不足为由返回空方案。候选方仍不写回正式处方、审核或订单。
|
||||
*/
|
||||
'require_candidate' => filter_var(
|
||||
env('prescription_ai.MANUAL_REQUIRE_CANDIDATE', true),
|
||||
FILTER_VALIDATE_BOOLEAN
|
||||
),
|
||||
/**
|
||||
* 后台分阶段分析的单次请求超时(秒,上限 300)。同步页面仍使用上面的 timeout;
|
||||
* 该值必须明显小于任务租约 prescription_analysis.lease_seconds。
|
||||
*/
|
||||
'request_timeout' => (int) env(
|
||||
'prescription_ai.MANUAL_REQUEST_TIMEOUT',
|
||||
240
|
||||
),
|
||||
// 模型仍拒绝开方时,携带其拒绝理由重新追问的次数。
|
||||
'candidate_insist_rounds' => (int) env(
|
||||
'prescription_ai.MANUAL_CANDIDATE_INSIST_ROUNDS',
|
||||
2
|
||||
),
|
||||
],
|
||||
'models' => [
|
||||
'qwen' => [
|
||||
'name' => 'qwen3.6-35b',
|
||||
'label' => '千问',
|
||||
// 该应用 file_upload.number_limits = 3
|
||||
'max_files' => (int) env('prescription_ai.QWEN_MAX_FILES', 3),
|
||||
'api_key' => (string) env(
|
||||
'prescription_ai.QWEN_API_KEY',
|
||||
env('prescription_ai.qwen_api_key', '')
|
||||
@@ -39,6 +82,8 @@ return [
|
||||
'openai' => [
|
||||
'name' => 'gpt-5.6-sol',
|
||||
'label' => 'OpenAI',
|
||||
// 该应用 file_upload.number_limits = 10:一次多带附件可显著减少往返次数
|
||||
'max_files' => (int) env('prescription_ai.OPENAI_MAX_FILES', 10),
|
||||
'api_key' => (string) env(
|
||||
'prescription_ai.OPENAI_API_KEY',
|
||||
env('prescription_ai.openai_api_key', '')
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/** Async clinician-facing analysis. Enable only after migration and workers are ready. */
|
||||
return [
|
||||
'enabled' => filter_var(env('prescription_analysis.ENABLED', false), FILTER_VALIDATE_BOOLEAN),
|
||||
'encryption_key' => (string) env('prescription_analysis.ENCRYPTION_KEY', ''),
|
||||
'start_at' => (int) env('prescription_analysis.START_AT', 0),
|
||||
'transcript_wait_seconds' => 300,
|
||||
'debounce_seconds' => 60,
|
||||
'lease_seconds' => 600,
|
||||
'max_attempts' => 3,
|
||||
'max_manual_retries' => 2,
|
||||
'daily_model_tasks' => 200,
|
||||
'daily_patient_batches' => 10,
|
||||
// Concurrent tasks allowed per model. It only takes effect when that many consumer
|
||||
// processes run for the lane (php think prescription-ai:work --lane=<model>).
|
||||
'max_parallel_per_model' => 2,
|
||||
'refresh_recent_days' => 7,
|
||||
'auto_refresh_sources' => true,
|
||||
'auto_refresh_prescription' => true,
|
||||
'max_context_bytes' => 8000000,
|
||||
];
|
||||
Reference in New Issue
Block a user