mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
feat(settings): rename autosave label to 'Autosave Chat as Markdown' and always generate AI titles on save (#2593)
This commit is contained in:
parent
23b5ca0054
commit
d9fbbd180c
6 changed files with 6 additions and 26 deletions
|
|
@ -977,7 +977,6 @@ export const DEFAULT_SETTINGS: CopilotSettings = {
|
|||
defaultSaveFolder: DEFAULT_CHAT_HISTORY_FOLDER,
|
||||
defaultConversationTag: "copilot-conversation",
|
||||
autosaveChat: true,
|
||||
generateAIChatTitleOnSave: true,
|
||||
autoAddActiveContentToContext: true,
|
||||
defaultOpenArea: DEFAULT_OPEN_AREA.VIEW,
|
||||
defaultSendShortcut: SEND_SHORTCUT.ENTER,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ jest.mock("@/settings/model", () => ({
|
|||
defaultSaveFolder: "test-folder",
|
||||
defaultConversationTag: "copilot-conversation",
|
||||
defaultConversationNoteName: "{$topic}@{$date}_{$time}",
|
||||
generateAIChatTitleOnSave: true,
|
||||
}),
|
||||
}));
|
||||
jest.mock("@/aiParams", () => ({
|
||||
|
|
|
|||
|
|
@ -818,9 +818,9 @@ ${chatContent}`;
|
|||
messages: ChatMessage[],
|
||||
existingTopic?: string
|
||||
): void {
|
||||
const settings = getSettings();
|
||||
|
||||
if (!settings.generateAIChatTitleOnSave || !file || existingTopic) {
|
||||
// AI title generation on save is always on for saved (legacy) chat notes;
|
||||
// skip only when there's no file or the note already carries a topic.
|
||||
if (!file || existingTopic) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1227,7 +1227,7 @@ export default class CopilotPlugin extends Plugin {
|
|||
async openChatSourceFile(fileId: string): Promise<void> {
|
||||
if (isNativeChatId(fileId)) {
|
||||
new Notice(
|
||||
"This chat has no saved note. Turn on Autosave Chat to save chats as notes in your vault."
|
||||
"This chat has no saved note. Turn on Autosave Chat as Markdown to save chats as notes in your vault."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,11 +88,6 @@ export interface CopilotSettings {
|
|||
defaultSaveFolder: string;
|
||||
defaultConversationTag: string;
|
||||
autosaveChat: boolean;
|
||||
/**
|
||||
* When enabled, generate a short AI title for chat notes on save.
|
||||
* When disabled (default), use the first 10 words of the first user message.
|
||||
*/
|
||||
generateAIChatTitleOnSave: boolean;
|
||||
autoAddActiveContentToContext: boolean;
|
||||
customPromptsFolder: string;
|
||||
indexVaultToVectorStore: string;
|
||||
|
|
@ -665,11 +660,6 @@ export function sanitizeSettings(settings: CopilotSettings): CopilotSettings {
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure generateAIChatTitleOnSave has a default value
|
||||
if (typeof sanitizedSettings.generateAIChatTitleOnSave !== "boolean") {
|
||||
sanitizedSettings.generateAIChatTitleOnSave = DEFAULT_SETTINGS.generateAIChatTitleOnSave;
|
||||
}
|
||||
|
||||
// Ensure enableMiyo has a default value
|
||||
if (typeof sanitizedSettings.enableMiyo !== "boolean") {
|
||||
sanitizedSettings.enableMiyo = DEFAULT_SETTINGS.enableMiyo;
|
||||
|
|
|
|||
|
|
@ -260,20 +260,12 @@ export const BasicSettings: React.FC = () => {
|
|||
<div className="tw-space-y-4">
|
||||
<SettingItem
|
||||
type="switch"
|
||||
title="Autosave Chat"
|
||||
description="Automatically saves the chat after every user message and AI response."
|
||||
title="Autosave Chat as Markdown"
|
||||
description="Writes each chat to a Markdown note in your vault after every user message and AI response. With this off, agent chats still appear in Recent Chats from session history; only the Markdown note is skipped."
|
||||
checked={settings.autosaveChat}
|
||||
onCheckedChange={(checked) => updateSetting("autosaveChat", checked)}
|
||||
/>
|
||||
|
||||
<SettingItem
|
||||
type="switch"
|
||||
title="Generate AI Chat Title on Save"
|
||||
description="When enabled, uses an AI model to generate a concise title for saved chat notes. When disabled, uses the first 10 words of the first user message."
|
||||
checked={settings.generateAIChatTitleOnSave}
|
||||
onCheckedChange={(checked) => updateSetting("generateAIChatTitleOnSave", checked)}
|
||||
/>
|
||||
|
||||
<SettingItem
|
||||
type="text"
|
||||
title="Default Conversation Folder Name"
|
||||
|
|
|
|||
Loading…
Reference in a new issue