Changeset 3462532
- Timestamp:
- 02/16/2026 01:13:30 PM (5 days ago)
- Location:
- ai-translate
- Files:
-
- 8 edited
- 1 copied
-
tags/2.2.8 (copied) (copied from ai-translate/trunk)
-
tags/2.2.8/README.md (modified) (1 diff)
-
tags/2.2.8/includes/admin-page.php (modified) (1 diff)
-
tags/2.2.8/includes/class-ai-seo.php (modified) (2 diffs)
-
tags/2.2.8/includes/class-ai-translate-core.php (modified) (2 diffs)
-
trunk/README.md (modified) (1 diff)
-
trunk/includes/admin-page.php (modified) (1 diff)
-
trunk/includes/class-ai-seo.php (modified) (2 diffs)
-
trunk/includes/class-ai-translate-core.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ai-translate/tags/2.2.8/README.md
r3461910 r3462532 185 185 ## Changelog 186 186 187 ### 2.2. 7187 ### 2.2.8 188 188 - Improve system prompt (role, what and how). 189 189 - Improve website context generator (what is the website about). 190 190 - Improve admin UX. 191 - Fix issue with language switcher in some specific themes. 191 192 - All enabled and detectable languages added to Wordpress sitemap (/wp-sitemap.xml) 192 193 - Code base refactoring. Improve performance and security, thighening code. -
ai-translate/tags/2.2.8/includes/admin-page.php
r3461910 r3462532 2534 2534 return false; 2535 2535 } 2536 // Block non-chat capabilities even when they appear later in a GPT model ID. 2537 return !preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex|instruct)/i', $model); 2536 // Legacy non-chat model family; incompatible with chat/completions translations. 2537 if (preg_match('/^babbage-/i', $model)) { 2538 return false; 2539 } 2540 // Block non-chat capabilities and known image-generation families. 2541 return !preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex|seedream|bria)/i', $model); 2538 2542 }); 2539 2543 sort($models); 2544 2545 // Place preferred translation models first per provider. 2546 // Existing saved selections are kept by the UI; this only controls default-first ordering. 2547 $preferred_model_patterns = [ 2548 'openai' => [ 2549 '/^gpt-4\.1-mini$/i', 2550 ], 2551 'openrouter' => [ 2552 '/gemini[-\s_.]*2\.5[-\s_.]*flash[-\s_.]*lite/i', 2553 ], 2554 'deepinfra' => [ 2555 '/gemini[-\s_.]*2\.5[-\s_.]*flash(?![-\s_.]*lite)/i', 2556 ], 2557 'deepseek' => [ 2558 '/^deepseek-chat$/i', 2559 ], 2560 'groq' => [ 2561 '/llama[-\s_.]*3\.1[-\s_.]*8b[-\s_.]*instant/i', 2562 ], 2563 ]; 2564 2565 if (isset($preferred_model_patterns[$provider_key])) { 2566 $preferred_index = false; 2567 foreach ($preferred_model_patterns[$provider_key] as $pattern) { 2568 foreach ($models as $index => $model) { 2569 if (preg_match($pattern, $model)) { 2570 $preferred_index = $index; 2571 break 2; 2572 } 2573 } 2574 } 2575 if ($preferred_index !== false) { 2576 $preferred_model = $models[$preferred_index]; 2577 unset($models[$preferred_index]); 2578 array_unshift($models, $preferred_model); 2579 $models = array_values($models); 2580 } 2581 } 2540 2582 wp_send_json_success(['models' => $models]); 2541 2583 }); -
ai-translate/tags/2.2.8/includes/class-ai-seo.php
r3461910 r3462532 929 929 { 930 930 $type = $node['@type'] ?? ''; 931 $changed = false; 932 933 if ($type === 'BreadcrumbList' && isset($node['itemListElement']) && is_array($node['itemListElement'])) { 931 $changed = false; if ($type === 'BreadcrumbList' && isset($node['itemListElement']) && is_array($node['itemListElement'])) { 934 932 foreach ($node['itemListElement'] as &$item) { 935 933 if (isset($item['name']) && is_string($item['name']) && trim($item['name']) !== '') { … … 942 940 } 943 941 unset($item); 944 } 945 946 // Handle @graph arrays (used by Yoast and others) 942 } // Handle @graph arrays (used by Yoast and others) 947 943 if (isset($node['@graph']) && is_array($node['@graph'])) { 948 944 foreach ($node['@graph'] as &$graphNode) { -
ai-translate/tags/2.2.8/includes/class-ai-translate-core.php
r3461910 r3462532 352 352 if ($model !== '') { 353 353 // Early guard for model families that are known to be non-chat/non-translation models. 354 if (preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex| instruct)/i', $model)) {354 if (preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex|seedream|bria)/i', $model)) { 355 355 throw new \Exception( 356 356 sprintf( … … 416 416 || strpos($haystack, 'audio') !== false 417 417 || strpos($haystack, 'codex') !== false 418 || strpos($haystack, 'model_not_found') !== false 419 || strpos($haystack, 'does not exist') !== false 418 420 ); 419 421 if ($nonChatModelError) { -
ai-translate/trunk/README.md
r3461910 r3462532 185 185 ## Changelog 186 186 187 ### 2.2. 7187 ### 2.2.8 188 188 - Improve system prompt (role, what and how). 189 189 - Improve website context generator (what is the website about). 190 190 - Improve admin UX. 191 - Fix issue with language switcher in some specific themes. 191 192 - All enabled and detectable languages added to Wordpress sitemap (/wp-sitemap.xml) 192 193 - Code base refactoring. Improve performance and security, thighening code. -
ai-translate/trunk/includes/admin-page.php
r3461910 r3462532 2534 2534 return false; 2535 2535 } 2536 // Block non-chat capabilities even when they appear later in a GPT model ID. 2537 return !preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex|instruct)/i', $model); 2536 // Legacy non-chat model family; incompatible with chat/completions translations. 2537 if (preg_match('/^babbage-/i', $model)) { 2538 return false; 2539 } 2540 // Block non-chat capabilities and known image-generation families. 2541 return !preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex|seedream|bria)/i', $model); 2538 2542 }); 2539 2543 sort($models); 2544 2545 // Place preferred translation models first per provider. 2546 // Existing saved selections are kept by the UI; this only controls default-first ordering. 2547 $preferred_model_patterns = [ 2548 'openai' => [ 2549 '/^gpt-4\.1-mini$/i', 2550 ], 2551 'openrouter' => [ 2552 '/gemini[-\s_.]*2\.5[-\s_.]*flash[-\s_.]*lite/i', 2553 ], 2554 'deepinfra' => [ 2555 '/gemini[-\s_.]*2\.5[-\s_.]*flash(?![-\s_.]*lite)/i', 2556 ], 2557 'deepseek' => [ 2558 '/^deepseek-chat$/i', 2559 ], 2560 'groq' => [ 2561 '/llama[-\s_.]*3\.1[-\s_.]*8b[-\s_.]*instant/i', 2562 ], 2563 ]; 2564 2565 if (isset($preferred_model_patterns[$provider_key])) { 2566 $preferred_index = false; 2567 foreach ($preferred_model_patterns[$provider_key] as $pattern) { 2568 foreach ($models as $index => $model) { 2569 if (preg_match($pattern, $model)) { 2570 $preferred_index = $index; 2571 break 2; 2572 } 2573 } 2574 } 2575 if ($preferred_index !== false) { 2576 $preferred_model = $models[$preferred_index]; 2577 unset($models[$preferred_index]); 2578 array_unshift($models, $preferred_model); 2579 $models = array_values($models); 2580 } 2581 } 2540 2582 wp_send_json_success(['models' => $models]); 2541 2583 }); -
ai-translate/trunk/includes/class-ai-seo.php
r3461910 r3462532 929 929 { 930 930 $type = $node['@type'] ?? ''; 931 $changed = false; 932 933 if ($type === 'BreadcrumbList' && isset($node['itemListElement']) && is_array($node['itemListElement'])) { 931 $changed = false; if ($type === 'BreadcrumbList' && isset($node['itemListElement']) && is_array($node['itemListElement'])) { 934 932 foreach ($node['itemListElement'] as &$item) { 935 933 if (isset($item['name']) && is_string($item['name']) && trim($item['name']) !== '') { … … 942 940 } 943 941 unset($item); 944 } 945 946 // Handle @graph arrays (used by Yoast and others) 942 } // Handle @graph arrays (used by Yoast and others) 947 943 if (isset($node['@graph']) && is_array($node['@graph'])) { 948 944 foreach ($node['@graph'] as &$graphNode) { -
ai-translate/trunk/includes/class-ai-translate-core.php
r3461910 r3462532 352 352 if ($model !== '') { 353 353 // Early guard for model families that are known to be non-chat/non-translation models. 354 if (preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex| instruct)/i', $model)) {354 if (preg_match('/(dall-e|whisper|audio|image|realtime|transcribe|tts|embedding|moderation|codex|seedream|bria)/i', $model)) { 355 355 throw new \Exception( 356 356 sprintf( … … 416 416 || strpos($haystack, 'audio') !== false 417 417 || strpos($haystack, 'codex') !== false 418 || strpos($haystack, 'model_not_found') !== false 419 || strpos($haystack, 'does not exist') !== false 418 420 ); 419 421 if ($nonChatModelError) {
Note: See TracChangeset
for help on using the changeset viewer.