ЮИ - редактура вопросов в АВТОПРОГОНАХ

This commit is contained in:
2026-04-18 10:13:16 +03:00
parent 0431595542
commit 9872ef5446
35 changed files with 1088 additions and 44 deletions
@@ -19,6 +19,7 @@ export interface AssistantBoundaryPolicyGroundingGuardInput {
export interface AssistantBoundaryPolicy {
buildAssistantDataScopeContractReply: (scopeProbe?: Record<string, unknown> | null) => string;
buildAssistantProactiveOrganizationOfferReply: (scopeProbe?: Record<string, unknown> | null) => string;
buildAssistantDataScopeSelectionReply: (organization: unknown) => string;
buildAssistantOrganizationFactBoundaryReply: (organization: unknown) => string;
buildAssistantOperationalBoundaryReply: () => string;
@@ -90,6 +91,32 @@ export function createAssistantBoundaryPolicy(deps: AssistantBoundaryPolicyDeps)
].join(" ");
}
function buildAssistantProactiveOrganizationOfferReply(scopeProbe: Record<string, unknown> | null = null): string {
const organizations = Array.isArray(scopeProbe?.organizations)
? scopeProbe.organizations
.map((item) => normalizeSelectedOrganization(item, deps.normalizeOrganizationScopeValue))
.filter((item) => item.length > 0)
.filter((item, index, array) => array.indexOf(item) === index)
: [];
if (organizations.length === 1) {
return [
`Если дальше пойдём в данные 1С, могу сразу держать в контуре ${organizations[0]}.`,
"Можно просто писать вопрос по документам, остаткам, НДС или контрагентам."
].join(" ");
}
if (organizations.length > 1) {
const preview = organizations.slice(0, 10).join(", ");
return [
`Если дальше пойдём в данные 1С, могу сразу зафиксировать организацию: ${preview}.`,
"Просто напишите название компании, и дальше буду держать её активной в этой сессии."
].join(" ");
}
return "";
}
function buildAssistantDataScopeSelectionReply(organization: unknown): string {
const selected = normalizeSelectedOrganization(organization, deps.normalizeOrganizationScopeValue);
return [
@@ -219,6 +246,7 @@ export function createAssistantBoundaryPolicy(deps: AssistantBoundaryPolicyDeps)
return {
buildAssistantDataScopeContractReply,
buildAssistantProactiveOrganizationOfferReply,
buildAssistantDataScopeSelectionReply,
buildAssistantOrganizationFactBoundaryReply,
buildAssistantOperationalBoundaryReply,