@kitn.ai/ui
Version:
Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.
10 lines (8 loc) • 397 B
text/typescript
/** Append a suggestion; no-op when already present. Returns a new array. */
export function addSuggestion(suggestions: string[], s: string): string[] {
return suggestions.includes(s) ? suggestions.slice() : [...suggestions, s];
}
/** Remove a suggestion by value. */
export function removeSuggestion(suggestions: string[], s: string): string[] {
return suggestions.filter((x) => x !== s);
}