mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-23 08:55:25 +00:00
fix(ai): hide AI actions for users without ai.read (#5749)
This commit is contained in:
@@ -40,6 +40,7 @@ export function AnalyzeLogs({ logs, context }: Props) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [aiId, setAiId] = useState<string>("");
|
||||
const [copied, setCopied] = useState(false);
|
||||
const { data: permissions } = api.user.getPermissions.useQuery();
|
||||
const { data: providers } = api.ai.getEnabledProviders.useQuery(undefined, {
|
||||
enabled: open,
|
||||
});
|
||||
@@ -51,6 +52,8 @@ export function AnalyzeLogs({ logs, context }: Props) {
|
||||
},
|
||||
});
|
||||
|
||||
if (!permissions?.ai.read) return null;
|
||||
|
||||
const handleAnalyze = () => {
|
||||
if (!aiId || logs.length === 0) return;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { TemplateGenerator } from "@/components/dashboard/project/ai/template-generator";
|
||||
import { api } from "@/utils/api";
|
||||
|
||||
interface Props {
|
||||
environmentId: string;
|
||||
@@ -6,5 +7,9 @@ interface Props {
|
||||
}
|
||||
|
||||
export const AddAiAssistant = ({ environmentId }: Props) => {
|
||||
const { data: permissions } = api.user.getPermissions.useQuery();
|
||||
|
||||
if (!permissions?.ai.read) return null;
|
||||
|
||||
return <TemplateGenerator environmentId={environmentId} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user