Fix incorrect OpenRouter model ID (missing -preview suffix)

The configured model qwen/qwen3.6-plus:free doesn't exist on
OpenRouter — the correct ID is qwen/qwen3.6-plus-preview:free.
Add auto-correction in the bulk generation handler.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Terence Ong
2026-04-07 15:18:18 +07:00
parent 359b001e6d
commit 99aa2ca06d
2 changed files with 14 additions and 0 deletions

View File

@@ -393,6 +393,13 @@ class Peptide_News_LLM {
wp_send_json_error( 'AI Analysis is not enabled. Please enable it and set an OpenRouter API key in Peptide News → Settings.' ); wp_send_json_error( 'AI Analysis is not enabled. Please enable it and set an OpenRouter API key in Peptide News → Settings.' );
} }
// Auto-correct known incorrect model name (missing "-preview" suffix).
foreach ( array( 'peptide_news_llm_keywords_model', 'peptide_news_llm_summary_model' ) as $opt ) {
if ( get_option( $opt, '' ) === 'qwen/qwen3.6-plus:free' ) {
update_option( $opt, 'qwen/qwen3.6-plus-preview:free' );
}
}
global $wpdb; global $wpdb;
$table = $wpdb->prefix . 'peptide_news_articles'; $table = $wpdb->prefix . 'peptide_news_articles';

View File

@@ -393,6 +393,13 @@ class Peptide_News_LLM {
wp_send_json_error( 'AI Analysis is not enabled. Please enable it and set an OpenRouter API key in Peptide News → Settings.' ); wp_send_json_error( 'AI Analysis is not enabled. Please enable it and set an OpenRouter API key in Peptide News → Settings.' );
} }
// Auto-correct known incorrect model name (missing "-preview" suffix).
foreach ( array( 'peptide_news_llm_keywords_model', 'peptide_news_llm_summary_model' ) as $opt ) {
if ( get_option( $opt, '' ) === 'qwen/qwen3.6-plus:free' ) {
update_option( $opt, 'qwen/qwen3.6-plus-preview:free' );
}
}
global $wpdb; global $wpdb;
$table = $wpdb->prefix . 'peptide_news_articles'; $table = $wpdb->prefix . 'peptide_news_articles';