mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-06 02:48:22 +00:00
feat(react): add simple react operator and update related functionalities
- Add SimpleReactOp to react module - Update reme_ai/__init__.py to include react module - Modify contra_repeat_op.py to use memory_id instead of id - Adjust datetime_handler.py to handle string datetime conversion - Update default.yaml to include react flow content - Modify get_observation_op.py and get_observation_with_time_op.py to use workspace_id from context - Update test/http_client_test.py to test new react functionality - Adjust messages.jsonl to reflect new analysis approach for Xiaomi Corporation
This commit is contained in:
parent
4eac2a2a93
commit
e26338fb95
14 changed files with 163 additions and 163 deletions
|
|
@ -1,30 +0,0 @@
|
|||
[
|
||||
{
|
||||
"workspace_id": "test_workspace1",
|
||||
"experience_id": "e249d97f56dd452badd764a81dc22709",
|
||||
"experience_type": "text",
|
||||
"when_to_use": "When analyzing a large, multifaceted corporation across various dimensions such as financials, market position, and technological innovations.",
|
||||
"content": "Breaking down the problem into smaller subtasks (e.g., financial performance, market standing, recent developments) allows for a more systematic and comprehensive analysis. Using multiple `web_search` calls with specific queries ensures that each dimension is thoroughly covered from different angles.",
|
||||
"score": null,
|
||||
"metadata": {
|
||||
"author": "qwen-max-2025-01-25",
|
||||
"created_time": "2025-07-21 16:35:35",
|
||||
"modified_time": "2025-07-21 16:35:35",
|
||||
"extra_info": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"workspace_id": "test_workspace1",
|
||||
"experience_id": "c13abd248d1a48e89582f0177a7a0f84",
|
||||
"experience_type": "text",
|
||||
"when_to_use": "When information retrieved seems sufficient but fragmented across several sources and needs to be synthesized into a coherent response.",
|
||||
"content": "After gathering data through various tool calls, it is crucial to integrate all relevant pieces of information into a unified narrative. This involves cross-referencing the content, ensuring consistency, and presenting the findings in a structured manner so that the final output directly addresses the user’s question without leaving gaps or introducing redundancies.",
|
||||
"score": null,
|
||||
"metadata": {
|
||||
"author": "qwen-max-2025-01-25",
|
||||
"created_time": "2025-07-21 16:35:35",
|
||||
"modified_time": "2025-07-21 16:35:35",
|
||||
"extra_info": null
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -3,18 +3,18 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ExperienceMaker - Experience Library</title>
|
||||
<title>Reme - Memory Library</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
||||
}
|
||||
.library-card, .experience-card {
|
||||
.library-card, .memory-card {
|
||||
transition: all 0.3s ease;
|
||||
border-left: 4px solid transparent;
|
||||
}
|
||||
.library-card:hover, .experience-card:hover {
|
||||
.library-card:hover, .memory-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
|
||||
border-left-color: #3b82f6;
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.experience-detail {
|
||||
.memory-detail {
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
|
@ -76,13 +76,13 @@
|
|||
<div class="container mx-auto px-6">
|
||||
<div class="text-center">
|
||||
<h1 class="text-4xl font-bold mb-4">
|
||||
<i class="fas fa-brain mr-3"></i>ExperienceMaker
|
||||
<i class="fas fa-brain mr-3"></i>Reme
|
||||
</h1>
|
||||
<p class="text-xl opacity-90" id="header-subtitle">Empowering agents to learn from the past and excel in the future</p>
|
||||
<p class="text-xl opacity-90" id="header-subtitle">Remember me - Empowering agents with memory libraries</p>
|
||||
<div class="mt-6 flex justify-center items-center space-x-4 text-sm">
|
||||
<span class="bg-white bg-opacity-20 px-3 py-1 rounded-full">
|
||||
<i class="fas fa-database mr-1"></i>
|
||||
<span id="total-experiences">Loading...</span> Experiences
|
||||
<span id="total-memories">Loading...</span> Memories
|
||||
</span>
|
||||
<span class="bg-white bg-opacity-20 px-3 py-1 rounded-full">
|
||||
<i class="fas fa-tags mr-1"></i>
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
<input
|
||||
id="search-input"
|
||||
type="text"
|
||||
placeholder="Search libraries or experiences..."
|
||||
placeholder="Search libraries or memories..."
|
||||
class="w-full pl-10 pr-4 py-3 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none"
|
||||
>
|
||||
</div>
|
||||
|
|
@ -131,14 +131,14 @@
|
|||
<!-- Loading State -->
|
||||
<div id="loading" class="text-center py-12">
|
||||
<div class="loading-spinner mx-auto mb-4"></div>
|
||||
<p class="text-gray-600">Loading experience library...</p>
|
||||
<p class="text-gray-600">Loading memory library...</p>
|
||||
</div>
|
||||
|
||||
<!-- Error State -->
|
||||
<div id="error" class="hidden text-center py-12">
|
||||
<i class="fas fa-exclamation-triangle text-red-500 text-4xl mb-4"></i>
|
||||
<p class="text-gray-600 mb-4">Failed to load experience library</p>
|
||||
<button onclick="loadExperiences()" class="px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
|
||||
<p class="text-gray-600 mb-4">Failed to load memory library</p>
|
||||
<button onclick="loadMemories()" class="px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
|
||||
Try Again
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -156,9 +156,9 @@
|
|||
<!-- Library cards will be dynamically inserted here -->
|
||||
</div>
|
||||
|
||||
<!-- Experiences Grid (Library Detail View) -->
|
||||
<div id="experiences-container" class="hidden grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
<!-- Experience cards will be dynamically inserted here -->
|
||||
<!-- Memories Grid (Library Detail View) -->
|
||||
<div id="memories-container" class="hidden grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
<!-- Memory cards will be dynamically inserted here -->
|
||||
</div>
|
||||
|
||||
<!-- No Results -->
|
||||
|
|
@ -169,14 +169,14 @@
|
|||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Experience Detail Modal -->
|
||||
<div id="experience-modal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center p-4">
|
||||
<div class="bg-white rounded-lg shadow-xl max-w-4xl w-full experience-detail">
|
||||
<!-- Memory Detail Modal -->
|
||||
<div id="memory-modal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center p-4">
|
||||
<div class="bg-white rounded-lg shadow-xl max-w-4xl w-full memory-detail">
|
||||
<div class="p-6">
|
||||
<!-- Modal Header -->
|
||||
<div class="flex items-start justify-between mb-6">
|
||||
<div>
|
||||
<h2 class="text-2xl font-bold text-gray-900 mb-2">Experience Details</h2>
|
||||
<h2 class="text-2xl font-bold text-gray-900 mb-2">Memory Details</h2>
|
||||
<div class="flex items-center space-x-2">
|
||||
<span id="modal-library" class="px-3 py-1 bg-blue-100 text-blue-800 text-sm font-medium rounded-full"></span>
|
||||
<span id="modal-score" class="px-2 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full hidden"></span>
|
||||
|
|
@ -197,10 +197,10 @@
|
|||
<p id="modal-when-to-use" class="text-gray-700 leading-relaxed bg-blue-50 p-4 rounded-lg"></p>
|
||||
</div>
|
||||
|
||||
<!-- Experience Content -->
|
||||
<!-- Memory Content -->
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
|
||||
<i class="fas fa-lightbulb mr-2 text-yellow-500"></i>Experience
|
||||
<i class="fas fa-lightbulb mr-2 text-yellow-500"></i>Memory
|
||||
</h3>
|
||||
<p id="modal-content" class="text-gray-700 leading-relaxed bg-yellow-50 p-4 rounded-lg"></p>
|
||||
</div>
|
||||
|
|
@ -220,7 +220,7 @@
|
|||
<span id="modal-created" class="ml-2 text-gray-800"></span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="font-medium text-gray-600">Experience ID:</span>
|
||||
<span class="font-medium text-gray-600">Memory ID:</span>
|
||||
<span id="modal-id" class="ml-2 text-gray-800 font-mono text-xs"></span>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -246,8 +246,8 @@
|
|||
<div class="container mx-auto px-6 text-center text-gray-600">
|
||||
<p>
|
||||
<i class="fas fa-code mr-2"></i>
|
||||
Built for AI agent experience generation and reuse •
|
||||
<a href="https://github.com/modelscope/ExperienceMaker" class="text-blue-500 hover:text-blue-600">
|
||||
Built for AI agent memory generation and reuse •
|
||||
<a href="https://github.com/modelscope/MemoryScope" class="text-blue-500 hover:text-blue-600">
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -255,26 +255,26 @@
|
|||
</footer>
|
||||
|
||||
<script>
|
||||
let allExperiences = [];
|
||||
let allMemories = [];
|
||||
let librariesData = {};
|
||||
let currentView = 'libraries'; // 'libraries' or 'experiences'
|
||||
let currentView = 'libraries'; // 'libraries' or 'memories'
|
||||
let currentLibrary = null;
|
||||
|
||||
// GitHub API configuration
|
||||
const GITHUB_USER = 'modelscope';
|
||||
const REPO_NAME = 'ExperienceMaker';
|
||||
const EXPERIENCE_FOLDER = 'library';
|
||||
const REPO_NAME = 'MemoryScope';
|
||||
const MEMORY_FOLDER = 'library';
|
||||
|
||||
// DOM elements
|
||||
const loadingEl = document.getElementById('loading');
|
||||
const errorEl = document.getElementById('error');
|
||||
const resultsInfoEl = document.getElementById('results-info');
|
||||
const librariesContainer = document.getElementById('libraries-container');
|
||||
const experiencesContainer = document.getElementById('experiences-container');
|
||||
const memoriesContainer = document.getElementById('memories-container');
|
||||
const noResultsEl = document.getElementById('no-results');
|
||||
const searchInput = document.getElementById('search-input');
|
||||
const clearFiltersBtn = document.getElementById('clear-filters');
|
||||
const totalExperiencesEl = document.getElementById('total-experiences');
|
||||
const totalMemoriesEl = document.getElementById('total-memories');
|
||||
const totalLibrariesEl = document.getElementById('total-libraries');
|
||||
const resultsCountEl = document.getElementById('results-count');
|
||||
const totalCountEl = document.getElementById('total-count');
|
||||
|
|
@ -284,12 +284,12 @@
|
|||
const headerSubtitleEl = document.getElementById('header-subtitle');
|
||||
|
||||
// Modal elements
|
||||
const experienceModal = document.getElementById('experience-modal');
|
||||
const memoryModal = document.getElementById('memory-modal');
|
||||
const closeModalBtn = document.getElementById('close-modal');
|
||||
const closeModalBtnFooter = document.getElementById('close-modal-btn');
|
||||
|
||||
// Load experiences on page load
|
||||
document.addEventListener('DOMContentLoaded', loadExperiences);
|
||||
// Load memories on page load
|
||||
document.addEventListener('DOMContentLoaded', loadMemories);
|
||||
|
||||
// Event listeners
|
||||
searchInput.addEventListener('input', debounce(handleSearch, 300));
|
||||
|
|
@ -297,15 +297,15 @@
|
|||
backButtonEl.addEventListener('click', showLibrariesView);
|
||||
closeModalBtn.addEventListener('click', closeModal);
|
||||
closeModalBtnFooter.addEventListener('click', closeModal);
|
||||
experienceModal.addEventListener('click', (e) => {
|
||||
if (e.target === experienceModal) closeModal();
|
||||
memoryModal.addEventListener('click', (e) => {
|
||||
if (e.target === memoryModal) closeModal();
|
||||
});
|
||||
|
||||
async function loadExperiences() {
|
||||
async function loadMemories() {
|
||||
try {
|
||||
showLoading();
|
||||
|
||||
// const baseUrl = `https://raw.githubusercontent.com/${GITHUB_USER}/${REPO_NAME}/main/${EXPERIENCE_FOLDER}`;
|
||||
// const baseUrl = `https://raw.githubusercontent.com/${GITHUB_USER}/${REPO_NAME}/main/${MEMORY_FOLDER}`;
|
||||
const baseUrl = `./`;
|
||||
|
||||
const knownFiles = [
|
||||
|
|
@ -314,9 +314,9 @@
|
|||
// 在这里添加你的其他 JSONL 文件名
|
||||
];
|
||||
|
||||
console.log('开始加载经验库文件...');
|
||||
console.log('开始加载记忆库文件...');
|
||||
|
||||
const experiencePromises = knownFiles.map(async (fileName) => {
|
||||
const memoryPromises = knownFiles.map(async (fileName) => {
|
||||
try {
|
||||
const fileUrl = `${baseUrl}/${fileName}`;
|
||||
console.log(`加载文件: ${fileUrl}`);
|
||||
|
|
@ -331,23 +331,23 @@
|
|||
const content = await fileResponse.text();
|
||||
console.log(`文件 ${fileName} 加载成功, 大小: ${content.length} 字符`);
|
||||
|
||||
const experiences = content
|
||||
const memories = content
|
||||
.split('\n')
|
||||
.filter(line => line.trim())
|
||||
.map(line => {
|
||||
try {
|
||||
const experience = JSON.parse(line);
|
||||
experience._library = fileName.replace('.jsonl', '');
|
||||
return experience;
|
||||
const memory = JSON.parse(line);
|
||||
memory._library = fileName.replace('.jsonl', '');
|
||||
return memory;
|
||||
} catch (e) {
|
||||
console.warn('解析失败的行:', line.substring(0, 100));
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(exp => exp !== null);
|
||||
.filter(mem => mem !== null);
|
||||
|
||||
console.log(`文件 ${fileName} 解析出 ${experiences.length} 条经验`);
|
||||
return experiences;
|
||||
console.log(`文件 ${fileName} 解析出 ${memories.length} 条记忆`);
|
||||
return memories;
|
||||
|
||||
} catch (error) {
|
||||
console.error(`加载文件 ${fileName} 时出错:`, error);
|
||||
|
|
@ -355,27 +355,27 @@
|
|||
}
|
||||
});
|
||||
|
||||
const experienceArrays = await Promise.all(experiencePromises);
|
||||
allExperiences = experienceArrays.flat();
|
||||
const memoryArrays = await Promise.all(memoryPromises);
|
||||
allMemories = memoryArrays.flat();
|
||||
|
||||
console.log(`总共加载了 ${allExperiences.length} 条经验`);
|
||||
console.log(`总共加载了 ${allMemories.length} 条记忆`);
|
||||
|
||||
if (allExperiences.length === 0) {
|
||||
throw new Error('没有成功加载任何经验数据');
|
||||
if (allMemories.length === 0) {
|
||||
throw new Error('没有成功加载任何记忆数据');
|
||||
}
|
||||
|
||||
// Group experiences by library
|
||||
librariesData = allExperiences.reduce((acc, exp) => {
|
||||
const libName = exp._library;
|
||||
// Group memories by library
|
||||
librariesData = allMemories.reduce((acc, mem) => {
|
||||
const libName = mem._library;
|
||||
if (!acc[libName]) {
|
||||
acc[libName] = [];
|
||||
}
|
||||
acc[libName].push(exp);
|
||||
acc[libName].push(mem);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// Update stats
|
||||
totalExperiencesEl.textContent = allExperiences.length;
|
||||
totalMemoriesEl.textContent = allMemories.length;
|
||||
totalLibrariesEl.textContent = Object.keys(librariesData).length;
|
||||
|
||||
// Show libraries view
|
||||
|
|
@ -383,7 +383,7 @@
|
|||
hideLoading();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error loading experiences:', error);
|
||||
console.error('Error loading memories:', error);
|
||||
showError();
|
||||
}
|
||||
}
|
||||
|
|
@ -392,20 +392,20 @@
|
|||
currentView = 'libraries';
|
||||
currentLibrary = null;
|
||||
breadcrumbEl.classList.add('hidden');
|
||||
headerSubtitleEl.textContent = 'Empowering agents to learn from the past and excel in the future';
|
||||
headerSubtitleEl.textContent = 'Remember me - Empowering agents with memory libraries';
|
||||
searchInput.placeholder = 'Search libraries...';
|
||||
|
||||
displayLibraries();
|
||||
}
|
||||
|
||||
function showExperiencesView(libraryName) {
|
||||
currentView = 'experiences';
|
||||
function showMemoriesView(libraryName) {
|
||||
currentView = 'memories';
|
||||
currentLibrary = libraryName;
|
||||
breadcrumbEl.classList.remove('hidden');
|
||||
headerSubtitleEl.textContent = `Exploring ${libraryName} experience library`;
|
||||
searchInput.placeholder = 'Search experiences in this library...';
|
||||
headerSubtitleEl.textContent = `Exploring ${libraryName} memory library`;
|
||||
searchInput.placeholder = 'Search memories in this library...';
|
||||
|
||||
displayExperiences(librariesData[libraryName]);
|
||||
displayMemories(librariesData[libraryName]);
|
||||
}
|
||||
|
||||
function displayLibraries(filteredLibraries = null) {
|
||||
|
|
@ -417,12 +417,12 @@
|
|||
}
|
||||
|
||||
librariesContainer.innerHTML = libraries.map(libName => {
|
||||
const experiences = librariesData[libName];
|
||||
const sampleExp = experiences[0];
|
||||
const memories = librariesData[libName];
|
||||
const sampleMem = memories[0];
|
||||
|
||||
return `
|
||||
<div class="library-card bg-white rounded-lg shadow-sm p-6 fade-in"
|
||||
onclick="showExperiencesView('${libName}')">
|
||||
onclick="showMemoriesView('${libName}')">
|
||||
<!-- Header -->
|
||||
<div class="flex items-start justify-between mb-4">
|
||||
<div class="flex items-center space-x-3">
|
||||
|
|
@ -431,7 +431,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-gray-900">${libName}</h3>
|
||||
<p class="text-sm text-gray-500">${experiences.length} experiences</p>
|
||||
<p class="text-sm text-gray-500">${memories.length} memories</p>
|
||||
</div>
|
||||
</div>
|
||||
<i class="fas fa-chevron-right text-gray-400"></i>
|
||||
|
|
@ -439,9 +439,9 @@
|
|||
|
||||
<!-- Sample Content -->
|
||||
<div class="mb-4">
|
||||
<h4 class="text-sm font-medium text-gray-700 mb-2">Sample Experience:</h4>
|
||||
<h4 class="text-sm font-medium text-gray-700 mb-2">Sample Memory:</h4>
|
||||
<p class="text-gray-600 text-sm leading-relaxed truncate-text">
|
||||
${truncateText(sampleExp.when_to_use || sampleExp.content || 'No description available', 120)}
|
||||
${truncateText(sampleMem.when_to_use || sampleMem.content || 'No description available', 120)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
@ -449,11 +449,11 @@
|
|||
<div class="flex items-center justify-between text-xs text-gray-500 pt-4 border-t border-gray-100">
|
||||
<span>
|
||||
<i class="fas fa-user mr-1"></i>
|
||||
${sampleExp.metadata?.author || 'Unknown'}
|
||||
${sampleMem.author || 'Unknown'}
|
||||
</span>
|
||||
<span>
|
||||
<i class="fas fa-lightbulb mr-1"></i>
|
||||
${experiences.length} insights
|
||||
${memories.length} insights
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -465,24 +465,24 @@
|
|||
totalCountEl.textContent = Object.keys(librariesData).length;
|
||||
}
|
||||
|
||||
function displayExperiences(experiences) {
|
||||
if (experiences.length === 0) {
|
||||
function displayMemories(memories) {
|
||||
if (memories.length === 0) {
|
||||
showNoResults();
|
||||
return;
|
||||
}
|
||||
|
||||
experiencesContainer.innerHTML = experiences.map((experience, index) => `
|
||||
<div class="experience-card bg-white rounded-lg shadow-sm p-6 fade-in"
|
||||
onclick="showExperienceDetail('${currentLibrary}', ${index})">
|
||||
memoriesContainer.innerHTML = memories.map((memory, index) => `
|
||||
<div class="memory-card bg-white rounded-lg shadow-sm p-6 fade-in"
|
||||
onclick="showMemoryDetail('${currentLibrary}', ${index})">
|
||||
<!-- Header -->
|
||||
<div class="flex items-start justify-between mb-4">
|
||||
<div class="flex items-center space-x-2">
|
||||
<span class="px-3 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full">
|
||||
${experience._library}
|
||||
${memory._library}
|
||||
</span>
|
||||
${experience.score ? `
|
||||
${memory.score ? `
|
||||
<span class="px-2 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full">
|
||||
Score: ${experience.score}
|
||||
Score: ${memory.score}
|
||||
</span>
|
||||
` : ''}
|
||||
</div>
|
||||
|
|
@ -495,17 +495,17 @@
|
|||
<i class="fas fa-compass mr-1"></i>When to use:
|
||||
</h3>
|
||||
<p class="text-gray-600 text-sm leading-relaxed truncate-text">
|
||||
${truncateText(experience.when_to_use || 'No specific guidance provided', 100)}
|
||||
${truncateText(memory.when_to_use || 'No specific guidance provided', 100)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Content Preview -->
|
||||
<div class="mb-4">
|
||||
<h3 class="text-sm font-semibold text-gray-700 mb-2">
|
||||
<i class="fas fa-quote-left mr-1"></i>Experience:
|
||||
<i class="fas fa-quote-left mr-1"></i>Memory:
|
||||
</h3>
|
||||
<p class="text-gray-800 text-sm leading-relaxed truncate-text">
|
||||
${truncateText(experience.content || 'No content available', 150)}
|
||||
${truncateText(memory.content || 'No content available', 150)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
@ -514,7 +514,7 @@
|
|||
<div class="flex items-center space-x-4">
|
||||
<span>
|
||||
<i class="fas fa-user mr-1"></i>
|
||||
${experience.metadata?.author || 'Unknown'}
|
||||
${memory.author || 'Unknown'}
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-blue-500 font-medium">
|
||||
|
|
@ -524,40 +524,40 @@
|
|||
</div>
|
||||
`).join('');
|
||||
|
||||
showResults('experiences');
|
||||
resultsCountEl.textContent = experiences.length;
|
||||
totalCountEl.textContent = experiences.length;
|
||||
showResults('memories');
|
||||
resultsCountEl.textContent = memories.length;
|
||||
totalCountEl.textContent = memories.length;
|
||||
}
|
||||
|
||||
function showExperienceDetail(libraryName, index) {
|
||||
const experience = librariesData[libraryName][index];
|
||||
function showMemoryDetail(libraryName, index) {
|
||||
const memory = librariesData[libraryName][index];
|
||||
|
||||
// Populate modal content
|
||||
document.getElementById('modal-library').textContent = experience._library;
|
||||
document.getElementById('modal-when-to-use').textContent = experience.when_to_use || 'No specific guidance provided';
|
||||
document.getElementById('modal-content').textContent = experience.content || 'No content available';
|
||||
document.getElementById('modal-author').textContent = experience.metadata?.author || 'Unknown';
|
||||
document.getElementById('modal-created').textContent = experience.metadata?.created_time ?
|
||||
new Date(experience.metadata.created_time).toLocaleDateString() : 'Unknown';
|
||||
document.getElementById('modal-id').textContent = experience.experience_id || 'N/A';
|
||||
document.getElementById('modal-workspace').textContent = experience.workspace_id || 'N/A';
|
||||
document.getElementById('modal-library').textContent = memory._library;
|
||||
document.getElementById('modal-when-to-use').textContent = memory.when_to_use || 'No specific guidance provided';
|
||||
document.getElementById('modal-content').textContent = memory.content || 'No content available';
|
||||
document.getElementById('modal-author').textContent = memory.author || 'Unknown';
|
||||
document.getElementById('modal-created').textContent = memory.time_created ?
|
||||
new Date(memory.time_created).toLocaleDateString() : 'Unknown';
|
||||
document.getElementById('modal-id').textContent = memory.memory_id || 'N/A';
|
||||
document.getElementById('modal-workspace').textContent = memory.workspace_id || 'N/A';
|
||||
|
||||
// Show/hide score
|
||||
const scoreEl = document.getElementById('modal-score');
|
||||
if (experience.score) {
|
||||
scoreEl.textContent = `Score: ${experience.score}`;
|
||||
if (memory.score) {
|
||||
scoreEl.textContent = `Score: ${memory.score}`;
|
||||
scoreEl.classList.remove('hidden');
|
||||
} else {
|
||||
scoreEl.classList.add('hidden');
|
||||
}
|
||||
|
||||
// Show modal
|
||||
experienceModal.classList.remove('hidden');
|
||||
memoryModal.classList.remove('hidden');
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
experienceModal.classList.add('hidden');
|
||||
memoryModal.classList.add('hidden');
|
||||
document.body.style.overflow = 'auto';
|
||||
}
|
||||
|
||||
|
|
@ -573,27 +573,27 @@
|
|||
const filteredLibraries = Object.keys(librariesData).filter(libName => {
|
||||
const library = librariesData[libName];
|
||||
return libName.toLowerCase().includes(searchTerm) ||
|
||||
library.some(exp =>
|
||||
(exp.when_to_use || '').toLowerCase().includes(searchTerm) ||
|
||||
(exp.content || '').toLowerCase().includes(searchTerm)
|
||||
library.some(mem =>
|
||||
(mem.when_to_use || '').toLowerCase().includes(searchTerm) ||
|
||||
(mem.content || '').toLowerCase().includes(searchTerm)
|
||||
);
|
||||
});
|
||||
|
||||
displayLibraries(filteredLibraries);
|
||||
} else {
|
||||
const experiences = librariesData[currentLibrary];
|
||||
const memories = librariesData[currentLibrary];
|
||||
if (!searchTerm) {
|
||||
displayExperiences(experiences);
|
||||
displayMemories(memories);
|
||||
return;
|
||||
}
|
||||
|
||||
const filteredExperiences = experiences.filter(exp =>
|
||||
(exp.when_to_use || '').toLowerCase().includes(searchTerm) ||
|
||||
(exp.content || '').toLowerCase().includes(searchTerm) ||
|
||||
(exp.metadata?.author || '').toLowerCase().includes(searchTerm)
|
||||
const filteredMemories = memories.filter(mem =>
|
||||
(mem.when_to_use || '').toLowerCase().includes(searchTerm) ||
|
||||
(mem.content || '').toLowerCase().includes(searchTerm) ||
|
||||
(mem.author || '').toLowerCase().includes(searchTerm)
|
||||
);
|
||||
|
||||
displayExperiences(filteredExperiences);
|
||||
displayMemories(filteredMemories);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -602,7 +602,7 @@
|
|||
if (currentView === 'libraries') {
|
||||
displayLibraries();
|
||||
} else {
|
||||
displayExperiences(librariesData[currentLibrary]);
|
||||
displayMemories(librariesData[currentLibrary]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -630,7 +630,7 @@
|
|||
errorEl.classList.add('hidden');
|
||||
resultsInfoEl.classList.add('hidden');
|
||||
librariesContainer.classList.add('hidden');
|
||||
experiencesContainer.classList.add('hidden');
|
||||
memoriesContainer.classList.add('hidden');
|
||||
noResultsEl.classList.add('hidden');
|
||||
}
|
||||
|
||||
|
|
@ -643,7 +643,7 @@
|
|||
errorEl.classList.remove('hidden');
|
||||
resultsInfoEl.classList.add('hidden');
|
||||
librariesContainer.classList.add('hidden');
|
||||
experiencesContainer.classList.add('hidden');
|
||||
memoriesContainer.classList.add('hidden');
|
||||
noResultsEl.classList.add('hidden');
|
||||
}
|
||||
|
||||
|
|
@ -653,19 +653,19 @@
|
|||
|
||||
if (type === 'libraries') {
|
||||
librariesContainer.classList.remove('hidden');
|
||||
experiencesContainer.classList.add('hidden');
|
||||
memoriesContainer.classList.add('hidden');
|
||||
resultsTypeEl.textContent = 'libraries';
|
||||
} else {
|
||||
librariesContainer.classList.add('hidden');
|
||||
experiencesContainer.classList.remove('hidden');
|
||||
resultsTypeEl.textContent = 'experiences';
|
||||
memoriesContainer.classList.remove('hidden');
|
||||
resultsTypeEl.textContent = 'memories';
|
||||
}
|
||||
}
|
||||
|
||||
function showNoResults() {
|
||||
resultsInfoEl.classList.add('hidden');
|
||||
librariesContainer.classList.add('hidden');
|
||||
experiencesContainer.classList.add('hidden');
|
||||
memoriesContainer.classList.add('hidden');
|
||||
noResultsEl.classList.remove('hidden');
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,5 @@ from reme_ai import react
|
|||
from reme_ai import retrieve
|
||||
from reme_ai import summary
|
||||
from reme_ai import vector_store
|
||||
from reme_ai import delete
|
||||
from reme_ai import record
|
||||
|
||||
__version__ = "0.1.0"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# default config.yaml
|
||||
backend: mcp
|
||||
backend: http
|
||||
language: ""
|
||||
thread_pool_max_workers: 32
|
||||
ray_max_workers: 1
|
||||
|
|
@ -80,6 +80,40 @@ flow:
|
|||
description: "A list of conversation messages information. This field does not need to be filled in, the system will complete it automatically."
|
||||
required: false
|
||||
|
||||
record_task_memory:
|
||||
flow_content: update_memory_freq_op >> update_memory_utility_op >> update_vector_store_op
|
||||
description: "Update the freq & utility attributes of retrieved task memories"
|
||||
input_schema:
|
||||
workspace_id:
|
||||
type: "str"
|
||||
description: "workspace id"
|
||||
required: true
|
||||
memory_dicts:
|
||||
type: "list"
|
||||
description: "A list of retrieved task memory corresponding to the current task."
|
||||
required: true
|
||||
update_utility:
|
||||
type: "bool"
|
||||
description: "Whether to update the utility attribute of the retrieved task memory."
|
||||
required: true
|
||||
|
||||
delete_task_memory:
|
||||
flow_content: delete_memory_op >> update_vector_store_op
|
||||
description: "Delete task memories when utility/freq < utility_threshold and freq >= freq_threshold"
|
||||
input_schema:
|
||||
workspace_id:
|
||||
type: "str"
|
||||
description: "workspace id"
|
||||
required: true
|
||||
freq_threshold:
|
||||
type: "int"
|
||||
description: "The retrieved frequency threshold for deleting task memory."
|
||||
required: true
|
||||
utility_threshold:
|
||||
type: "float"
|
||||
description: "The utility/freq threshold for deleting task memory."
|
||||
required: true
|
||||
|
||||
# reconsolidate_personal_memory:
|
||||
# flow_content: load_not_reflected_memory_op >> get_reflection_subject_op >> update_insight_op >> long_contra_repeat_op >> update_vector_store_op
|
||||
# description: "Consolidate personal memories by generating topic insights, updating values, resolving conflicts, and updating vector store"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
from . import task
|
||||
|
|
@ -1 +0,0 @@
|
|||
from .delete_memory_op import DeleteMemoryOp
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
from flowllm import C
|
||||
from flowllm.context.flow_context import FlowContext
|
||||
from flowllm.op.agent.react_op import ReactOp
|
||||
from flowllm.op.agent.react_v1_op import ReactV1Op
|
||||
|
||||
|
||||
@C.register_op()
|
||||
class SimpleReactOp(ReactOp):
|
||||
class SimpleReactOp(ReactV1Op):
|
||||
...
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
from . import task
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
from .update_memory_freq_op import UpdateMemoryFreqOp
|
||||
from .update_memory_utility_op import UpdateMemoryUtilityOp
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
from reme_ai.vector_store.recall_vector_store_op import RecallVectorStoreOp
|
||||
from reme_ai.vector_store.update_vector_store_op import UpdateVectorStoreOp
|
||||
from reme_ai.vector_store.vector_store_action_op import VectorStoreActionOp
|
||||
from .delete_memory_op import DeleteMemoryOp
|
||||
from .recall_vector_store_op import RecallVectorStoreOp
|
||||
from .update_memory_freq_op import UpdateMemoryFreqOp
|
||||
from .update_memory_utility_op import UpdateMemoryUtilityOp
|
||||
from .update_vector_store_op import UpdateVectorStoreOp
|
||||
from .vector_store_action_op import VectorStoreActionOp
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
from typing import List
|
||||
from flowllm import C, BaseLLMOp
|
||||
from flowllm import C, BaseLLMOp, BaseOp
|
||||
from loguru import logger
|
||||
|
||||
from reme_ai.schema.memory import BaseMemory, dict_to_memory
|
||||
|
||||
|
||||
@C.register_op()
|
||||
class UpdateMemoryFreqOp(BaseLLMOp):
|
||||
class UpdateMemoryFreqOp(BaseOp):
|
||||
file_path: str = __file__
|
||||
|
||||
def execute(self):
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
from typing import List
|
||||
from flowllm import C, BaseLLMOp
|
||||
from flowllm import C, BaseLLMOp, BaseOp
|
||||
from loguru import logger
|
||||
|
||||
from reme_ai.schema.memory import BaseMemory
|
||||
|
||||
|
||||
@C.register_op()
|
||||
class UpdateMemoryUtilityOp(BaseLLMOp):
|
||||
class UpdateMemoryUtilityOp(BaseOp):
|
||||
file_path: str = __file__
|
||||
|
||||
def execute(self):
|
||||
Loading…
Add table
Reference in a new issue