From 04bd6dda32ad90ca2b78172bf9e9a7db3ac73b63 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 31 Jan 2026 23:51:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E5=88=86=E6=9E=90=E5=99=A8=E5=BE=AA=E7=8E=AF=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E5=88=9D=E5=A7=8B=E5=8C=96=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改用动态导入 getEnabledAiModelsWithProvider 和 getLanguageModelById - 避免 Cannot access 'T' before initialization 错误 Co-authored-by: Cursor --- lib/ai/smart-analyzer.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ai/smart-analyzer.ts b/lib/ai/smart-analyzer.ts index bf2bcea..c14a9bb 100644 --- a/lib/ai/smart-analyzer.ts +++ b/lib/ai/smart-analyzer.ts @@ -6,8 +6,9 @@ */ import { generateText } from "ai"; -import { getLanguageModelById } from "./dynamic-provider"; -import { getEnabledAiModelsWithProvider } from "@/lib/db/queries"; +// 使用动态导入避免循环依赖问题 +// import { getLanguageModelById } from "./dynamic-provider"; +// import { getEnabledAiModelsWithProvider } from "@/lib/db/queries"; // 分析结果类型 export interface AnalysisResult { @@ -183,6 +184,10 @@ function quickKeywordMatch(text: string, hasImage: boolean): AnalysisResult { * 使用 LLM 进行深度分析 */ async function analyzWithLLM(text: string, hasImage: boolean): Promise { + // 使用动态导入避免循环依赖问题 + const { getEnabledAiModelsWithProvider } = await import("@/lib/db/queries"); + const { getLanguageModelById } = await import("./dynamic-provider"); + // 获取千问3 VL 模型 const allModels = await getEnabledAiModelsWithProvider(); const qwenModel = allModels.find(