更新安全配置项目

This commit is contained in:
2026-04-13 22:10:43 +08:00
parent 8e245076fe
commit 70d3020035
8 changed files with 43 additions and 284 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import OpenAI from "openai";
import {getConfig} from "@/lib/config";
import {getAIConfig} from "@/lib/config";
function parseTranslation(content: string): string | null {
// 第一步:清理内容,移除 Markdown 代码块、换行、多余空格
@@ -21,7 +21,7 @@ function parseTranslation(content: string): string | null {
// 翻译单个词组(带重试)
export async function translateWithAI(word: string): Promise<string | null> {
// 获取配置
const aiConfig = getConfig().ai
const aiConfig = getAIConfig()
if (!aiConfig.apiKey) {
throw new Error("AI API Key 未配置");