ai评论生成
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
interface RuntimeConfig {
|
||||
AIConfig?: {
|
||||
EnableAIComments?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export function useEnableAIComments(): boolean {
|
||||
const [enableAIComments, setEnableAIComments] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// 在客户端获取运行时配置
|
||||
if (typeof window !== 'undefined') {
|
||||
const runtimeConfig = (window as any).RUNTIME_CONFIG as RuntimeConfig;
|
||||
setEnableAIComments(runtimeConfig?.AIConfig?.EnableAIComments ?? false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return enableAIComments;
|
||||
}
|
||||
Reference in New Issue
Block a user