统一API Base URL保存与请求时去除末尾斜杠

This commit is contained in:
mtvpls
2026-07-25 10:57:04 +08:00
parent 19f4957160
commit ca798177b9
16 changed files with 191 additions and 46 deletions
+4 -1
View File
@@ -6,6 +6,7 @@
import { fetchDoubanData as fetchDoubanAPI } from '@/lib/douban';
import { getNextApiKey } from '@/lib/tmdb.client';
import { normalizeApiBaseUrl } from '@/lib/url';
export interface VideoContext {
title?: string;
@@ -468,7 +469,9 @@ ${availableSources.length === 0 ? '⚠️ 没有可用的数据源,请返回
}
} else {
// OpenAI 或 自定义 (OpenAI兼容格式)
const baseURL = config.baseURL || 'https://api.openai.com/v1';
const baseURL = normalizeApiBaseUrl(
config.baseURL || 'https://api.openai.com/v1'
);
response = await fetch(`${baseURL}/chat/completions`, {
method: 'POST',
headers: {