fix(desktop): 智能体授权不再限制仅管理员——所有企业成员均可创建授权(业务规则:A授权给B/C,授权后对方可调用A的智能体)

This commit is contained in:
Pine
2026-09-16 12:49:47 +08:00
parent 444777678a
commit cd4b82ffeb
+8 -14
View File
@@ -38,7 +38,6 @@ import type { AgentSummary } from "../../api/types/agents";
import { friendlyErrorMessage } from "../../utils/error";
import { useCurrentUser } from "../../stores/communicationStore";
import { useAuthStore } from "../../auth/authStore";
import { isEnterpriseAdmin } from "../../auth/jwt";
const STATUS_META: Record<string, { color: string; label: string }> = {
active: { color: "green", label: "生效中" },
@@ -164,7 +163,6 @@ export default function AgentGrantsPage() {
const user = useCurrentUser();
const authUser = useAuthStore((s) => s.user);
const adminCompanies = isEnterpriseAdmin(authUser);
const myIds = useMemo(() => {
const ids = new Set<string>();
if (user?.id) ids.add(user.id);
@@ -294,15 +292,13 @@ export default function AgentGrantsPage() {
</span>
}
extra={
adminCompanies ? (
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => void openCreate()}
>
</Button>
) : undefined
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => void openCreate()}
>
</Button>
}
>
<Alert
@@ -315,9 +311,7 @@ export default function AgentGrantsPage() {
<div><b>L1 </b></div>
<div><b>L2 </b> <code>external_callable=True</code> =</div>
<div><b>L3 </b>// prompt </div>
{!adminCompanies && (
<div style={{ marginTop: 4, color: "#fa8c16" }}>/</div>
)}
<div style={{ marginTop: 4, color: "#fa8c16" }}>使</div>
<div style={{ marginTop: 4, color: "#8c8c8c" }}></div>
</div>
}