Brunobkr's picture
Upload folder using huggingface_hub (part 55)
9360279 verified
Raw
History Blame Contribute Delete
1.3 kB
import { SET_WORKING_DIRECTORY_LABEL } from '$lib/constants/working-directory';
import { ChatFormCommandAction } from '$lib/enums';
import type { ChatFormCommand } from '$lib/types';
interface ChatCommandsOptions {
/** Gates `/model`. */
showModelSelector: boolean;
/** Gates `/prompt`. */
hasPrompts: () => boolean;
/** Gates `/cwd`. */
hasCwdTools: () => boolean;
}
/**
* The slash commands surfaced by the `/` command picker, in display order.
*
* Availability is supplied as predicates rather than store imports: this
* module is re-exported through the `$lib/constants` barrel, and importing
* stores at module load would create a circular dependency (the stores
* themselves import from `$lib/constants`).
*/
export function getChatCommands(options: ChatCommandsOptions): ChatFormCommand[] {
return [
{
action: ChatFormCommandAction.PROMPT,
description: 'Insert an MCP prompt',
disabled: !options.hasPrompts(),
name: 'prompt'
},
{
action: ChatFormCommandAction.CWD,
description: SET_WORKING_DIRECTORY_LABEL,
disabled: !options.hasCwdTools(),
keywords: ['current working directory'],
name: 'cwd'
},
{
action: ChatFormCommandAction.MODEL,
description: 'Select model',
disabled: !options.showModelSelector,
name: 'model'
}
];
}