This commit is contained in:
Your Name
2026-10-23 13:57:11 +08:00
parent ff98014fa2
commit e86ee4ae66
28 changed files with 3310 additions and 66 deletions
+19
View File
@@ -46,6 +46,25 @@ $unknown = new DifyStreamTiming($clock);
$unknown->frame(['event' => 'private-secret-event', 'data' => ['node_id' => 'private-id']], 'dify');
streamTimingExpect(isset($unknown->snapshot()['events']['other']) && !str_contains(json_encode($unknown->snapshot()), 'private-'),
'unknown provider strings never become log labels');
$vision = new DifyStreamTiming($clock);
$vision->frame(['event' => 'node_finished', 'data' => ['id' => 'private-vision-node', 'node_type' => 'llm',
'inputs' => ['#files#' => [['type' => 'image', 'url' => 'private-source'], ['type' => 'document']]],
'process_data' => ['prompts' => [['role' => 'user', 'text' => 'private-prompt', 'files' => [
['type' => 'image', 'data' => 'private-image', 'detail' => 'high'],
['type' => 'image', 'data' => 'private-image', 'detail' => 'high'],
]]]]]], 'dify');
$visionNode = $vision->snapshot()['nodes'][0];
streamTimingExpect($visionNode['input_image_count'] === 1 && $visionNode['model_image_part_count'] === 2
&& $visionNode['model_high_detail_image_part_count'] === 2, 'detect expanded image input without retaining images');
streamTimingExpect(!str_contains(json_encode($vision->snapshot()), 'private-'), 'vision counts never retain prompts or sources');
$notExposed = new DifyStreamTiming($clock);
$notExposed->frame(['event' => 'node_finished', 'data' => ['id' => 'opaque', 'node_type' => 'llm']], 'dify');
streamTimingExpect(!isset($notExposed->snapshot()['nodes'][0]['model_image_part_count']), 'unexposed processing is unknown, not zero images');
foreach (['list-operator', 'document-extractor'] as $type) {
$notExposed->frame(['event' => 'node_finished', 'data' => ['id' => $type, 'node_type' => $type]], 'dify');
}
streamTimingExpect(array_column($notExposed->snapshot()['nodes'], 'type') === ['llm', 'list-operator', 'document-extractor'],
'document preparation timings have fixed safe node labels');
$openai = new DifyStreamTiming($clock);
$now += 10; $openai->frame(['choices' => [['delta' => ['reasoning_content' => 'private-thought']]]], 'openai');
streamTimingExpect(!isset($openai->snapshot()['first_answer_ms']), 'reasoning content is not a visible first token');