feat: Enhance Marketplace and Skill Management UI with improved error handling and user feedback
- Updated MarketplaceDrawer to include security notes and manual installation hints. - Refactored SkillDetailDrawer to display default icons for skills. - Simplified SkillListItem to use default icons for better readability. - Integrated gateway status checks and warnings in SkillsPage for improved user awareness. - Enhanced error handling for skill installation and fetching, providing clearer feedback to users. - Added new translations for error messages and gateway warnings to improve localization support.
This commit is contained in:
45
electron/gateway/handlers/skills.ts
Normal file
45
electron/gateway/handlers/skills.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { getAllSkillConfigs, updateSkillConfig } from '@electron/utils/skill-config';
|
||||
import type { GatewayRpcReturns } from '../types';
|
||||
|
||||
export async function handleSkillsStatus(): Promise<GatewayRpcReturns['skills.status']> {
|
||||
const configs = await getAllSkillConfigs();
|
||||
|
||||
return {
|
||||
skills: Object.entries(configs).map(([skillKey, config]) => ({
|
||||
skillKey,
|
||||
slug: config.slug || skillKey,
|
||||
name: config.name || skillKey,
|
||||
description: config.description || '',
|
||||
disabled: config.enabled === false,
|
||||
emoji: config.icon,
|
||||
version: config.version || '1.0.0',
|
||||
author: config.author,
|
||||
config: {
|
||||
...(config.config || {}),
|
||||
...(config.apiKey ? { apiKey: config.apiKey } : {}),
|
||||
...(config.env ? { env: config.env } : {}),
|
||||
},
|
||||
bundled: typeof config.isBundled === 'boolean' ? config.isBundled : config.source === 'openclaw-bundled',
|
||||
always: Boolean(config.isCore),
|
||||
source: config.source,
|
||||
baseDir: config.baseDir,
|
||||
filePath: config.filePath,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
export async function handleSkillsUpdate(
|
||||
params: { skillKey: string; enabled?: boolean },
|
||||
): Promise<GatewayRpcReturns['skills.update']> {
|
||||
const { skillKey, enabled } = params;
|
||||
if (!skillKey || !String(skillKey).trim()) {
|
||||
throw new Error('skillKey is required');
|
||||
}
|
||||
|
||||
const result = await updateSkillConfig(String(skillKey).trim(), { enabled });
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to update skill');
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
Reference in New Issue
Block a user