-
Notifications
You must be signed in to change notification settings - Fork 625
feat: implement separated system and custom prompt management #868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RENDERER_MODEL_META, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MCPServerConfig, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Prompt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SystemPrompt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IModelConfig, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BuiltinKnowledgeConfig | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@shared/presenter' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -90,6 +91,7 @@ export class ConfigPresenter implements IConfigPresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private store: ElectronStore<IAppSettings> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private providersModelStores: Map<string, ElectronStore<IModelStore>> = new Map() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private customPromptsStore: ElectronStore<{ prompts: Prompt[] }> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private systemPromptsStore: ElectronStore<{ prompts: SystemPrompt[] }> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private userDataPath: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private currentAppVersion: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private mcpConfHelper: McpConfHelper // 使用MCP配置助手 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -138,6 +140,22 @@ export class ConfigPresenter implements IConfigPresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.systemPromptsStore = new ElectronStore<{ prompts: SystemPrompt[] }>({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'system_prompts', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| defaults: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompts: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: 'default', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'DeepChat', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| content: DEFAULT_SYSTEM_PROMPT, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isDefault: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| createdAt: Date.now(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updatedAt: Date.now() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 初始化MCP配置助手 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.mcpConfHelper = new McpConfHelper() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -276,11 +294,43 @@ export class ConfigPresenter implements IConfigPresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 0.3.4 版本之前,如果默认系统提示词为空,则设置为内置的默认提示词 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (oldVersion && compare(oldVersion, '0.3.4', '<')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const currentPrompt = this.getSetting<string>('default_system_prompt') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!currentPrompt || currentPrompt.trim() === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.setSetting('default_system_prompt', DEFAULT_SYSTEM_PROMPT) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 0.3.5 版本之前,处理默认系统提示词的迁移和设置 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (oldVersion && compare(oldVersion, '0.3.5', '<')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const currentPrompt = this.getSetting<string>('default_system_prompt') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!currentPrompt || currentPrompt.trim() === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.setSetting('default_system_prompt', DEFAULT_SYSTEM_PROMPT) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const legacyDefault = this.getSetting<string>('default_system_prompt') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| typeof legacyDefault === 'string' && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| legacyDefault.trim() && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| legacyDefault.trim() !== DEFAULT_SYSTEM_PROMPT.trim() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompts = (this.systemPromptsStore.get('prompts') || []) as SystemPrompt[] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const now = Date.now() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const idx = prompts.findIndex((p) => p.id === 'default') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (idx !== -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompts[idx] = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...prompts[idx], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| content: legacyDefault, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isDefault: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updatedAt: now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompts.push({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: 'default', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: 'DeepChat', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| content: legacyDefault, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isDefault: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| createdAt: now, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updatedAt: now | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.systemPromptsStore.set('prompts', prompts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.warn('Failed to migrate legacy default_system_prompt:', e) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1181,6 +1231,11 @@ export class ConfigPresenter implements IConfigPresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 获取默认系统提示词 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async getDefaultSystemPrompt(): Promise<string> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompts = await this.getSystemPrompts() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const defaultPrompt = prompts.find((p) => p.isDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (defaultPrompt) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return defaultPrompt.content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this.getSetting<string>('default_system_prompt') || '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1199,6 +1254,55 @@ export class ConfigPresenter implements IConfigPresenter { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.setSetting('default_system_prompt', '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async getSystemPrompts(): Promise<SystemPrompt[]> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this.systemPromptsStore.get('prompts') || [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async setSystemPrompts(prompts: SystemPrompt[]): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.systemPromptsStore.set('prompts', prompts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async addSystemPrompt(prompt: SystemPrompt): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompts = await this.getSystemPrompts() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompts.push(prompt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.setSystemPrompts(prompts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async updateSystemPrompt(promptId: string, updates: Partial<SystemPrompt>): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompts = await this.getSystemPrompts() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const index = prompts.findIndex((p) => p.id === promptId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (index !== -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompts[index] = { ...prompts[index], ...updates } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.setSystemPrompts(prompts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async deleteSystemPrompt(promptId: string): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompts = await this.getSystemPrompts() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const filteredPrompts = prompts.filter((p) => p.id !== promptId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.setSystemPrompts(filteredPrompts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1284
to
+1288
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Guard against deleting the built-in default prompt Prevent removal of id 'default' to keep the system consistent. async deleteSystemPrompt(promptId: string): Promise<void> {
+ if (promptId === 'default') {
+ throw new Error('Cannot delete the built-in default system prompt')
+ }
const prompts = await this.getSystemPrompts()
const filteredPrompts = prompts.filter((p) => p.id !== promptId)
await this.setSystemPrompts(filteredPrompts)
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async setDefaultSystemPromptId(promptId: string): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompts = await this.getSystemPrompts() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const updatedPrompts = prompts.map((p) => ({ ...p, isDefault: false })) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const targetIndex = updatedPrompts.findIndex((p) => p.id === promptId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (targetIndex !== -1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updatedPrompts[targetIndex].isDefault = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.setSystemPrompts(updatedPrompts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1291
to
+1298
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Ensure there is always exactly one default; handle unknown IDs gracefully If promptId isn’t found, keep current default or fall back to 'default' (creating it if missing). This prevents state with no default. async setDefaultSystemPromptId(promptId: string): Promise<void> {
const prompts = await this.getSystemPrompts()
- const updatedPrompts = prompts.map((p) => ({ ...p, isDefault: false }))
- const targetIndex = updatedPrompts.findIndex((p) => p.id === promptId)
- if (targetIndex !== -1) {
- updatedPrompts[targetIndex].isDefault = true
- await this.setSystemPrompts(updatedPrompts)
- }
+ let updatedPrompts = prompts.map((p) => ({ ...p, isDefault: false }))
+ const targetIndex = updatedPrompts.findIndex((p) => p.id === promptId)
+ if (targetIndex !== -1) {
+ updatedPrompts[targetIndex].isDefault = true
+ } else {
+ // Fallback to built-in default
+ const defaultIdx = updatedPrompts.findIndex((p) => p.id === 'default')
+ if (defaultIdx !== -1) {
+ updatedPrompts[defaultIdx].isDefault = true
+ } else {
+ // Recreate default if somehow missing
+ const now = Date.now()
+ updatedPrompts.push({
+ id: 'default',
+ name: 'DeepChat',
+ content: DEFAULT_SYSTEM_PROMPT,
+ isDefault: true,
+ createdAt: now,
+ updatedAt: now
+ })
+ }
+ }
+ await this.setSystemPrompts(updatedPrompts)
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async getDefaultSystemPromptId(): Promise<string> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompts = await this.getSystemPrompts() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const defaultPrompt = prompts.find((p) => p.isDefault) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return defaultPrompt?.id || 'default' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // 获取更新渠道 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getUpdateChannel(): string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this.getSetting<string>('updateChannel') || 'stable' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrate legacy default_system_prompt into the new system_prompts store
Without migration, existing users’ customized default prompt is ignored after upgrade (getDefaultSystemPrompt now prefers systemPrompts). Migrate on startup.
this.systemPromptsStore = new ElectronStore<{ prompts: SystemPrompt[] }>({ name: 'system_prompts', defaults: { prompts: [ { id: 'default', name: 'DeepChat', content: DEFAULT_SYSTEM_PROMPT, isDefault: true, createdAt: Date.now(), updatedAt: Date.now() } ] } }) + + // Migrate legacy default_system_prompt into system_prompts (one-time) + try { + const legacyDefault = this.store.get('default_system_prompt') + if ( + typeof legacyDefault === 'string' && + legacyDefault.trim() && + legacyDefault.trim() !== DEFAULT_SYSTEM_PROMPT.trim() + ) { + const prompts = (this.systemPromptsStore.get('prompts') || []) as SystemPrompt[] + const now = Date.now() + const idx = prompts.findIndex((p) => p.id === 'default') + if (idx !== -1) { + prompts[idx] = { + ...prompts[idx], + content: legacyDefault, + isDefault: true, + updatedAt: now + } + } else { + prompts.push({ + id: 'default', + name: 'DeepChat', + content: legacyDefault, + isDefault: true, + createdAt: now, + updatedAt: now + }) + } + this.systemPromptsStore.set('prompts', prompts) + } + } catch (e) { + console.warn('Failed to migrate legacy default_system_prompt:', e) + }📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should migration user's system prompt setting with
migrateConfigDataThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zerob13 You're absolutely correct! The migration should be handled in the existing
migrateConfigDatamethod for proper version-based migration control.Looking at the code, I can see that this migration is already properly implemented in the
migrateConfigDatamethod at lines 320-354 for version 0.3.5:The migration is correctly placed in
migrateConfigDatawhere it belongs, following the established pattern of version-based migrations. My previous suggestion to add migration code in the constructor was incorrect. Thank you for the clarification!🧠 Learnings used