(
type: "chat" | "search" | "image" | "video",
)
| 2544 | |
| 2545 | private async getCurrentProviderConfig( |
| 2546 | type: "chat" | "search" | "image" | "video", |
| 2547 | ): Promise<{ providerConfig: ProviderConfig; model: string; config: DB }> { |
| 2548 | const configManager = await this.getConfigManager(); |
| 2549 | const config = configManager.getConfig(); |
| 2550 | |
| 2551 | const tag = |
| 2552 | type === "chat" |
| 2553 | ? config.currentChatTag |
| 2554 | : type === "search" |
| 2555 | ? config.currentSearchTag |
| 2556 | : type === "image" |
| 2557 | ? config.currentImageTag |
| 2558 | : config.currentVideoTag; |
| 2559 | |
| 2560 | const model = |
| 2561 | type === "chat" |
| 2562 | ? config.currentChatModel |
| 2563 | : type === "search" |
| 2564 | ? config.currentSearchModel |
| 2565 | : type === "image" |
| 2566 | ? config.currentImageModel |
| 2567 | : config.currentVideoModel; |
| 2568 | |
| 2569 | if (!tag || !model || !config.configs[tag]) { |
| 2570 | throw new UserError("请先配置 API 并设置模型"); |
| 2571 | } |
| 2572 | |
| 2573 | return { providerConfig: config.configs[tag], model, config }; |
| 2574 | } |
| 2575 | |
| 2576 | private resolveMode( |
| 2577 | providerConfig: ProviderConfig, |
| 2578 | mode: ProviderMode, |
no test coverage detected