add mode config, fix app params

This commit is contained in:
duanfuxiang 2025-04-28 23:12:59 +08:00
parent f282c9f667
commit 7791baabaa
4 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,7 @@
releases:
- version: "0.2"
features:
- "add mode config, you can create mode config in _infio_prompts folder"
- version: "0.1.8"
improvements:
- "fix chat input command plugin"

View File

@ -114,6 +114,7 @@ const Chat = forwardRef<ChatRef, ChatProps>((props, ref) => {
const { streamResponse, chatModel } = useLLM()
const promptGenerator = useMemo(() => {
// @ts-expect-error
return new PromptGenerator(getRAGEngine, app, settings, diffStrategy, customModePrompts, customModeList)
}, [getRAGEngine, app, settings, diffStrategy, customModePrompts, customModeList])

View File

@ -1,3 +1,5 @@
import { App } from "obsidian"
import { addCustomInstructions } from "../core/prompts/sections/custom-instructions"
import { ALWAYS_AVAILABLE_TOOLS, TOOL_GROUPS, ToolGroup } from "./tool-groups"
@ -262,6 +264,7 @@ export async function getAllModesWithPrompts(): Promise<ModeConfig[]> {
// Helper function to get complete mode details with all overrides
export async function getFullModeDetails(
app: App,
modeSlug: string,
customModes?: ModeConfig[],
customModePrompts?: CustomModePrompts,
@ -284,6 +287,7 @@ export async function getFullModeDetails(
let fullCustomInstructions = baseCustomInstructions
if (options?.cwd) {
fullCustomInstructions = await addCustomInstructions(
app,
baseCustomInstructions,
options.globalCustomInstructions || "",
options.cwd,

View File

@ -252,7 +252,7 @@ export class PromptGenerator {
// Add current mode details
const currentMode = this.settings.mode
const modeDetails = await getFullModeDetails(currentMode)
const modeDetails = await getFullModeDetails(this.app, currentMode, this.customModeList, this.customModePrompts)
details += `\n\n# Current Mode\n`
details += `<slug>${currentMode}</slug>\n`
details += `<name>${modeDetails.name}</name>\n`