Commit all workspace changes from current session
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env node
|
||||
const MemoryService = require('./architecture/memory-service');
|
||||
|
||||
async function test() {
|
||||
const memory = new MemoryService({
|
||||
nocodbUrl: 'http://192.168.25.5:8080',
|
||||
nocodbToken: 'owuYNodz0RcnDtUqnj5DK4Qeyp3ASQkDYkrdfGtw',
|
||||
baseId: 'pedwxnsn51vxdq2',
|
||||
tableId: 'mx149yctebfwvys'
|
||||
});
|
||||
|
||||
console.log('=== Memory System Test ===\n');
|
||||
|
||||
// Test 1: Connection
|
||||
console.log('1. Testing connection...');
|
||||
const conn = await memory.testConnection();
|
||||
console.log(conn.success ? '✅ Connected' : '❌ Failed:', conn.message);
|
||||
console.log(' Records:', conn.recordCount);
|
||||
|
||||
// Test 2: Store correction
|
||||
console.log('\n2. Testing correction storage...');
|
||||
try {
|
||||
const correction = await memory.storeCorrection({
|
||||
pattern: '\\d+\\s*(%|percent)',
|
||||
severity: 'auto-correct',
|
||||
message: 'Quantitative claim requires evidence',
|
||||
suggestion: 'Add source or measurement',
|
||||
blocking: true,
|
||||
autoDetected: true,
|
||||
context: 'test'
|
||||
});
|
||||
console.log('✅ Correction stored:', correction.id);
|
||||
} catch (err) {
|
||||
console.log('❌ Failed:', err.message);
|
||||
if (err.response?.data) console.log(' Error:', JSON.stringify(err.response.data));
|
||||
}
|
||||
|
||||
// Test 3: Load corrections
|
||||
console.log('\n3. Testing correction loading...');
|
||||
try {
|
||||
const corrections = await memory.loadCorrections();
|
||||
console.log('✅ Loaded', corrections.length, 'corrections');
|
||||
} catch (err) {
|
||||
console.log('❌ Failed:', err.message);
|
||||
}
|
||||
|
||||
// Test 4: Store preference
|
||||
console.log('\n4. Testing preference storage...');
|
||||
try {
|
||||
const pref = await memory.storePreference({
|
||||
category: 'communication',
|
||||
key: 'format',
|
||||
value: 'concise',
|
||||
importance: 9,
|
||||
confidence: 1.0,
|
||||
tags: ['format', 'style']
|
||||
});
|
||||
console.log('✅ Preference stored:', pref.id);
|
||||
} catch (err) {
|
||||
console.log('❌ Failed:', err.message);
|
||||
if (err.response?.data) console.log(' Error:', JSON.stringify(err.response.data));
|
||||
}
|
||||
|
||||
// Test 5: Load preferences
|
||||
console.log('\n5. Testing preference loading...');
|
||||
try {
|
||||
const prefs = await memory.getPreferences('communication', 5);
|
||||
console.log('✅ Loaded', prefs.length, 'preferences');
|
||||
} catch (err) {
|
||||
console.log('❌ Failed:', err.message);
|
||||
}
|
||||
|
||||
// Test 6: Validation logging
|
||||
console.log('\n6. Testing validation logging...');
|
||||
try {
|
||||
await memory.logValidation({
|
||||
sessionId: 'test-session',
|
||||
inputLength: 100,
|
||||
outputLength: 200,
|
||||
violationsFound: 1,
|
||||
newPatternsDetected: 0,
|
||||
correctionsAutoStored: 1,
|
||||
processingTimeMs: 50,
|
||||
blocked: true,
|
||||
workflow: 'test'
|
||||
});
|
||||
console.log('✅ Validation logged');
|
||||
} catch (err) {
|
||||
console.log('❌ Failed:', err.message);
|
||||
if (err.response?.data) console.log(' Error:', JSON.stringify(err.response.data));
|
||||
}
|
||||
|
||||
console.log('\n=== Tests Complete ===');
|
||||
}
|
||||
|
||||
test().catch(console.error);
|
||||
Reference in New Issue
Block a user