fix: LLM 配置变更后立即生效 — 热重载 Provider Adapter
- AgentLoopEngine 新增 setAdapter() 热切换方法 - main.ts 提取 createAdapter 工厂函数 - IPC config:set 监听 LLM 相关 key 变更,触发热重载 - 覆盖 provider/model/apiKey/baseURL/numCtx 五个关键配置
This commit is contained in:
@@ -40,6 +40,7 @@ export function registerAllIPCHandlers(
|
||||
sessionRecorder: SessionRecorder,
|
||||
memoryManager: MemoryManager,
|
||||
mcpManager: MCPManager,
|
||||
reloadAdapter: () => void,
|
||||
): void {
|
||||
|
||||
// ===== Agent 交互 =====
|
||||
@@ -322,6 +323,12 @@ export function registerAllIPCHandlers(
|
||||
outcome: 'success',
|
||||
});
|
||||
|
||||
// LLM 相关配置变更时热重载 Adapter
|
||||
if (['llm.provider', 'llm.model', 'llm.apiKey', 'llm.baseURL', 'ollama.numCtx'].includes(key)) {
|
||||
reloadAdapter();
|
||||
log.info(`[CONFIG] LLM config changed (${key}), adapter reloaded`);
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user