feat: enhance internationalization support and improve GPU mode selector with Python environment checks

This commit is contained in:
catlog22
2025-12-28 17:49:40 +08:00
parent 7aa1cda367
commit 4419c50942
3 changed files with 110 additions and 14 deletions

View File

@@ -1734,7 +1734,9 @@ const i18n = {
'discovery.title': 'Issue Discovery',
'discovery.description': 'Discover potential issues from multiple perspectives',
'discovery.noSessions': 'No discovery sessions',
'discovery.noDiscoveries': 'No discoveries yet',
'discovery.runHint': 'Run /issue:discover to start discovering issues',
'discovery.runCommand': 'Run /issue:discover to start discovering issues',
'discovery.sessions': 'Sessions',
'discovery.findings': 'Findings',
'discovery.phase': 'Phase',
@@ -1769,10 +1771,18 @@ const i18n = {
'discovery.confidence': 'Confidence',
'discovery.suggestedIssue': 'Suggested Issue',
'discovery.externalRef': 'External Reference',
'discovery.noFindings': 'No findings in this session',
'discovery.noFindings': 'No findings match your filters',
'discovery.filterPerspective': 'Filter by Perspective',
'discovery.filterPriority': 'Filter by Priority',
'discovery.filterAll': 'All',
'discovery.allPerspectives': 'All Perspectives',
'discovery.allPriorities': 'All Priorities',
'discovery.selectFinding': 'Select a finding to preview',
'discovery.location': 'Location',
'discovery.code': 'Code',
'discovery.impact': 'Impact',
'discovery.recommendation': 'Recommendation',
'discovery.exportAsIssues': 'Export as Issues',
'discovery.deleteSession': 'Delete Session',
'discovery.confirmDelete': 'Are you sure you want to delete this discovery session?',
'discovery.deleted': 'Discovery session deleted',
@@ -3649,7 +3659,9 @@ const i18n = {
'discovery.title': '议题发现',
'discovery.description': '从多个视角发现潜在问题',
'discovery.noSessions': '暂无发现会话',
'discovery.noDiscoveries': '暂无发现',
'discovery.runHint': '运行 /issue:discover 开始发现问题',
'discovery.runCommand': '运行 /issue:discover 开始发现问题',
'discovery.sessions': '会话',
'discovery.findings': '发现',
'discovery.phase': '阶段',
@@ -3684,10 +3696,18 @@ const i18n = {
'discovery.confidence': '置信度',
'discovery.suggestedIssue': '建议议题',
'discovery.externalRef': '外部参考',
'discovery.noFindings': '此会话暂无发现',
'discovery.noFindings': '没有匹配的发现',
'discovery.filterPerspective': '按视角筛选',
'discovery.filterPriority': '按优先级筛选',
'discovery.filterAll': '全部',
'discovery.allPerspectives': '所有视角',
'discovery.allPriorities': '所有优先级',
'discovery.selectFinding': '选择一个发现以预览',
'discovery.location': '位置',
'discovery.code': '代码',
'discovery.impact': '影响',
'discovery.recommendation': '建议',
'discovery.exportAsIssues': '导出为议题',
'discovery.deleteSession': '删除会话',
'discovery.confirmDelete': '确定要删除此发现会话吗?',
'discovery.deleted': '发现会话已删除',

View File

@@ -446,6 +446,12 @@ async function loadSemanticDepsStatus() {
* Build GPU mode selector HTML
*/
function buildGpuModeSelector(gpuInfo) {
// Check if DirectML is unavailable due to Python environment
var directmlUnavailableReason = null;
if (!gpuInfo.available.includes('directml') && gpuInfo.pythonEnv && gpuInfo.pythonEnv.error) {
directmlUnavailableReason = gpuInfo.pythonEnv.error;
}
var modes = [
{
id: 'cpu',
@@ -457,10 +463,13 @@ function buildGpuModeSelector(gpuInfo) {
{
id: 'directml',
label: 'DirectML',
desc: t('codexlens.directmlModeDesc') || 'Windows GPU (NVIDIA/AMD/Intel)',
desc: directmlUnavailableReason
? directmlUnavailableReason
: (t('codexlens.directmlModeDesc') || 'Windows GPU (NVIDIA/AMD/Intel)'),
icon: 'cpu',
available: gpuInfo.available.includes('directml'),
recommended: gpuInfo.mode === 'directml'
recommended: gpuInfo.mode === 'directml',
warning: directmlUnavailableReason
},
{
id: 'cuda',
@@ -487,6 +496,7 @@ function buildGpuModeSelector(gpuInfo) {
var isDisabled = !mode.available;
var isRecommended = mode.recommended;
var isDefault = mode.id === gpuInfo.mode;
var hasWarning = mode.warning;
html +=
'<label class="flex items-center gap-3 p-2 rounded border cursor-pointer hover:bg-muted/50 transition-colors ' +
@@ -502,7 +512,7 @@ function buildGpuModeSelector(gpuInfo) {
(isRecommended ? '<span class="text-xs bg-primary/20 text-primary px-1.5 py-0.5 rounded">' + (t('common.recommended') || 'Recommended') + '</span>' : '') +
(isDisabled ? '<span class="text-xs text-muted-foreground">(' + (t('common.unavailable') || 'Unavailable') + ')</span>' : '') +
'</div>' +
'<div class="text-xs text-muted-foreground">' + mode.desc + '</div>' +
'<div class="text-xs ' + (hasWarning ? 'text-warning' : 'text-muted-foreground') + '">' + mode.desc + '</div>' +
'</div>' +
'</label>';
});