Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(model-default): 本地数据库未就绪时跳过 Auto 跟随,不再启动告警
fmfsaisai78bd771c2e3e
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/cindyAutoRouteFollow.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/cindyAutoRouteFollow.test.tsindex c9354b969b..2430854868 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/cindyAutoRouteFollow.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/cindyAutoRouteFollow.test.ts@@ -117,6 +117,24 @@ describe('followMovedCindyAutoRoutes', () => {expect(stage).not.toHaveBeenCalled();});+ it('本地数据库还没就绪(启动早期)时直接跳过:不读任务、不报错、不记日志', async () => {+ const listCandidates = vi.fn(async () => {+ throw new Error('DbClient not ready');+ });+ const logger = { info: vi.fn() };+ const { stage, deps: input } = deps({ isReady: () => false, listCandidates, logger });+ await expect(followMovedCindyAutoRoutes(input)).resolves.toBe(0);+ expect(listCandidates).not.toHaveBeenCalled();+ expect(stage).not.toHaveBeenCalled();+ expect(logger.info).not.toHaveBeenCalled();+ });++ it('数据库就绪后照常跟随', async () => {+ const { stage, deps: input } = deps({ isReady: () => true });+ await expect(followMovedCindyAutoRoutes(input)).resolves.toBe(1);+ expect(stage).toHaveBeenCalledTimes(1);+ });+it('没有候选任务时不读供应商目录', async () => {const listProviders = vi.fn(async () => movedToPlatform);const { deps: input } = deps({ listCandidates: async () => [], listProviders });diff --git a/apps/desktop/src/main/maker-ipc/cindyAutoRouteFollow.ts b/apps/desktop/src/main/maker-ipc/cindyAutoRouteFollow.tsindex d3def594a1..b16ec1cad4 100644--- a/apps/desktop/src/main/maker-ipc/cindyAutoRouteFollow.ts+++ b/apps/desktop/src/main/maker-ipc/cindyAutoRouteFollow.ts@@ -36,6 +36,11 @@ export function movedCindyAutoProviderId(}export interface CindyAutoRouteFollowDeps {+ /**+ * 本地数据库是否已就绪。启动早期目录先到、数据库还没接管时直接跳过(不算失败);+ * 数据库就绪后的那次 Cindy AI 刷新会再跑一次跟随。+ */+ isReady?(): boolean;/** 本机进行中、正在用 Auto 的任务(目录刷新时的粗筛,加锁后会重读)。 */listCandidates(): Promise<readonly ({ sessionId: string } & CindyAutoRoute)[]>;listProviders(): Promise<readonly ProviderView[]>;@@ -50,6 +55,7 @@ export interface CindyAutoRouteFollowDeps {/** 返回本次登记了切换的任务数;单个任务失败只记日志,不影响其余任务。 */export async function followMovedCindyAutoRoutes(deps: CindyAutoRouteFollowDeps): Promise<number> {+ if (deps.isReady && !deps.isReady()) return 0;const candidates = await deps.listCandidates();if (candidates.length === 0) return 0;const providers = await deps.listProviders();diff --git a/apps/desktop/src/main/maker-ipc/register.ts b/apps/desktop/src/main/maker-ipc/register.tsindex fba962e697..6b51ffb2b8 100644--- a/apps/desktop/src/main/maker-ipc/register.ts+++ b/apps/desktop/src/main/maker-ipc/register.ts@@ -15022,6 +15022,7 @@ export function registerMakerIpc(maker: Maker, options: RegisterMakerIpcOptions)followMovedCindyAutoRoutesNow = async () => {const owner = getActiveAppSession();await followMovedCindyAutoRoutes({+ isReady: () => tryGetDbClient() !== null,// 远程主机 / 另一台电脑上运行的任务,路由由那一端的目录决定,不在本机改道。listCandidates: async () => (await getDbClient().drizzle.select({sessionId: sessions.id,