feat: Enhance CodexLens with GPU support and semantic status improvements

- Added accelerator and providers fields to SemanticStatus interface.
- Updated checkSemanticStatus function to retrieve ONNX providers and accelerator type.
- Introduced detectGpuSupport function to identify available GPU modes (CUDA, DirectML).
- Modified installSemantic function to support GPU acceleration modes and clean up ONNX Runtime installations.
- Updated package requirements in PKG-INFO for semantic-gpu and semantic-directml extras.
- Added new source files for GPU support and enrichment functionalities.
- Updated tests to cover new features and ensure comprehensive testing.
This commit is contained in:
catlog22
2025-12-22 17:42:26 +08:00
parent 72f24bf535
commit acdfbb4644
9 changed files with 1215 additions and 98 deletions

View File

@@ -23,6 +23,9 @@ const i18n = {
'common.loading': 'Loading...',
'common.error': 'Error',
'common.success': 'Success',
'common.retry': 'Retry',
'common.refresh': 'Refresh',
'common.minutes': 'minutes',
// Header
'header.project': 'Project:',
@@ -277,8 +280,17 @@ const i18n = {
'codexlens.installDeps': 'Install Dependencies',
'codexlens.installDepsPrompt': 'Would you like to install them now? (This may take a few minutes)\n\nClick "Cancel" to create FTS index only.',
'codexlens.installingDeps': 'Installing dependencies...',
'codexlens.installingMode': 'Installing with',
'codexlens.depsInstalled': 'Dependencies installed successfully',
'codexlens.depsInstallFailed': 'Failed to install dependencies',
// GPU Mode Selection
'codexlens.selectGpuMode': 'Select acceleration mode',
'codexlens.cpuModeDesc': 'Standard CPU processing',
'codexlens.directmlModeDesc': 'Windows GPU (NVIDIA/AMD/Intel)',
'codexlens.cudaModeDesc': 'NVIDIA GPU (requires CUDA Toolkit)',
'common.recommended': 'Recommended',
'common.unavailable': 'Unavailable',
'codexlens.modelManagement': 'Model Management',
'codexlens.loadingModels': 'Loading models...',
'codexlens.downloadModel': 'Download',
@@ -293,6 +305,35 @@ const i18n = {
'codexlens.modelListError': 'Failed to load models',
'codexlens.noModelsAvailable': 'No models available',
// Model Download Progress
'codexlens.downloadingModel': 'Downloading',
'codexlens.connectingToHuggingFace': 'Connecting to Hugging Face...',
'codexlens.downloadTimeEstimate': 'Estimated time',
'codexlens.manualDownloadHint': 'Manual download',
'codexlens.downloadingModelFiles': 'Downloading model files...',
'codexlens.downloadingWeights': 'Downloading model weights...',
'codexlens.downloadingTokenizer': 'Downloading tokenizer...',
'codexlens.verifyingModel': 'Verifying model...',
'codexlens.finalizingDownload': 'Finalizing...',
'codexlens.downloadComplete': 'Download complete!',
'codexlens.downloadFailed': 'Download failed',
'codexlens.manualDownloadOptions': 'Manual download options',
'codexlens.cliDownload': 'CLI',
'codexlens.huggingfaceDownload': 'Hugging Face',
'codexlens.downloadCanceled': 'Download canceled',
// Manual Download Guide
'codexlens.manualDownloadGuide': 'Manual Download Guide',
'codexlens.cliMethod': 'Command Line (Recommended)',
'codexlens.cliMethodDesc': 'Run in terminal with progress display:',
'codexlens.pythonMethod': 'Python Script',
'codexlens.pythonMethodDesc': 'Pre-download model using Python:',
'codexlens.hfHubMethod': 'Hugging Face Hub CLI',
'codexlens.hfHubMethodDesc': 'Download using huggingface-cli with resume support:',
'codexlens.modelLinks': 'Direct Model Links',
'codexlens.cacheLocation': 'Model Storage Location',
'common.copied': 'Copied to clipboard',
// CodexLens Indexing Progress
'codexlens.indexing': 'Indexing',
'codexlens.indexingDesc': 'Building code index for workspace',
@@ -302,6 +343,43 @@ const i18n = {
'codexlens.indexSuccess': 'Index created successfully',
'codexlens.indexFailed': 'Indexing failed',
// CodexLens Install
'codexlens.installDesc': 'Python-based code indexing engine',
'codexlens.whatWillBeInstalled': 'What will be installed:',
'codexlens.pythonVenv': 'Python virtual environment',
'codexlens.pythonVenvDesc': 'Isolated Python environment',
'codexlens.codexlensPackage': 'CodexLens package',
'codexlens.codexlensPackageDesc': 'Code indexing and search engine',
'codexlens.sqliteFtsDesc': 'Full-text search database',
'codexlens.installLocation': 'Installation Location',
'codexlens.installTime': 'First installation may take 2-3 minutes to download and setup Python packages.',
'codexlens.startingInstall': 'Starting installation...',
'codexlens.installing': 'Installing...',
'codexlens.creatingVenv': 'Creating virtual environment...',
'codexlens.installingPip': 'Installing pip packages...',
'codexlens.installingPackage': 'Installing CodexLens package...',
'codexlens.settingUpDeps': 'Setting up Python dependencies...',
'codexlens.installComplete': 'Installation complete!',
'codexlens.installSuccess': 'CodexLens installed successfully!',
'codexlens.installNow': 'Install Now',
'codexlens.accelerator': 'Accelerator',
// CodexLens Uninstall
'codexlens.uninstall': 'Uninstall',
'codexlens.uninstallDesc': 'Remove CodexLens and all data',
'codexlens.whatWillBeRemoved': 'What will be removed:',
'codexlens.removeVenv': 'Virtual environment at ~/.codexlens/venv',
'codexlens.removeData': 'All CodexLens indexed data and databases',
'codexlens.removeConfig': 'Configuration and semantic search models',
'codexlens.removing': 'Removing files...',
'codexlens.uninstalling': 'Uninstalling...',
'codexlens.removingVenv': 'Removing virtual environment...',
'codexlens.removingData': 'Deleting indexed data...',
'codexlens.removingConfig': 'Cleaning up configuration...',
'codexlens.finalizing': 'Finalizing removal...',
'codexlens.uninstallComplete': 'Uninstallation complete!',
'codexlens.uninstallSuccess': 'CodexLens uninstalled successfully!',
// Index Manager
'index.manager': 'Index Manager',
'index.projects': 'Projects',
@@ -1358,7 +1436,10 @@ const i18n = {
'common.loading': '加载中...',
'common.error': '错误',
'common.success': '成功',
'common.retry': '重试',
'common.refresh': '刷新',
'common.minutes': '分钟',
// Header
'header.project': '项目:',
'header.recentProjects': '最近项目',
@@ -1612,8 +1693,17 @@ const i18n = {
'codexlens.installDeps': '安装依赖',
'codexlens.installDepsPrompt': '是否立即安装?(可能需要几分钟)\n\n点击"取消"将只创建 FTS 索引。',
'codexlens.installingDeps': '安装依赖中...',
'codexlens.installingMode': '正在安装',
'codexlens.depsInstalled': '依赖安装成功',
'codexlens.depsInstallFailed': '依赖安装失败',
// GPU 模式选择
'codexlens.selectGpuMode': '选择加速模式',
'codexlens.cpuModeDesc': '标准 CPU 处理',
'codexlens.directmlModeDesc': 'Windows GPUNVIDIA/AMD/Intel',
'codexlens.cudaModeDesc': 'NVIDIA GPU需要 CUDA Toolkit',
'common.recommended': '推荐',
'common.unavailable': '不可用',
'codexlens.modelManagement': '模型管理',
'codexlens.loadingModels': '加载模型中...',
'codexlens.downloadModel': '下载',
@@ -1628,6 +1718,35 @@ const i18n = {
'codexlens.modelListError': '加载模型列表失败',
'codexlens.noModelsAvailable': '没有可用模型',
// 模型下载进度
'codexlens.downloadingModel': '正在下载',
'codexlens.connectingToHuggingFace': '正在连接 Hugging Face...',
'codexlens.downloadTimeEstimate': '预计时间',
'codexlens.manualDownloadHint': '手动下载',
'codexlens.downloadingModelFiles': '正在下载模型文件...',
'codexlens.downloadingWeights': '正在下载模型权重...',
'codexlens.downloadingTokenizer': '正在下载分词器...',
'codexlens.verifyingModel': '正在验证模型...',
'codexlens.finalizingDownload': '正在完成...',
'codexlens.downloadComplete': '下载完成!',
'codexlens.downloadFailed': '下载失败',
'codexlens.manualDownloadOptions': '手动下载选项',
'codexlens.cliDownload': '命令行',
'codexlens.huggingfaceDownload': 'Hugging Face',
'codexlens.downloadCanceled': '下载已取消',
// 手动下载指南
'codexlens.manualDownloadGuide': '手动下载指南',
'codexlens.cliMethod': '命令行(推荐)',
'codexlens.cliMethodDesc': '在终端运行,显示下载进度:',
'codexlens.pythonMethod': 'Python 脚本',
'codexlens.pythonMethodDesc': '使用 Python 预下载模型:',
'codexlens.hfHubMethod': 'Hugging Face Hub CLI',
'codexlens.hfHubMethodDesc': '使用 huggingface-cli 下载,支持断点续传:',
'codexlens.modelLinks': '模型直链',
'codexlens.cacheLocation': '模型存储位置',
'common.copied': '已复制到剪贴板',
// CodexLens 索引进度
'codexlens.indexing': '索引中',
'codexlens.indexingDesc': '正在为工作区构建代码索引',
@@ -1637,6 +1756,43 @@ const i18n = {
'codexlens.indexSuccess': '索引创建成功',
'codexlens.indexFailed': '索引失败',
// CodexLens 安装
'codexlens.installDesc': '基于 Python 的代码索引引擎',
'codexlens.whatWillBeInstalled': '将安装的内容:',
'codexlens.pythonVenv': 'Python 虚拟环境',
'codexlens.pythonVenvDesc': '隔离的 Python 环境',
'codexlens.codexlensPackage': 'CodexLens 包',
'codexlens.codexlensPackageDesc': '代码索引和搜索引擎',
'codexlens.sqliteFtsDesc': '全文搜索数据库',
'codexlens.installLocation': '安装位置',
'codexlens.installTime': '首次安装可能需要 2-3 分钟下载和配置 Python 包。',
'codexlens.startingInstall': '正在启动安装...',
'codexlens.installing': '安装中...',
'codexlens.creatingVenv': '正在创建虚拟环境...',
'codexlens.installingPip': '正在安装 pip 包...',
'codexlens.installingPackage': '正在安装 CodexLens 包...',
'codexlens.settingUpDeps': '正在配置 Python 依赖...',
'codexlens.installComplete': '安装完成!',
'codexlens.installSuccess': 'CodexLens 安装成功!',
'codexlens.installNow': '立即安装',
'codexlens.accelerator': '加速器',
// CodexLens 卸载
'codexlens.uninstall': '卸载',
'codexlens.uninstallDesc': '移除 CodexLens 及所有数据',
'codexlens.whatWillBeRemoved': '将被移除的内容:',
'codexlens.removeVenv': '虚拟环境 ~/.codexlens/venv',
'codexlens.removeData': '所有 CodexLens 索引数据和数据库',
'codexlens.removeConfig': '配置文件和语义搜索模型',
'codexlens.removing': '正在删除文件...',
'codexlens.uninstalling': '正在卸载...',
'codexlens.removingVenv': '正在删除虚拟环境...',
'codexlens.removingData': '正在删除索引数据...',
'codexlens.removingConfig': '正在清理配置文件...',
'codexlens.finalizing': '正在完成卸载...',
'codexlens.uninstallComplete': '卸载完成!',
'codexlens.uninstallSuccess': 'CodexLens 卸载成功!',
// 索引管理器
'index.manager': '索引管理器',
'index.projects': '项目数',