mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-06-16 13:34:04 +08:00
Add skills.sh API integration allowing users to search and install from a catalog of 91K+ agent skills directly within CC Switch. The search results are converted to DiscoverableSkill objects and reuse the existing install pipeline. Includes fallback directory search for repos where skills are nested in subdirectories, and filters out non-GitHub sources.
17 lines
517 B
TypeScript
17 lines
517 B
TypeScript
import { useState, useEffect } from "react";
|
|
|
|
/**
|
|
* 返回一个延迟更新的值,在指定时间内无新变化后才更新。
|
|
* 用于搜索输入等场景,避免每次按键都触发请求。
|
|
*/
|
|
export function useDebouncedValue<T>(value: T, delay: number): T {
|
|
const [debouncedValue, setDebouncedValue] = useState<T>(value);
|
|
|
|
useEffect(() => {
|
|
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
return () => clearTimeout(timer);
|
|
}, [value, delay]);
|
|
|
|
return debouncedValue;
|
|
}
|