From 12db192320982fdb7346a505322f3baac32147b4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 22 Jul 2026 18:39:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20api=5Fmodel=5Fperf/api=5Fprovider=5Froi?= =?UTF-8?q?=20params=5Fkw=3DNone=E6=97=B6.get()=E2=86=92AttributeError,?= =?UTF-8?q?=E6=94=B9=E7=94=A8(params=5Fkw=20or=20{})?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sage_datamart/init.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sage_datamart/init.py b/sage_datamart/init.py index b4f3152..cf273f1 100644 --- a/sage_datamart/init.py +++ b/sage_datamart/init.py @@ -55,7 +55,7 @@ async def _resolve_view(request): async def api_model_perf(sor, params_kw=None): try: - stat_date = params_kw.get('date') if params_kw else None + stat_date = (params_kw or {}).get('date') sql = """SELECT COALESCE(l.name, f.model) as model, CASE WHEN SUM(total_calls)>0 THEN ROUND(SUM(total_calls*COALESCE(avg_ttft_ms,avg_ttot_ms))/SUM(total_calls),1) ELSE NULL END as avg_latency_ms, CASE WHEN SUM(total_calls)>0 THEN ROUND(SUM(total_calls*avg_ttot_ms)/SUM(total_calls),1) ELSE NULL END as avg_ttot_ms, @@ -79,8 +79,8 @@ async def api_model_perf(sor, params_kw=None): async def api_provider_roi(sor, params_kw=None): try: - model = params_kw.get('model') if params_kw else None - stat_date = params_kw.get('date') if params_kw else None + model = (params_kw or {}).get('model') + stat_date = (params_kw or {}).get('date') sql = "SELECT * FROM dm_provider_cost_daily WHERE 1=1" ns = {} if stat_date: