mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 14:43:05 +09:00
Checkpoint: File edits
Automatic checkpoint created by Claude Code - Branch: v3 - Timestamp: 2026-01-07T05:52:41Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25568d39c4
commit
a55c2da14d
1 file changed
-32
@@ -208,38 +208,6 @@ export async function loadRuVector(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a simple hash-based embedding (internal helper)
|
||||
*/
|
||||
function generateHashEmbedding(text: string, dimensions: number = 768): Float32Array {
|
||||
const embedding = new Float32Array(dimensions);
|
||||
const normalized = text.toLowerCase().trim();
|
||||
|
||||
// Simple hash function
|
||||
let hash = 0;
|
||||
for (let i = 0; i < normalized.length; i++) {
|
||||
hash = ((hash << 5) - hash) + normalized.charCodeAt(i);
|
||||
hash = hash & hash; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
// Generate pseudo-random embedding based on hash
|
||||
for (let i = 0; i < dimensions; i++) {
|
||||
embedding[i] = Math.sin(hash * (i + 1) * 0.001) * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
// Normalize
|
||||
let norm = 0;
|
||||
for (let i = 0; i < dimensions; i++) {
|
||||
norm += embedding[i] * embedding[i];
|
||||
}
|
||||
norm = Math.sqrt(norm);
|
||||
for (let i = 0; i < dimensions; i++) {
|
||||
embedding[i] /= norm;
|
||||
}
|
||||
|
||||
return embedding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ruvector is available
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user