@onco-foundry/mask-port 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -33,6 +33,7 @@ const extractedSchema = z.array(z.object({
|
|
|
33
33
|
/** 姓名类目标:形态校验只拦阿拉伯数字(单字符中文名是合法情形,不拦)。 */
|
|
34
34
|
const NAME_TARGETS = new Set(['patient_name', 'doctor_signature']);
|
|
35
35
|
const modelResponseSchema = z.object({
|
|
36
|
+
stop_reason: z.string().optional(),
|
|
36
37
|
content: z.array(z.object({
|
|
37
38
|
type: z.string(),
|
|
38
39
|
text: z.string().optional(),
|
|
@@ -88,7 +89,8 @@ export const createLlmSensitiveWordFinder = (options) => {
|
|
|
88
89
|
system: SYSTEM_PROMPT,
|
|
89
90
|
messages: [{ role: 'user', content: text }],
|
|
90
91
|
temperature: 0,
|
|
91
|
-
max_tokens
|
|
92
|
+
// 推理型模型的思考也吃 max_tokens:给小了会在正文输出前被截断,响应里一个 text 块都没有。
|
|
93
|
+
max_tokens: 16384,
|
|
92
94
|
stream: false,
|
|
93
95
|
}),
|
|
94
96
|
signal: AbortSignal.timeout(timeoutMs),
|
|
@@ -107,7 +109,9 @@ export const createLlmSensitiveWordFinder = (options) => {
|
|
|
107
109
|
// 带推理的模型会先回 thinking 块,取第一个 text 块。
|
|
108
110
|
const textBlock = payload.data.content.find((block) => block.type === 'text' && block.text);
|
|
109
111
|
if (textBlock?.text === undefined) {
|
|
110
|
-
|
|
112
|
+
const blockTypes = payload.data.content.map((block) => block.type).join('、');
|
|
113
|
+
throw new AppError(`LLM 敏感词提取响应缺少文本输出(stop_reason=${payload.data.stop_reason ?? '未知'},`
|
|
114
|
+
+ `块类型=${blockTypes};stop_reason=max_tokens 说明思考烧光了 token 上限)`, 502);
|
|
111
115
|
}
|
|
112
116
|
const parsed = extractedSchema.safeParse(extractJsonArray(textBlock.text));
|
|
113
117
|
if (!parsed.success) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onco-foundry/mask-port",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"agent-lattice": "0.25.0",
|
|
17
17
|
"sharp": "^0.35.3",
|
|
18
18
|
"zod": "^4.4.3",
|
|
19
|
-
"@onco-foundry/capability-registry": "0.1.1",
|
|
20
|
-
"@onco-foundry/errors": "0.1.1",
|
|
21
19
|
"@onco-foundry/resource-versioning": "0.2.0",
|
|
22
|
-
"@onco-foundry/trace-port": "0.3.2"
|
|
20
|
+
"@onco-foundry/trace-port": "0.3.2",
|
|
21
|
+
"@onco-foundry/errors": "0.1.1",
|
|
22
|
+
"@onco-foundry/capability-registry": "0.1.1"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|