feat(autocomplete): add setting to replace underscores with spaces in tag names

fixes #784
This commit is contained in:
Will Miao
2026-01-27 13:01:03 +08:00
parent 5d9f64e43b
commit d17808d9e5
2 changed files with 46 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
import { api } from "../../scripts/api.js";
import { app } from "../../scripts/app.js";
import { TextAreaCaretHelper } from "./textarea_caret_helper.js";
import { getPromptTagAutocompletePreference } from "./settings.js";
import { getPromptTagAutocompletePreference, getTagSpaceReplacementPreference } from "./settings.js";
// Command definitions for category filtering
const TAG_COMMANDS = {
@@ -231,7 +231,13 @@ const MODEL_BEHAVIORS = {
const folder = directories.length ? `${directories.join('/')}/` : '';
return `embedding:${folder}${trimmedName}, `;
} else {
return `${relativePath}, `;
let tagText = relativePath;
if (getTagSpaceReplacementPreference()) {
tagText = tagText.replace(/_/g, ' ');
}
return `${tagText}, `;
}
},
},