This commit is contained in:
Your Name
2026-10-08 15:49:53 +08:00
parent 1c9b093e08
commit 67c374d899
52 changed files with 51959 additions and 75 deletions
@@ -37,6 +37,7 @@ namespace {
require dirname(__DIR__) . '/vendor/autoload.php';
use app\common\service\DifyChatService;
use app\common\service\NihaixiaClinicalSkill;
function expectSame($expected, $actual, string $message): void
{
@@ -210,6 +211,9 @@ foreach (['dify' => 'chat-messages', 'openai' => 'chat/completions'] as $protoco
expectSame(true, $strictResult['ok'], 'strict ' . $protocol . ' accepts distinct logical attachments sharing a URL');
expectSame(1, count($upstreamTestRequests), 'strict ' . $protocol . ' submits the complete batch once');
$payload = $upstreamTestRequests[0]['payload'];
$wirePrompt = $protocol === 'dify' ? $payload['query'] : $payload['messages'][0]['content'][0]['text'];
expectSame(true, str_contains($wirePrompt, NihaixiaClinicalSkill::VERSION), 'strict ' . $protocol . ' includes the clinical skill on the wire');
expectSame(true, str_contains($wirePrompt, 'offline query'), 'strict ' . $protocol . ' preserves the clinical question');
$wireUrls = $protocol === 'dify' ? array_column($payload['files'], 'url')
: array_column(array_column(array_slice($payload['messages'][0]['content'], 1), 'image_url'), 'url');
expectSame(array_column($duplicateFiles, 'url'), $wireUrls, 'strict ' . $protocol . ' transmits every attachment in manifest order');