feat: 将记忆系统和知识库合并改造为长效向量记忆系统
- 移除知识库(KB/RAG)功能,删除 kb-modal.ts、rag.ts、memory-panel.ts - 新增 vector-memory.ts:记忆向量存储与检索引擎 - 新增 memory-modal.ts:大模态框布局的记忆管理面板 - 简化记忆分类为3类:fact(事实)、preference(偏好)、rule(规则) - 嵌入模型配置移至设置面板 - 无嵌入模型时自动降级为关键词搜索模式 - 向量搜索支持语义相似度检索 - 嵌入模型变化时自动重新索引所有记忆
This commit is contained in:
Vendored
+6
-15
@@ -92,12 +92,6 @@ export interface FileContent {
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface RagSource {
|
||||
filename: string;
|
||||
score: number;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
role: 'user' | 'assistant';
|
||||
content: string;
|
||||
@@ -109,7 +103,6 @@ export interface ChatMessage {
|
||||
images?: string[];
|
||||
files?: ChatFile[];
|
||||
_fileContents?: FileContent[];
|
||||
ragSources?: RagSource[];
|
||||
stopped?: boolean;
|
||||
toolCalls?: ToolCallRecord[];
|
||||
}
|
||||
@@ -125,7 +118,7 @@ export interface ChatSession {
|
||||
|
||||
// ── Agent 记忆系统类型 ──
|
||||
|
||||
export type MemoryType = 'fact' | 'preference' | 'rule' | 'episode';
|
||||
export type MemoryType = 'fact' | 'preference' | 'rule';
|
||||
|
||||
export interface MemoryEntry {
|
||||
id: string;
|
||||
@@ -135,6 +128,7 @@ export interface MemoryEntry {
|
||||
tags: string[]; // 用于快速匹配
|
||||
source?: string; // 来源描述(如会话标题)
|
||||
sessionId?: string; // 关联的会话 ID
|
||||
embedding?: number[]; // 向量嵌入
|
||||
createdAt: number;
|
||||
updatedAt: number;
|
||||
lastUsedAt: number; // 最后一次被回忆的时间
|
||||
@@ -154,7 +148,7 @@ export interface MemoryExtractionResult {
|
||||
}>;
|
||||
}
|
||||
|
||||
// ── 知识库类型 ──
|
||||
// ── 向量存储类型(用于记忆向量索引)──
|
||||
|
||||
export interface VectorCollection {
|
||||
id: string;
|
||||
@@ -181,11 +175,7 @@ export interface SearchResult extends VectorItem {
|
||||
score: number;
|
||||
}
|
||||
|
||||
export interface DocInfo {
|
||||
docId: string;
|
||||
filename: string;
|
||||
chunkCount: number;
|
||||
}
|
||||
|
||||
|
||||
// ── 桌面 Bridge 类型 ──
|
||||
|
||||
@@ -286,7 +276,8 @@ export type StateKey =
|
||||
| 'toolCallingEnabled'
|
||||
| 'runCommandEnabled'
|
||||
| 'memoryEnabled'
|
||||
| 'memoryEntries';
|
||||
| 'memoryEntries'
|
||||
| 'embeddingModel';
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// Tool Calling 类型
|
||||
|
||||
Reference in New Issue
Block a user