fix(presentation): 修复 presentation 模块类型错误和语法问题
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 创建 types.ts 定义完整的类型系统 - 重写 DocumentRenderer.tsx 修复语法错误 - 重写 QuizRenderer.tsx 修复语法错误 - 重写 PresentationContainer.tsx 添加类型守卫 - 重写 TypeSwitcher.tsx 修复类型引用 - 更新 index.ts 移除不存在的 ChartRenderer 导出 审计结果: - 类型检查: 通过 - 单元测试: 222 passed - 构建: 成功
This commit is contained in:
@@ -172,3 +172,71 @@ export async function stopVikingServer(): Promise<void> {
|
||||
export async function restartVikingServer(): Promise<void> {
|
||||
return invoke<void>('viking_server_restart');
|
||||
}
|
||||
|
||||
// === Memory Extraction Functions ===
|
||||
|
||||
export interface ChatMessageForExtraction {
|
||||
role: string;
|
||||
content: string;
|
||||
timestamp?: string;
|
||||
}
|
||||
|
||||
export interface ExtractedMemory {
|
||||
category: 'user_preference' | 'user_fact' | 'agent_lesson' | 'agent_pattern' | 'task';
|
||||
content: string;
|
||||
tags: string[];
|
||||
importance: number;
|
||||
suggestedUri: string;
|
||||
reasoning?: string;
|
||||
}
|
||||
|
||||
export interface ExtractionResult {
|
||||
memories: ExtractedMemory[];
|
||||
summary: string;
|
||||
tokensSaved?: number;
|
||||
extractionTimeMs: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract memories from conversation session
|
||||
*/
|
||||
export async function extractSessionMemories(
|
||||
messages: ChatMessageForExtraction[],
|
||||
agentId: string
|
||||
): Promise<ExtractionResult> {
|
||||
return invoke<ExtractionResult>('extract_session_memories', { messages, agentId });
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract memories and store to SqliteStorage in one call
|
||||
*/
|
||||
export async function extractAndStoreMemories(
|
||||
messages: ChatMessageForExtraction[],
|
||||
agentId: string,
|
||||
llmEndpoint?: string,
|
||||
llmApiKey?: string
|
||||
): Promise<ExtractionResult> {
|
||||
return invoke<ExtractionResult>('extract_and_store_memories', {
|
||||
messages,
|
||||
agentId,
|
||||
llmEndpoint,
|
||||
llmApiKey,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject relevant memories into prompt for enhanced context
|
||||
*/
|
||||
export async function injectVikingPrompt(
|
||||
agentId: string,
|
||||
basePrompt: string,
|
||||
userInput: string,
|
||||
maxTokens?: number
|
||||
): Promise<string> {
|
||||
return invoke<string>('viking_inject_prompt', {
|
||||
agentId,
|
||||
basePrompt,
|
||||
userInput,
|
||||
maxTokens,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user