From bd5c261b992039d6f9a338cfb2d00e48ccf28f8f Mon Sep 17 00:00:00 2001 From: "1808837298@qq.com" <1808837298@qq.com> Date: Sun, 9 Mar 2025 21:23:33 +0800 Subject: [PATCH] fix: Add optional chaining to prevent potential undefined errors in LogsTable #833 --- web/src/components/LogsTable.js | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/web/src/components/LogsTable.js b/web/src/components/LogsTable.js index b2fa24a2..c41be756 100644 --- a/web/src/components/LogsTable.js +++ b/web/src/components/LogsTable.js @@ -459,7 +459,7 @@ const LogsTable = () => { <> {renderUseTime(text)} - {renderFirstUseTime(other.frt)} + {renderFirstUseTime(other?.frt)} {renderIsStream(record.is_stream)} @@ -837,29 +837,29 @@ const LogsTable = () => { let content = ''; if (other?.ws || other?.audio) { content = renderAudioModelPrice( - other.text_input, - other.text_output, - other.model_ratio, - other.model_price, - other.completion_ratio, - other.audio_input, - other.audio_output, + other?.text_input, + other?.text_output, + other?.model_ratio, + other?.model_price, + other?.completion_ratio, + other?.audio_input, + other?.audio_output, other?.audio_ratio, other?.audio_completion_ratio, - other.group_ratio, - other.cache_tokens || 0, - other.cache_ratio || 1.0, + other?.group_ratio, + other?.cache_tokens || 0, + other?.cache_ratio || 1.0, ); } else { content = renderModelPrice( logs[i].prompt_tokens, logs[i].completion_tokens, - other.model_ratio, - other.model_price, - other.completion_ratio, - other.group_ratio, - other.cache_tokens || 0, - other.cache_ratio || 1.0, + other?.model_ratio, + other?.model_price, + other?.completion_ratio, + other?.group_rati, + other?.cache_tokens || 0, + other?.cache_ratio || 1.0, ); } expandDataLocal.push({