UNPKG

create-ai-chat-context-experimental

Version:

Phase 2: TypeScript rewrite - AI Chat Context & Memory System with conversation extraction and AICF format support (powered by aicf-core v2.1.0).

47 lines 1.26 kB
/** * This file is part of create-ai-chat-context-experimental. * Licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). * See LICENSE file for details. */ /** * Validate content is not empty */ export function isValidContent(content) { if (typeof content === 'string') { return content.trim().length > 0; } return false; } /** * Validate message structure */ export function isValidMessage(msg) { if (typeof msg !== 'object' || msg === null) { return false; } const m = msg; return (typeof m['id'] === 'string' && typeof m['conversationId'] === 'string' && typeof m['timestamp'] === 'string' && (m['role'] === 'user' || m['role'] === 'assistant') && typeof m['content'] === 'string'); } /** * Validate array is not empty */ export function isValidArray(arr) { return Array.isArray(arr) && arr.length > 0; } /** * Validate object structure */ export function isValidObject(obj) { return typeof obj === 'object' && obj !== null && !Array.isArray(obj); } /** * Validate string is not empty */ export function isValidString(str) { return typeof str === 'string' && str.trim().length > 0; } //# sourceMappingURL=ValidationUtils.js.map