统一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
@@ -1,5 +1,7 @@
// AI评论生成核心逻辑
import { normalizeApiBaseUrl } from '@/lib/url';
export interface AIComment {
id: string;
userName: string;
@@ -164,7 +166,8 @@ export async function generateAIComments(
const prompt = buildCommentPrompt(movieName, movieInfo, searchResults, count);
// 3. 调用AI API
const response = await fetch(`${aiConfig.CustomBaseURL}/chat/completions`, {
const baseURL = normalizeApiBaseUrl(aiConfig.CustomBaseURL);
const response = await fetch(`${baseURL}/chat/completions`, {
method: 'POST',
headers: {
Authorization: `Bearer ${aiConfig.CustomApiKey}`,