mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
fix(frontend): fix i18n and runtime error in EndpointList
Fix hardcoded English labels in cache strategy display and prevent runtime error when filePatterns is undefined. Changes: - Replace hardcoded "TTL:", "Max:", "Patterns:" with formatMessage calls - Add optional chaining for filePatterns.length to prevent undefined error - Add "filePatterns" i18n key to en/zh api-settings.json
This commit is contained in:
@@ -92,10 +92,10 @@ function EndpointCard({
|
||||
)}
|
||||
{endpoint.cacheStrategy.enabled && (
|
||||
<div className="flex items-center gap-3 mt-2 text-xs text-muted-foreground">
|
||||
<span>TTL: {endpoint.cacheStrategy.ttlMinutes}m</span>
|
||||
<span>Max: {endpoint.cacheStrategy.maxSizeKB}KB</span>
|
||||
{endpoint.cacheStrategy.filePatterns.length > 0 && (
|
||||
<span>Patterns: {endpoint.cacheStrategy.filePatterns.length}</span>
|
||||
<span>{formatMessage({ id: 'apiSettings.endpoints.cacheTTL' })}: {endpoint.cacheStrategy.ttlMinutes}m</span>
|
||||
<span>{formatMessage({ id: 'apiSettings.endpoints.cacheMaxSize' })}: {endpoint.cacheStrategy.maxSizeKB}KB</span>
|
||||
{(endpoint.cacheStrategy.filePatterns?.length || 0) > 0 && (
|
||||
<span>{formatMessage({ id: 'apiSettings.endpoints.filePatterns' })}: {endpoint.cacheStrategy.filePatterns?.length || 0}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -167,6 +167,7 @@
|
||||
"enableContextCaching": "Enable context caching",
|
||||
"cacheTTL": "Cache TTL (minutes)",
|
||||
"cacheMaxSize": "Max Size (KB)",
|
||||
"filePatterns": "Patterns",
|
||||
"autoCachePatterns": "Auto-cache patterns",
|
||||
"filePatternsHint": "Comma-separated glob patterns (e.g., *.md,*.ts)",
|
||||
"enabled": "Enabled",
|
||||
|
||||
@@ -164,6 +164,7 @@
|
||||
"enableContextCaching": "启用上下文缓存",
|
||||
"cacheTTL": "缓存 TTL(分钟)",
|
||||
"cacheMaxSize": "最大大小(KB)",
|
||||
"filePatterns": "模式数",
|
||||
"autoCachePatterns": "自动缓存模式",
|
||||
"filePatternsHint": "逗号分隔的 glob 模式(例如:*.md,*.ts)",
|
||||
"enabled": "已启用",
|
||||
|
||||
Reference in New Issue
Block a user