mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
Refactor search modes and optimize embedding generation
- Updated the dashboard template to hide the Code Graph Explorer feature. - Enhanced the `executeCodexLens` function to use `exec` for better cross-platform compatibility and improved command execution. - Changed the default `maxResults` and `limit` parameters in the smart search tool to 10 for better performance. - Introduced a new `priority` search mode in the smart search tool, replacing the previous `parallel` mode, which now follows a fallback strategy: hybrid -> exact -> ripgrep. - Optimized the embedding generation process in the embedding manager by batching operations and using a cached embedder instance to reduce model loading overhead. - Implemented a thread-safe singleton pattern for the embedder to improve performance across multiple searches.
This commit is contained in:
@@ -5,6 +5,37 @@
|
||||
|
||||
// ========== HTML/Text Processing ==========
|
||||
|
||||
/**
|
||||
* Encode JSON config data to Base64 for safe HTML attribute storage
|
||||
* @param {Object} config - Configuration object to encode
|
||||
* @returns {string} Base64 encoded JSON string
|
||||
*/
|
||||
function encodeConfigData(config) {
|
||||
try {
|
||||
const jsonStr = JSON.stringify(config);
|
||||
return btoa(encodeURIComponent(jsonStr));
|
||||
} catch (err) {
|
||||
console.error('[Utils] Error encoding config data:', err);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode Base64 config data back to JSON object
|
||||
* @param {string} encoded - Base64 encoded string
|
||||
* @returns {Object|null} Decoded configuration object or null on error
|
||||
*/
|
||||
function decodeConfigData(encoded) {
|
||||
try {
|
||||
if (!encoded) return null;
|
||||
const jsonStr = decodeURIComponent(atob(encoded));
|
||||
return JSON.parse(jsonStr);
|
||||
} catch (err) {
|
||||
console.error('[Utils] Error decoding config data:', err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape HTML special characters to prevent XSS attacks
|
||||
* @param {string} str - String to escape
|
||||
|
||||
Reference in New Issue
Block a user