feat(skill-hub): add refresh parameter to bypass cache in remote skills endpoint

This commit is contained in:
catlog22
2026-02-24 16:20:03 +08:00
parent 6cae2dab12
commit 6cd24d03e6
3 changed files with 13 additions and 683 deletions

View File

@@ -226,7 +226,7 @@ function getCategoryName(category: TemplateCategory, formatMessage: ReturnType<t
export function HookQuickTemplates({
onInstallTemplate,
installedTemplates,
isLoading = false,
isLoading: _isLoading = false,
installingTemplateId = null
}: HookQuickTemplatesProps) {
const { formatMessage } = useIntl();

View File

@@ -893,6 +893,18 @@ export async function handleSkillHubRoutes(ctx: RouteContext): Promise<boolean>
// GET /api/skill-hub/remote
if (pathname === '/api/skill-hub/remote' && req.method === 'GET') {
try {
// Check for refresh parameter to bypass cache
const refresh = ctx.url.searchParams.get('refresh') === 'true';
if (refresh) {
// Clear memory cache
remoteSkillsCache = { data: null, timestamp: 0 };
// Clear file cache
const cachedPath = join(getSkillHubDir(), 'index.json');
if (existsSync(cachedPath)) {
rmSync(cachedPath, { force: true });
}
}
const index = await fetchRemoteSkillIndex();
res.writeHead(200, { 'Content-Type': 'application/json' });