This commit is contained in:
32
src/services/storyEngine/playthroughMatrixLab.ts
Normal file
32
src/services/storyEngine/playthroughMatrixLab.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type {
|
||||
CampaignPack,
|
||||
SimulationRunResult,
|
||||
StoryEngineMemoryState,
|
||||
} from '../../types';
|
||||
import { runStorySimulation } from './storySimulationRunner';
|
||||
|
||||
export function runPlaythroughMatrix(params: {
|
||||
scenarioPackId: string;
|
||||
campaignPack: CampaignPack;
|
||||
memory: StoryEngineMemoryState;
|
||||
seeds: string[];
|
||||
}) {
|
||||
return params.seeds.map((seed) =>
|
||||
runStorySimulation({
|
||||
scenarioPackId: params.scenarioPackId,
|
||||
campaignPack: params.campaignPack,
|
||||
memory: params.memory,
|
||||
seed,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function buildMatrixSummary(results: SimulationRunResult[]) {
|
||||
if (results.length <= 0) {
|
||||
return '当前没有可用的仿真结果。';
|
||||
}
|
||||
|
||||
const endingCount = new Set(results.map((result) => result.endingId ?? 'none')).size;
|
||||
const maxIssueCount = results.reduce((max, result) => Math.max(max, result.issueCount), 0);
|
||||
return `共跑了 ${results.length} 条 simulation,ending family ${endingCount} 类,单次最高 QA 问题 ${maxIssueCount} 条。`;
|
||||
}
|
||||
Reference in New Issue
Block a user