From 5bf15e4086a48993ccdfb80920d542b8cce11fb4 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Mon, 22 Jun 2026 09:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dai=E6=80=BB=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=90=8Eai=E8=AF=84=E8=AE=BA=E4=BB=8D?= =?UTF-8?q?=E7=84=B6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useEnableAIComments.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/useEnableAIComments.ts b/src/hooks/useEnableAIComments.ts index dd4ab0c..6231208 100644 --- a/src/hooks/useEnableAIComments.ts +++ b/src/hooks/useEnableAIComments.ts @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; interface RuntimeConfig { + AI_ENABLED?: boolean; AIConfig?: { EnableAIComments?: boolean; }; @@ -13,7 +14,9 @@ export function useEnableAIComments(): boolean { // 在客户端获取运行时配置 if (typeof window !== 'undefined') { const runtimeConfig = (window as any).RUNTIME_CONFIG as RuntimeConfig; - setEnableAIComments(runtimeConfig?.AIConfig?.EnableAIComments ?? false); + setEnableAIComments( + Boolean(runtimeConfig?.AI_ENABLED && runtimeConfig?.AIConfig?.EnableAIComments) + ); } }, []);