fix system prompt file

This commit is contained in:
duanfuxiang 2025-04-29 12:08:26 +08:00
parent e0483d5d06
commit 16cd3a8691
2 changed files with 19 additions and 4 deletions

View File

@ -36,7 +36,7 @@ const CustomModeView = () => {
// 当前选择的模式
const [selectedMode, setSelectedMode] = useState<string>('ask')
const [isBuiltinMode, setIsBuiltinMode] = useState<boolean>(true)
const [isAdvancedCollapsed, setIsAdvancedCollapsed] = useState(true);
const [isAdvancedCollapsed, setIsAdvancedCollapsed] = useState(false);
const isNewMode = React.useMemo(() => selectedMode === "add_new_mode", [selectedMode])
@ -220,6 +220,11 @@ const CustomModeView = () => {
</button>
)}
</div>
{
isBuiltinMode && (
<p className="infio-section-subtitle"></p>
)
}
<input
type="text"
value={modeName}
@ -263,16 +268,23 @@ const CustomModeView = () => {
<div className="infio-custom-modes-section">
<div className="infio-section-header">
<h3></h3>
{/* {!isBuiltinMode && (
<button className="infio-section-btn">
<Undo2 size={16} />
</button>
</button>
)} */}
</div>
<p className="infio-section-subtitle"></p>
{
isBuiltinMode && (
<p className="infio-section-subtitle"></p>
)
}
<div className="infio-tools-list">
<div className="infio-tool-item">
<label>
<input
type="checkbox"
disabled={isBuiltinMode}
checked={selectedTools.includes('read')}
onChange={() => handleToolChange('read')}
/>
@ -283,6 +295,7 @@ const CustomModeView = () => {
<label>
<input
type="checkbox"
disabled={isBuiltinMode}
checked={selectedTools.includes('edit')}
onChange={() => handleToolChange('edit')}
/>
@ -293,6 +306,7 @@ const CustomModeView = () => {
<label>
<input
type="checkbox"
disabled={isBuiltinMode}
checked={selectedTools.includes('research')}
onChange={() => handleToolChange('research')}
/>
@ -339,7 +353,7 @@ const CustomModeView = () => {
<>
<p className="infio-section-subtitle">
<a href="#" className="infio-link" onClick={() => openOrCreateMarkdownFile(app, `_infio_prompts/${modeName}/system-prompt.md`, 0)}>_infio_prompts/{modeName}/system-prompt</a>
<a href="#" className="infio-link" onClick={() => openOrCreateMarkdownFile(app, `_infio_prompts/${modeName}/system_prompt.md`, 0)}>_infio_prompts/{modeName}/system_prompt</a>
使, <button
className="infio-preview-btn"
onClick={async () => {

View File

@ -58,6 +58,7 @@ export class SystemPrompt {
private async loadSystemPromptFile(mode: Mode): Promise<string> {
const fileName = this.getSystemPromptFilePath(mode)
const filePath = normalizePath(path.join(this.dataDir, fileName))
console.log("filePath", filePath)
if (!(await this.app.vault.adapter.exists(filePath))) {
return ""
}