mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-15 13:14:35 +00:00
feat: prompts
This commit is contained in:
@@ -30,8 +30,18 @@ export const DialogSelectPrompt: Component = () => {
|
||||
const prompts = createMemo(() => {
|
||||
const all = promptsQuery.data ?? []
|
||||
const agentId = tfAgentId()
|
||||
console.log("[DialogSelectPrompt] All prompts:", all.length, "agentId:", agentId, "all:", all)
|
||||
if (!agentId) return []
|
||||
return all.filter((p) => p.available_to_agents?.includes(agentId))
|
||||
const filtered = all.filter((p) => p.available_to_agents?.includes(agentId))
|
||||
console.log(
|
||||
"[DialogSelectPrompt] Filtered prompts:",
|
||||
filtered.length,
|
||||
"for agentId:",
|
||||
agentId,
|
||||
"filtered:",
|
||||
filtered,
|
||||
)
|
||||
return filtered
|
||||
})
|
||||
|
||||
const applyPrompt = (p: { interpolation_string: string }) => {
|
||||
|
||||
@@ -617,6 +617,17 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
||||
source: cmd.source,
|
||||
}))
|
||||
|
||||
console.log("[slashCommands] builtin:", builtin.length, "custom:", custom.length)
|
||||
const promptsBuiltin = builtin.filter((c) => c.trigger === "prompts")
|
||||
const promptsCustom = custom.filter((c) => c.trigger === "prompts")
|
||||
if (promptsBuiltin.length > 0) console.log("[slashCommands] promptsBuiltin:", promptsBuiltin)
|
||||
if (promptsCustom.length > 0) console.log("[slashCommands] promptsCustom:", promptsCustom)
|
||||
if (sync.data.command.length > 0)
|
||||
console.log(
|
||||
"[slashCommands] sync.data.command:",
|
||||
sync.data.command.map((c) => ({ name: c.name, source: c.source })),
|
||||
)
|
||||
|
||||
return [...custom, ...builtin]
|
||||
})
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface SlashCommand {
|
||||
description?: string
|
||||
keybind?: string
|
||||
type: "builtin" | "custom"
|
||||
source?: "command" | "mcp" | "skill"
|
||||
source?: "command" | "mcp" | "skill" | "prompt"
|
||||
}
|
||||
|
||||
type PromptPopoverProps = {
|
||||
@@ -122,7 +122,9 @@ export const PromptPopover: Component<PromptPopoverProps> = (props) => {
|
||||
? props.t("prompt.slash.badge.skill")
|
||||
: cmd.source === "mcp"
|
||||
? props.t("prompt.slash.badge.mcp")
|
||||
: props.t("prompt.slash.badge.custom")}
|
||||
: cmd.source === "prompt"
|
||||
? props.t("prompt.slash.badge.prompt")
|
||||
: props.t("prompt.slash.badge.custom")}
|
||||
</span>
|
||||
</Show>
|
||||
<Show when={props.commandKeybind(cmd.id)}>
|
||||
|
||||
@@ -150,7 +150,12 @@ export async function bootstrapDirectory(input: {
|
||||
|
||||
Promise.all([
|
||||
input.sdk.path.get().then((x) => input.setStore("path", x.data!)),
|
||||
input.sdk.command.list().then((x) => input.setStore("command", x.data ?? [])),
|
||||
input.sdk.command.list().then((x) => {
|
||||
console.log("[bootstrap] command.list result:", x.data?.length, "commands")
|
||||
const promptsCmd = x.data?.find((c) => c.name === "prompts")
|
||||
if (promptsCmd) console.log("[bootstrap] Found 'prompts' command in server response:", promptsCmd)
|
||||
return input.setStore("command", x.data ?? [])
|
||||
}),
|
||||
input.sdk.session.status().then((x) => input.setStore("session_status", x.data!)),
|
||||
input.loadSessions(input.directory),
|
||||
input.sdk.mcp.status().then((x) => input.setStore("mcp", x.data!)),
|
||||
|
||||
@@ -274,6 +274,7 @@ export const dict = {
|
||||
"prompt.slash.badge.custom": "custom",
|
||||
"prompt.slash.badge.skill": "skill",
|
||||
"prompt.slash.badge.mcp": "mcp",
|
||||
"prompt.slash.badge.prompt": "prompt",
|
||||
"prompt.context.active": "active",
|
||||
"prompt.context.includeActiveFile": "Include active file",
|
||||
"prompt.context.removeActiveFile": "Remove active file from context",
|
||||
|
||||
Reference in New Issue
Block a user