修复ai总开关关闭后ai评论仍然显示
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
interface RuntimeConfig {
|
interface RuntimeConfig {
|
||||||
|
AI_ENABLED?: boolean;
|
||||||
AIConfig?: {
|
AIConfig?: {
|
||||||
EnableAIComments?: boolean;
|
EnableAIComments?: boolean;
|
||||||
};
|
};
|
||||||
@@ -13,7 +14,9 @@ export function useEnableAIComments(): boolean {
|
|||||||
// 在客户端获取运行时配置
|
// 在客户端获取运行时配置
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
const runtimeConfig = (window as any).RUNTIME_CONFIG as RuntimeConfig;
|
const runtimeConfig = (window as any).RUNTIME_CONFIG as RuntimeConfig;
|
||||||
setEnableAIComments(runtimeConfig?.AIConfig?.EnableAIComments ?? false);
|
setEnableAIComments(
|
||||||
|
Boolean(runtimeConfig?.AI_ENABLED && runtimeConfig?.AIConfig?.EnableAIComments)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user