Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/apps/desktop/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub mod lsp_workspace_api;
pub mod mcp_api;
pub mod miniapp_api;
pub mod project_context_api;
pub mod prompt_template_api;
pub mod remote_connect_api;
pub mod runtime_api;
pub mod session_api;
Expand Down
127 changes: 0 additions & 127 deletions src/apps/desktop/src/api/prompt_template_api.rs

This file was deleted.

5 changes: 0 additions & 5 deletions src/apps/desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,6 @@ pub async fn run() {
create_cron_job,
update_cron_job,
delete_cron_job,
api::prompt_template_api::get_prompt_template_config,
api::prompt_template_api::save_prompt_template_config,
api::prompt_template_api::export_prompt_templates,
api::prompt_template_api::import_prompt_templates,
api::prompt_template_api::reset_prompt_templates,
api::config_api::sync_tool_configs,
api::terminal_api::terminal_get_shells,
api::terminal_api::terminal_create,
Expand Down
2 changes: 0 additions & 2 deletions src/crates/core/src/service/config/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub struct GlobalConfig {
pub terminal: TerminalConfig,
pub workspace: WorkspaceConfig,
pub ai: AIConfig,
pub prompt_templates: Option<serde_json::Value>,
/// MCP server configuration (stored uniformly; supports both JSON and structured formats).
#[serde(skip_serializing_if = "Option::is_none")]
pub mcp_servers: Option<serde_json::Value>,
Expand Down Expand Up @@ -897,7 +896,6 @@ impl Default for GlobalConfig {
terminal: TerminalConfig::default(),
workspace: WorkspaceConfig::default(),
ai: AIConfig::default(),
prompt_templates: None,
mcp_servers: None,
themes: Some(ThemesConfig::default()),
version: "1.0.0".to_string(),
Expand Down
43 changes: 4 additions & 39 deletions src/web-ui/src/app/scenes/profile/views/PersonaView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import {
} from '@/component-library';
import { AIRulesAPI, RuleLevel, type AIRule } from '@/infrastructure/api/service-api/AIRulesAPI';
import { getAllMemories, toggleMemory, type AIMemory } from '@/infrastructure/api/aiMemoryApi';
import { promptTemplateService } from '@/infrastructure/services/PromptTemplateService';
import type { PromptTemplate } from '@/shared/types/prompt-template';
import { MCPAPI, type MCPServerInfo } from '@/infrastructure/api/service-api/MCPAPI';
import { configAPI } from '@/infrastructure/api/service-api/ConfigAPI';
import { configManager } from '@/infrastructure/config/services/ConfigManager';
Expand Down Expand Up @@ -323,7 +321,6 @@ const PersonaView: React.FC<{ workspacePath: string }> = ({ workspacePath }) =>
const [agenticConfig, setAgenticConfig] = useState<ModeConfigItem | null>(null);
const [mcpServers, setMcpServers] = useState<MCPServerInfo[]>([]);
const [skills, setSkills] = useState<SkillInfo[]>([]);
const [templates, setTemplates] = useState<PromptTemplate[]>([]);
const [aiExp, setAiExp] = useState<Partial<AIExperienceConfig>>({
enable_visual_mode: false,
enable_session_title_generation: true,
Expand Down Expand Up @@ -358,7 +355,6 @@ const PersonaView: React.FC<{ workspacePath: string }> = ({ workspacePath }) =>
const memoryRef = useRef<HTMLDivElement>(null);
const toolsRef = useRef<HTMLDivElement>(null);
const skillsRef = useRef<HTMLDivElement>(null);
const templatesRef = useRef<HTMLDivElement>(null);
const prefsRef = useRef<HTMLDivElement>(null);

// detail section ref (kept for internal scroll-to section)
Expand Down Expand Up @@ -388,16 +384,6 @@ const PersonaView: React.FC<{ workspacePath: string }> = ({ workspacePath }) =>
})();
}, [workspacePath]);

useEffect(() => {
const init = async () => {
try { await promptTemplateService.initialize(); } finally {
setTemplates(promptTemplateService.getAllTemplates());
}
};
init();
return promptTemplateService.subscribe(() => setTemplates(promptTemplateService.getAllTemplates()));
}, []);

const loadCaps = useCallback(async () => {
try {
const { invoke } = await import('@tauri-apps/api/core');
Expand Down Expand Up @@ -539,7 +525,7 @@ const PersonaView: React.FC<{ workspacePath: string }> = ({ workspacePath }) =>
[t('radar.dims.memory')]: memoryRef,
[t('radar.dims.autonomy')]: toolsRef,
[t('radar.dims.adaptability')]: skillsRef,
[t('radar.dims.creativity')]: templatesRef,
[t('radar.dims.creativity')]: prefsRef,
[t('radar.dims.expression')]: prefsRef,
};
if (zone) setActiveZone(zone);
Expand Down Expand Up @@ -868,9 +854,6 @@ const PersonaView: React.FC<{ workspacePath: string }> = ({ workspacePath }) =>
const sortSkills = useMemo(() =>
[...skills].sort((a, b) => a.enabled !== b.enabled ? (a.enabled ? -1 : 1) : a.name.localeCompare(b.name)),
[skills]);
const sortTemplates = useMemo(() =>
[...templates].sort((a, b) => a.isFavorite !== b.isFavorite ? (a.isFavorite ? -1 : 1) : b.usageCount - a.usageCount),
[templates]);
const userRulesList = useMemo(
() => sortRules.filter(rule => rule.level === RuleLevel.User),
[sortRules],
Expand Down Expand Up @@ -908,17 +891,16 @@ const PersonaView: React.FC<{ workspacePath: string }> = ({ workspacePath }) =>
const memEn = useMemo(() => memories.filter(m => m.enabled).length, [memories]);
const rulesEn = useMemo(() => rules.filter(r => r.enabled), [rules]);
const avgImp = useMemo(() => memEn > 0 ? memories.filter(m => m.enabled).reduce((s, m) => s + m.importance, 0) / memEn : 0, [memories, memEn]);
const favCount = useMemo(() => templates.filter(t => t.isFavorite).length, [templates]);
const radarDims = useMemo(() => [
{ label: t('radar.dims.creativity'), value: Math.min(10, templates.length * 0.6 + skillEn.length * 0.5) },
{ label: t('radar.dims.creativity'), value: Math.min(10, skillEn.length * 0.9 + mcpServers.length * 0.35) },
{ label: t('radar.dims.rigor'), value: Math.min(10, rulesEn.length * 1.5) },
{ label: t('radar.dims.autonomy'), value: agenticConfig?.enabled
? Math.min(10, 4 + (agenticConfig.available_tools?.length ?? 0) * 0.25 + mcpServers.length * 0.5)
: Math.min(10, enabledTools * 0.3 + healthyMcp * 0.8) },
{ label: t('radar.dims.memory'), value: Math.min(10, memEn * 0.7 + avgImp * 0.3) },
{ label: t('radar.dims.expression'), value: Math.min(10, templates.length * 0.5 + favCount * 1.2) },
{ label: t('radar.dims.expression'), value: Math.min(10, skillEn.length * 0.8 + enabledSkls * 0.4) },
{ label: t('radar.dims.adaptability'), value: Math.min(10, skillEn.length * 1.2 + mcpServers.length * 0.8) },
], [templates, skillEn, rulesEn, agenticConfig, mcpServers, enabledTools, healthyMcp, memEn, avgImp, favCount, t]);
], [skillEn, rulesEn, agenticConfig, mcpServers, enabledTools, healthyMcp, memEn, avgImp, enabledSkls, t]);

// model slot current IDs (with fallbacks)
const slotIds: Record<ModelSlotKey, string> = useMemo(() => ({
Expand Down Expand Up @@ -1372,23 +1354,6 @@ const PersonaView: React.FC<{ workspacePath: string }> = ({ workspacePath }) =>
{/* Interaction */}
<div className={`${C}-zone-panel ${activeZone === 'interaction' ? 'is-active' : ''}`} ref={interactionPanelRef}>
<div className={`${C}-zone-inner`}>
<div ref={templatesRef} className={`${C}-card`}>
<div className={`${C}-card__head`}>
<span className={`${C}-card__label`}>{t('cards.templates')}</span>
<span className={`${C}-card__kpi`}>{t('kpi.templateCount', { count: templates.length })}</span>
<button type="button" className={`${C}-link`} onClick={() => navToSettings('prompt-templates')}>
{t('actions.manage')} <ChevronRight size={11} />
</button>
</div>
<div className={`${C}-chip-row`}>
{sortTemplates.slice(0, 14).map(tmpl => (
<span key={tmpl.id} className={`${C}-tpl-chip ${tmpl.isFavorite ? 'is-fav' : ''}`}>
{tmpl.isFavorite && '★ '}{tmpl.name}
</span>
))}
{templates.length === 0 && <span className={`${C}-empty-hint`}>{t('empty.templates')}</span>}
</div>
</div>
<div ref={prefsRef} className={`${C}-card`}>
<div className={`${C}-card__head`}>
<span className={`${C}-card__label`}>{t('cards.preferences')}</span>
Expand Down
3 changes: 0 additions & 3 deletions src/web-ui/src/app/scenes/settings/SettingsScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const LoggingConfig = lazy(() => import('../../../infrastructure/config/c
const TerminalConfig = lazy(() => import('../../../infrastructure/config/components/TerminalConfig'));
const EditorConfig = lazy(() => import('../../../infrastructure/config/components/EditorConfig'));
const ThemeConfigComponent = lazy(() => import('../../../infrastructure/config/components/ThemeConfig').then(m => ({ default: m.ThemeConfig })));
const PromptTemplateConfig = lazy(() => import('../../../infrastructure/config/components/PromptTemplateConfig'));

const SettingsScene: React.FC = () => {
const activeTab = useSettingsStore(s => s.activeTab);

Expand All @@ -32,7 +30,6 @@ const SettingsScene: React.FC = () => {
case 'models': Content = AIModelConfig; break;
case 'session-config': Content = SessionConfig; break;
case 'ai-context': Content = AIRulesMemoryConfig; break;
case 'prompt-templates': Content = PromptTemplateConfig; break;
case 'mcp-tools': Content = McpToolsConfig; break;
case 'lsp': Content = LspConfig; break;
case 'debug': Content = DebugConfig; break;
Expand Down
2 changes: 0 additions & 2 deletions src/web-ui/src/app/scenes/settings/settingsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type ConfigTab =
| 'models'
| 'session-config'
| 'ai-context'
| 'prompt-templates'
| 'mcp-tools'
| 'lsp'
| 'debug'
Expand Down Expand Up @@ -43,7 +42,6 @@ export const SETTINGS_CATEGORIES: ConfigCategoryDef[] = [
nameKey: 'configCenter.categories.smartCapabilities',
tabs: [
{ id: 'session-config', labelKey: 'configCenter.tabs.sessionConfig' },
{ id: 'prompt-templates', labelKey: 'configCenter.tabs.promptTemplates' },
{ id: 'ai-context', labelKey: 'configCenter.tabs.aiContext' },
{ id: 'mcp-tools', labelKey: 'configCenter.tabs.mcpTools' },
],
Expand Down
Loading
Loading