fix(pi): converge worker failures and thinking state

This commit is contained in:
brother7 committed 2026-08-25 11:45:14 +08:00
1 parent 274187e3cf
commit 61817b161f
28 files changed
+2019 -118

No files matched your search

+41
View File
@@ -179,6 +179,47 @@ describe('Pi Provider catalog', () => {
})).toThrowError(PiProviderConfigError);
});
it('projects the managed DeepSeek capability contract into Pi models.json', () => {
const provider = account({
id: 'niancode-user-models',
vendorId: 'custom',
apiProtocol: 'openai-completions',
baseUrl: 'http://127.0.0.1:54321/api/ai-proxy/v1',
model: 'deepseek/deepseek-v4-pro',
metadata: {
worksSquareCredentialMode: 'works_square_ai_gateway_proxy',
customModels: ['deepseek/deepseek-v4-pro'],
},
});
const catalog = buildPiProviderCatalog({ accounts: [provider] });
const descriptor = catalog.descriptors[0]!.models[0]!;
const written = catalog.modelsFile.providers[resolvePiRuntimeProviderId(provider.id)]!.models[0]!;
expect(descriptor).toMatchObject({
id: 'deepseek-v4-pro',
reasoning: true,
contextWindow: 1_000_000,
maxOutputTokens: 384_000,
compat: {
thinkingFormat: 'deepseek',
requiresReasoningContentOnAssistantMessages: true,
},
thinkingLevelMap: {
off: null,
minimal: null,
low: null,
medium: null,
high: 'high',
},
});
expect(written).toMatchObject({
reasoning: true,
thinkingLevelMap: descriptor.thinkingLevelMap,
compat: descriptor.compat,
});
});
it('does not replace an existing catalog when model selection is unavailable', async () => {
const root = await mkdtemp(path.join(tmpdir(), 'makelore-pi-provider-'));
temporaryRoots.push(root);