mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-22 16:35:20 +08:00
feat(cloud): enforce signed workspace subscription resource limits
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useCurrentWorkspace } from '@/app/infra/http';
|
||||
import { systemInfo } from '@/app/infra/http/HttpClient';
|
||||
import { useSidebarData } from '@/app/home/components/home-sidebar/SidebarDataContext';
|
||||
|
||||
@@ -46,27 +47,30 @@ export function useWorkspaceQuotaStatus(): WorkspaceQuotaStatus {
|
||||
skills,
|
||||
quotaDataLoaded,
|
||||
} = useSidebarData();
|
||||
const limitation = systemInfo.limitation;
|
||||
const currentWorkspace = useCurrentWorkspace();
|
||||
const cloud = currentWorkspace?.workspace.source === 'cloud_projection';
|
||||
const limitation = cloud ? currentWorkspace.limitation : systemInfo.limitation;
|
||||
const loaded = quotaDataLoaded && (!cloud || limitation != null);
|
||||
|
||||
const botQuota = quotaItem(
|
||||
bots.length,
|
||||
limitation?.max_bots,
|
||||
quotaDataLoaded,
|
||||
loaded,
|
||||
);
|
||||
const pipelineQuota = quotaItem(
|
||||
pipelines.length,
|
||||
limitation?.max_pipelines,
|
||||
quotaDataLoaded,
|
||||
loaded,
|
||||
);
|
||||
const knowledgeBaseQuota = quotaItem(
|
||||
knowledgeBases.length,
|
||||
limitation?.max_knowledge_bases,
|
||||
quotaDataLoaded,
|
||||
loaded,
|
||||
);
|
||||
const extensionQuota = quotaItem(
|
||||
pluginCount + mcpServers.length + skills.length,
|
||||
limitation?.max_extensions,
|
||||
quotaDataLoaded,
|
||||
loaded,
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface CurrentWorkspace {
|
||||
placement_generation: number;
|
||||
/** Signed Cloud display metadata; never used for client-side authorization. */
|
||||
plan_name?: string | null;
|
||||
limitation?: Record<string, number> | null;
|
||||
}
|
||||
|
||||
export interface WorkspaceSpaceBilling {
|
||||
|
||||
Reference in New Issue
Block a user