This commit is contained in:
gr
2026-10-23 09:27:45 +08:00
34 changed files with 2866 additions and 225 deletions
@@ -63,6 +63,12 @@ $generic = callPrivate('buildRequestSpecs', [
expectSame(2, count($generic), 'ambiguous /v1 base should support both protocols');
expectSame('https://ai.example.test/v1/chat-messages', $generic[0]['url'], 'Dify endpoint');
expectSame('blocking', $generic[0]['payload']['response_mode'], 'Dify blocking request');
expectSame(false, $generic[0]['payload']['auto_generate_name'], 'Dify blocking generation disables background titles');
expectSame(false, array_key_exists('auto_generate_name', $generic[1]['payload']), 'OpenAI protocol has no Dify title field');
$streamingSpecs = callPrivate('buildRequestSpecs', ['https://ai.example.test/v1', 'model-name', [],
'clinical prompt', 'server-user', true]);
expectSame(false, $streamingSpecs[0]['payload']['auto_generate_name'], 'Dify streaming generation disables background titles');
expectSame(true, $streamingSpecs[0]['payload']['inputs'] instanceof stdClass, 'empty inputs retain JSON object semantics');
expectSame('https://ai.example.test/v1/chat/completions', $generic[1]['url'], 'OpenAI endpoint');
expectSame('model-name', $generic[1]['payload']['model'], 'profile model selection');
expectSame('clinical prompt', $generic[1]['payload']['messages'][0]['content'], 'OpenAI prompt');