feat(prompts+i18n): add prompt management and improve prompt editor i18n (#193)

* feat(prompts): add prompt management across Tauri service and React UI

- backend: add commands/prompt.rs, services/prompt.rs, register in commands/mod.rs and lib.rs, refine app_config.rs
- frontend: add PromptPanel, PromptFormModal, PromptListItem, MarkdownEditor, usePromptActions, integrate in App.tsx
- api: add src/lib/api/prompts.ts
- i18n: update src/i18n/locales/{en,zh}.json
- build: update package.json and pnpm-lock.yaml

* feat(i18n): improve i18n for prompts and Markdown editor

- update src/i18n/locales/{en,zh}.json keys and strings
- apply i18n in PromptFormModal, PromptPanel, and MarkdownEditor
- align prompt text with src-tauri/src/services/prompt.rs

* feat(prompts): add enable/disable toggle and simplify panel UI

- Add PromptToggle component and integrate in prompt list items
- Implement toggleEnabled with optimistic update; enable via API, disable via upsert with enabled=false;
  reload after success
- Simplify PromptPanel: remove file import and current-file preview to keep CRUD flow focused
- Tweak header controls style (use mcp variant) and minor copy: rename “Prompt Management” to “Prompts”
- i18n: add disableSuccess/disableFailed messages
- Backend (Tauri): prevent duplicate backups when importing original prompt content

* style: unify code formatting with trailing commas

* feat(prompts): add Gemini filename support to PromptFormModal

Update filename mapping to use Record<AppId, string> pattern, supporting
GEMINI.md alongside CLAUDE.md and AGENTS.md.

* fix(prompts): sync enabled prompt to file when updating

When updating a prompt that is currently enabled, automatically sync
the updated content to the corresponding live file (CLAUDE.md/AGENTS.md/GEMINI.md).

This ensures the active prompt file always reflects the latest content
when editing enabled prompts.
This commit is contained in:
YoVinchen
2025-11-12 16:41:41 +08:00
committed by GitHub
parent 346f916048
commit 155532ea8c
20 changed files with 1302 additions and 1 deletions

View File

@@ -550,5 +550,46 @@
"description": "Context7 文档搜索工具,提供最新的库文档和代码示例,配置 key 会有更高限额"
}
}
},
"prompts": {
"manage": "提示词",
"title": "{{appName}} 提示词管理",
"claudeTitle": "Claude 提示词管理",
"codexTitle": "Codex 提示词管理",
"add": "添加提示词",
"edit": "编辑提示词",
"addTitle": "添加 {{appName}} 提示词",
"editTitle": "编辑 {{appName}} 提示词",
"import": "导入现有",
"count": "共 {{count}} 个提示词",
"enabled": "已启用",
"enable": "启用",
"enabledName": "已启用: {{name}}",
"noneEnabled": "未启用任何提示词",
"currentFile": "当前 {{filename}} 内容",
"empty": "暂无提示词",
"emptyDescription": "点击右上角按钮添加或导入提示词",
"loading": "加载中...",
"name": "名称",
"namePlaceholder": "例如:项目默认提示词",
"description": "描述",
"descriptionPlaceholder": "可选的描述信息",
"content": "内容",
"contentPlaceholder": "# {{filename}}\n\n在此输入提示词内容...",
"loadFailed": "加载提示词失败",
"saveSuccess": "保存成功",
"saveFailed": "保存失败",
"deleteSuccess": "删除成功",
"deleteFailed": "删除失败",
"enableSuccess": "启用成功",
"enableFailed": "启用失败",
"disableSuccess": "禁用成功",
"disableFailed": "禁用失败",
"importSuccess": "导入成功",
"importFailed": "导入失败",
"confirm": {
"deleteTitle": "确认删除",
"deleteMessage": "确定要删除提示词 \"{{name}}\" 吗?"
}
}
}