@multiface.js/context
Version:
Context awareness and memory management for multimodal interactions
47 lines (46 loc) • 2.1 kB
TypeScript
import { ContextConfig, ContextualData, UserProfile, ConversationMemory, ContextualIntent, ContextState } from '../types';
export interface UseContextOptions {
config?: ContextConfig;
autoStart?: boolean;
enableFusion?: boolean;
enableSensorIntegration?: boolean;
onFusedOutput?: (fusedInput: any) => void;
}
export declare const useContext: (options?: UseContextOptions) => {
contextState: ContextState;
lastIntent: ContextualIntent | null;
addMessage: (content: string, type?: "text" | "voice" | "gesture" | "image") => void;
detectIntent: (input: string) => ContextualIntent | null;
updateSpatialContext: (location?: {
latitude: number;
longitude: number;
}, environment?: string) => void;
updateDeviceContext: (deviceInfo: Partial<ContextualData["device"]>) => void;
updateUserActivity: (activityLevel: "stationary" | "walking" | "running" | "driving") => void;
getRelevantMemories: (query: string, limit?: number) => ConversationMemory[];
getCurrentContext: () => ContextualData;
getUserProfile: () => UserProfile;
isInitialized: boolean;
};
export declare const useConversationMemory: (maxMemories?: number) => {
conversationHistory: ConversationMemory[];
activeMemories: ConversationMemory[];
addConversation: (userMessage: string, assistantResponse: string) => void;
searchMemories: (query: string) => ConversationMemory[];
};
export declare const useIntentDetection: (onIntentDetected?: (intent: ContextualIntent) => void) => {
lastIntent: ContextualIntent | null;
analyzeInput: (input: string) => ContextualIntent | null;
getContextualSuggestions: () => string[];
};
export declare const usePersonalization: () => {
userProfile: UserProfile;
getPersonalizedResponse: (baseResponse: string) => string;
updatePreferences: (preferences: Partial<UserProfile["preferences"]>) => void;
usageStats: {
totalInteractions: number;
preferredInputTypes: Record<string, number>;
commonCommands: string[];
lastActiveTime: number;
};
};