ai评论生成

This commit is contained in:
mtvpls
2026-03-14 11:30:17 +08:00
parent ea169593a6
commit 11317abc98
8 changed files with 731 additions and 0 deletions
+21
View File
@@ -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;
}