koishi-plugin-satori-ai
Version:
基于 Satori 适配器的智能对话插件,具备用户画像、长期记忆、常识管理和好感度系统
35 lines (34 loc) • 1.39 kB
TypeScript
import { Session, Context } from 'koishi';
import { MemoryEntry, MemoryConfig } from './types';
export declare class MemoryManager {
private ctx;
private config;
private channelMemories;
private channelDialogues;
private charactersToRemove;
private MAX_MEMORY_LENGTH;
constructor(ctx: Context, config: MemoryConfig);
updateMemories(session: Session, prompt: string, config: MemoryConfig, response: {
content: string;
error: boolean;
}): Promise<void>;
private shouldRemember;
updateChannelDialogue(session: Session, prompt: string, name: string): Promise<string>;
getChannelDialogue(session: Session): Promise<string>;
private bracketFilter;
private memoryFilter;
private updateChannelMemory;
clearChannelMemory(channelId: string): void;
clearChannelDialogue(channelId: string): void;
clearAllMemories(): void;
getChannelMemory(channelId: string): MemoryEntry[];
saveLongTermMemory(session: Session, dialogues: MemoryEntry[], filePath?: string): Promise<void>;
searchMemories(session: Session, type?: 'user' | 'common' | 'group'): Promise<string>;
private findBestMatches;
private calculateMatchScore;
private formatMatches;
private getUserMemoryPath;
private ensureMemoryFile;
private loadMemoryFile;
getChannelContext(channelId: string): MemoryEntry[];
}