Portal/rsconcept/frontend/src/features/ai/stores/use-available-variables.tsx

30 lines
988 B
TypeScript
Raw Normal View History

2025-07-13 17:58:32 +03:00
import { PromptVariableType } from '../models/prompting';
import { useAIStore } from './ai-context';
export function useAvailableVariables(): PromptVariableType[] {
const hasCurrentOSS = useAIStore(state => !!state.currentOSS);
const hasCurrentSchema = useAIStore(state => !!state.currentSchema);
const hasCurrentBlock = useAIStore(state => !!state.currentBlock);
const hasCurrentConstituenta = useAIStore(state => !!state.currentConstituenta);
return [
...(hasCurrentOSS ? [PromptVariableType.OSS] : []),
...(hasCurrentSchema
? [
PromptVariableType.SCHEMA, //
PromptVariableType.SCHEMA_THESAURUS,
PromptVariableType.SCHEMA_GRAPH,
PromptVariableType.SCHEMA_TYPE_GRAPH
]
: []),
2025-07-13 17:58:32 +03:00
...(hasCurrentBlock ? [PromptVariableType.BLOCK] : []),
...(hasCurrentConstituenta
? [
PromptVariableType.CONSTITUENTA, //
PromptVariableType.CONSTITUENTA_SYNTAX_TREE
]
: [])
2025-07-13 17:58:32 +03:00
];
}