From 99aa2ca06db3dbfc8c872fc8133d25b457f48aaf Mon Sep 17 00:00:00 2001 From: Terence Ong Date: Tue, 7 Apr 2026 15:18:18 +0700 Subject: [PATCH] Fix incorrect OpenRouter model ID (missing -preview suffix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- includes/class-peptide-news-llm.php | 7 +++++++ peptide-news-plugin/includes/class-peptide-news-llm.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/includes/class-peptide-news-llm.php b/includes/class-peptide-news-llm.php index 8362202..47cc17f 100644 --- a/includes/class-peptide-news-llm.php +++ b/includes/class-peptide-news-llm.php @@ -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.' ); } + // 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; $table = $wpdb->prefix . 'peptide_news_articles'; diff --git a/peptide-news-plugin/includes/class-peptide-news-llm.php b/peptide-news-plugin/includes/class-peptide-news-llm.php index 8362202..47cc17f 100644 --- a/peptide-news-plugin/includes/class-peptide-news-llm.php +++ b/peptide-news-plugin/includes/class-peptide-news-llm.php @@ -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.' ); } + // 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; $table = $wpdb->prefix . 'peptide_news_articles';