feat: add provider analytics summary

This commit is contained in:
2026-04-18 22:01:34 +08:00
parent e99a7fbe14
commit 4d54c144a8
15 changed files with 437 additions and 36 deletions

View File

@@ -153,6 +153,11 @@ assert_jq "$storybook_jobs_json" 'length >= 2 and (map(.id) | index("'"$storyboo
echo "$story_jobs_json" | jq '[.[] | {id,output_mode,status,current_step}]'
echo "$storybook_jobs_json" | jq '[.[] | {id,output_mode,status,current_step}]'
say "Checking cross-story provider analytics"
provider_analytics_json="$(get_json "$APP_URL/api/generations/provider-analytics")"
assert_jq "$provider_analytics_json" '.total_calls >= 2 and .successful_calls >= 2 and .job_count >= 4 and .story_count >= 2 and (.by_provider | length) >= 1' "provider analytics should summarize calls across generated stories"
echo "$provider_analytics_json" | jq '{total_calls,successful_calls,failed_calls,job_count,story_count,avg_latency_ms,estimated_cost_usd}'
say "Checking story list"
list_json="$(get_json "$APP_URL/api/stories?limit=5")"
assert_jq "$list_json" "map(.id) | index($story_id) != null" "story list should include generated story"