Keep/keep-notes/lib/utils.ts
sepehr 3c4b9d6176 feat(ai): implement intelligent auto-tagging system
- Added multi-provider AI infrastructure (OpenAI/Ollama)
- Implemented real-time tag suggestions with debounced analysis
- Created AI diagnostics and database maintenance tools in Settings
- Added automated garbage collection for orphan labels
- Refined UX with deterministic color hashing and interactive ghost tags
2026-01-08 22:59:52 +01:00

22 lines
663 B
TypeScript

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
import { LABEL_COLORS, LabelColorName } from "./types"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function getHashColor(name: string): LabelColorName {
let hash = 0;
for (let i = 0; i < name.length; i++) {
hash = name.charCodeAt(i) + ((hash << 5) - hash);
}
const colors = Object.keys(LABEL_COLORS) as LabelColorName[];
// Skip 'gray' for colorful tags
const colorfulColors = colors.filter(c => c !== 'gray');
const colorIndex = Math.abs(hash) % colorfulColors.length;
return colorfulColors[colorIndex];
}