feat: configure deep search llm models

This commit is contained in:
john
2026-07-23 22:46:10 +08:00
parent be1e4c18c0
commit 784a10a592
11 changed files with 360 additions and 35 deletions
+12
View File
@@ -53,6 +53,8 @@ const BUILTIN_SERVICES = Object.freeze([
enabled: false,
timeoutMs: 120000,
priority: 100,
llmProviderKeyId: '',
llmModel: '',
},
]);
@@ -104,6 +106,14 @@ function normalizeService(input = {}, fallback = {}) {
if (!isValidSearchServiceEndpoint(endpoint)) return null;
const healthPathValue = String(input.healthPath ?? fallback.healthPath ?? '').trim();
const healthPath = healthPathValue && /^\/[^\s]{0,255}$/.test(healthPathValue) ? healthPathValue : '';
const llmProviderKeyIdValue = String(input.llmProviderKeyId ?? fallback.llmProviderKeyId ?? '').trim();
const llmProviderKeyId = /^[a-zA-Z0-9._:-]{1,128}$/.test(llmProviderKeyIdValue)
? llmProviderKeyIdValue
: '';
const llmModelValue = String(input.llmModel ?? fallback.llmModel ?? '').trim();
const llmModel = llmProviderKeyId && !/[\u0000-\u001f\u007f]/.test(llmModelValue)
? llmModelValue.slice(0, 200)
: '';
return {
id,
name: String(input.name ?? fallback.name ?? id).trim().slice(0, 80) || id,
@@ -115,6 +125,8 @@ function normalizeService(input = {}, fallback = {}) {
enabled: bool(input.enabled, bool(fallback.enabled)),
timeoutMs: boundedNumber(input.timeoutMs, fallback.timeoutMs ?? 8000, 1000, 120000),
priority: boundedNumber(input.priority, fallback.priority ?? 100, 1, 1000),
llmProviderKeyId,
llmModel,
};
}