mirror of
https://github.com/THU-MAIC/OpenMAIC.git
synced 2026-10-02 01:15:18 +08:00
refactor(generation): consume the package everywhere and delete lib/generation (#1090)
Part D of #1057 — the switch. All consumers import @openmaic/generation; lib/generation deleted (net -11,900 lines). PBL wiring preserved (single-call -> classified fallback -> injected loop), streaming outline route deduplicated onto buildOutlinePrompt, serverExternalPackages wired, and the change verified by a real-model four-kind end-to-end run against the production build with a rendered-classroom screenshot check. Closes #1057.
This commit is contained in:
@@ -18,9 +18,9 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { join, dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { generateSceneOutlinesFromRequirements } from '@/lib/generation/outline-generator';
|
||||
import { generateSceneOutlinesFromRequirements } from '@openmaic/generation';
|
||||
import { callLLM } from '@/lib/ai/llm';
|
||||
import type { AICallFn } from '@/lib/generation/pipeline-types';
|
||||
import type { AICallFn } from '@openmaic/generation';
|
||||
import { resolveEvalModel } from '../shared/resolve-model';
|
||||
import { createRunDir } from '../shared/run-dir';
|
||||
import { judgeDirective } from './judge';
|
||||
|
||||
@@ -46,7 +46,7 @@ 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 { parseJsonResponse } from '@openmaic/generation';
|
||||
import { buildCompareHtml } from './compare-html';
|
||||
import type { PBLPlannerV2Input, PBLProjectV2 } from '@/lib/pbl/v2/types';
|
||||
import type { SceneOutline } from '@/lib/types/generation';
|
||||
@@ -457,7 +457,15 @@ function runVariant(
|
||||
thinkingConfig?: ThinkingConfig,
|
||||
): Promise<PBLProjectV2> {
|
||||
return variant === 'single-call'
|
||||
? generatePBLV2ProjectSingleCall(input, model, callLLM, undefined, thinkingConfig)
|
||||
? generatePBLV2ProjectSingleCall(input, async (system, prompt) => {
|
||||
const result = await callLLM(
|
||||
{ model, system, prompt },
|
||||
'pbl-v2-planner-single',
|
||||
undefined,
|
||||
thinkingConfig,
|
||||
);
|
||||
return result.text;
|
||||
})
|
||||
: generatePBLV2Project(input, model, callLLM, undefined, thinkingConfig);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user