mirror of
https://github.com/fbarrca/obsidian-inlineAI.git
synced 2026-07-22 11:50:24 +00:00
Actually add the prompts to the model
This commit is contained in:
parent
102d179b99
commit
75da491f42
2 changed files with 14 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import { InlineAISettings } from "./settings";
|
|||
import { App, MarkdownView, Notice } from "obsidian";
|
||||
import { EditorView } from "@codemirror/view";
|
||||
import { setGeneratedResponseEffect } from "./modules/AIExtension";
|
||||
import { parseCommand } from "./modules/commands/parser";
|
||||
|
||||
/**
|
||||
* Class to manage interactions with different chat APIs.
|
||||
|
|
@ -164,7 +165,7 @@ export class ChatApiManager {
|
|||
**Output:**`;
|
||||
}
|
||||
|
||||
return this.handleEditorUpdate(systemPrompt, userPrompt);
|
||||
return this.handleEditorUpdate(systemPrompt, parseCommand(userPrompt, this.settings.commandPrefix, this.settings.customCommands));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
12
src/modules/commands/parser.ts
Normal file
12
src/modules/commands/parser.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { SlashCommand } from "./source";
|
||||
|
||||
|
||||
export function parseCommand(userInput: string, prefix: string, customCommands: SlashCommand[]): string {
|
||||
for (const command of customCommands) {
|
||||
const commandPattern = `${prefix}${command.keyword}`;
|
||||
if (userInput.startsWith(commandPattern)) {
|
||||
return userInput.replace(commandPattern, command.prompt).trim();
|
||||
}
|
||||
}
|
||||
return userInput; // Return original text if no command matches
|
||||
}
|
||||
Loading…
Reference in a new issue