mirror of
https://github.com/THU-MAIC/OpenMAIC.git
synced 2026-10-02 01:15:18 +08:00
refactor(pbl-v2): split the planner core from the loop; inject the LLM call path (#1069)
Implements #1062. Pure planner-core extracted from the loop's file; both planners receive their LLM entry as a parameter (call sites pass the real callLLM unchanged); operations/ split into kernel vs runtime with a lint-enforced boundary; planner prompts pinned byte-identical via fixtures generated from the pre-refactor implementation.
This commit is contained in:
@@ -42,8 +42,10 @@ import { createAnthropic } from '@ai-sdk/anthropic';
|
||||
import { createOpenAI } from '@ai-sdk/openai';
|
||||
import { generateText, type LanguageModel } from 'ai';
|
||||
|
||||
import { generatePBLV2Project, PlannerV2Error } from '@/lib/pbl/v2/agents/planner';
|
||||
import { callLLM } from '@/lib/ai/llm';
|
||||
import { generatePBLV2Project } from '@/lib/pbl/v2/agents/planner';
|
||||
import { generatePBLV2ProjectSingleCall } from '@/lib/pbl/v2/agents/planner-single-call';
|
||||
import { PlannerV2Error } from '@/lib/pbl/v2/agents/planner-core';
|
||||
import { parseJsonResponse } from '@/lib/generation/json-repair';
|
||||
import { buildCompareHtml } from './compare-html';
|
||||
import type { PBLPlannerV2Input, PBLProjectV2 } from '@/lib/pbl/v2/types';
|
||||
@@ -455,8 +457,8 @@ function runVariant(
|
||||
thinkingConfig?: ThinkingConfig,
|
||||
): Promise<PBLProjectV2> {
|
||||
return variant === 'single-call'
|
||||
? generatePBLV2ProjectSingleCall(input, model, undefined, thinkingConfig)
|
||||
: generatePBLV2Project(input, model, undefined, thinkingConfig);
|
||||
? generatePBLV2ProjectSingleCall(input, model, callLLM, undefined, thinkingConfig)
|
||||
: generatePBLV2Project(input, model, callLLM, undefined, thinkingConfig);
|
||||
}
|
||||
|
||||
async function runOne(
|
||||
|
||||
Reference in New Issue
Block a user