fix: 修复智能分析器循环依赖导致的初始化错误
- 改用动态导入 getEnabledAiModelsWithProvider 和 getLanguageModelById - 避免 Cannot access 'T' before initialization 错误 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
64dbbd8e6e
commit
04bd6dda32
@ -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<AnalysisResult | null> {
|
||||
// 使用动态导入避免循环依赖问题
|
||||
const { getEnabledAiModelsWithProvider } = await import("@/lib/db/queries");
|
||||
const { getLanguageModelById } = await import("./dynamic-provider");
|
||||
|
||||
// 获取千问3 VL 模型
|
||||
const allModels = await getEnabledAiModelsWithProvider();
|
||||
const qwenModel = allModels.find(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user